-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24737 from hashicorp/refactor/managed-hsm-to-its-…
…own-servicepackage refactor: splitting `ManagedHSM` out into it’s own Service Package
- Loading branch information
Showing
26 changed files
with
242 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package client | ||
|
||
import ( | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/keyvault/2023-02-01/managedhsms" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/common" | ||
dataplane "github.com/tombuildsstuff/kermit/sdk/keyvault/7.4/keyvault" | ||
) | ||
|
||
type Client struct { | ||
// NOTE: Key Vault and Managed HSMs are /intentionally/ split into two different service packages | ||
// whilst the service shares a similar interface - the behaviours and functionalities of the service | ||
// including the casing that is required to be used for the constants - differs between the two | ||
// services. | ||
// | ||
// As such this separation on our side is intentional to avoid code reuse given these differences. | ||
|
||
// Resource Manager | ||
ManagedHsmClient *managedhsms.ManagedHsmsClient | ||
|
||
// Data Plane | ||
DataPlaneClient *dataplane.BaseClient | ||
DataPlaneRoleAssignmentsClient *dataplane.RoleAssignmentsClient | ||
DataPlaneRoleDefinitionsClient *dataplane.RoleDefinitionsClient | ||
DataPlaneSecurityDomainsClient *dataplane.HSMSecurityDomainClient | ||
} | ||
|
||
func NewClient(o *common.ClientOptions) *Client { | ||
managedHsmClient := managedhsms.NewManagedHsmsClientWithBaseURI(o.ResourceManagerEndpoint) | ||
o.ConfigureClient(&managedHsmClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
managementClient := dataplane.New() | ||
o.ConfigureClient(&managementClient.Client, o.KeyVaultAuthorizer) | ||
|
||
securityDomainClient := dataplane.NewHSMSecurityDomainClient() | ||
o.ConfigureClient(&securityDomainClient.Client, o.ManagedHSMAuthorizer) | ||
|
||
roleDefinitionsClient := dataplane.NewRoleDefinitionsClient() | ||
o.ConfigureClient(&roleDefinitionsClient.Client, o.ManagedHSMAuthorizer) | ||
|
||
roleAssignmentsClient := dataplane.NewRoleAssignmentsClient() | ||
o.ConfigureClient(&roleAssignmentsClient.Client, o.ManagedHSMAuthorizer) | ||
|
||
return &Client{ | ||
// Resource Manger | ||
ManagedHsmClient: &managedHsmClient, | ||
|
||
// Data Plane | ||
DataPlaneClient: &managementClient, | ||
DataPlaneSecurityDomainsClient: &securityDomainClient, | ||
DataPlaneRoleDefinitionsClient: &roleDefinitionsClient, | ||
DataPlaneRoleAssignmentsClient: &roleAssignmentsClient, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dware_security_module_data_source_test.go → ...dware_security_module_data_source_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.