-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hc-github-team-tf-azure
committed
May 21, 2024
1 parent
bf16979
commit b639027
Showing
160 changed files
with
9,485 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package v2015_11_01 | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/deploymentoperations" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/deployments" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/policyassignments" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/policydefinitions" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/providers" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/resourcegroups" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/resources" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/subscriptions" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/tags" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/tenants" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
type Client struct { | ||
DeploymentOperations *deploymentoperations.DeploymentOperationsClient | ||
Deployments *deployments.DeploymentsClient | ||
PolicyAssignments *policyassignments.PolicyAssignmentsClient | ||
PolicyDefinitions *policydefinitions.PolicyDefinitionsClient | ||
Providers *providers.ProvidersClient | ||
ResourceGroups *resourcegroups.ResourceGroupsClient | ||
Resources *resources.ResourcesClient | ||
Subscriptions *subscriptions.SubscriptionsClient | ||
Tags *tags.TagsClient | ||
Tenants *tenants.TenantsClient | ||
} | ||
|
||
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { | ||
deploymentOperationsClient, err := deploymentoperations.NewDeploymentOperationsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building DeploymentOperations client: %+v", err) | ||
} | ||
configureFunc(deploymentOperationsClient.Client) | ||
|
||
deploymentsClient, err := deployments.NewDeploymentsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Deployments client: %+v", err) | ||
} | ||
configureFunc(deploymentsClient.Client) | ||
|
||
policyAssignmentsClient, err := policyassignments.NewPolicyAssignmentsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building PolicyAssignments client: %+v", err) | ||
} | ||
configureFunc(policyAssignmentsClient.Client) | ||
|
||
policyDefinitionsClient, err := policydefinitions.NewPolicyDefinitionsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building PolicyDefinitions client: %+v", err) | ||
} | ||
configureFunc(policyDefinitionsClient.Client) | ||
|
||
providersClient, err := providers.NewProvidersClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Providers client: %+v", err) | ||
} | ||
configureFunc(providersClient.Client) | ||
|
||
resourceGroupsClient, err := resourcegroups.NewResourceGroupsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building ResourceGroups client: %+v", err) | ||
} | ||
configureFunc(resourceGroupsClient.Client) | ||
|
||
resourcesClient, err := resources.NewResourcesClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Resources client: %+v", err) | ||
} | ||
configureFunc(resourcesClient.Client) | ||
|
||
subscriptionsClient, err := subscriptions.NewSubscriptionsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Subscriptions client: %+v", err) | ||
} | ||
configureFunc(subscriptionsClient.Client) | ||
|
||
tagsClient, err := tags.NewTagsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Tags client: %+v", err) | ||
} | ||
configureFunc(tagsClient.Client) | ||
|
||
tenantsClient, err := tenants.NewTenantsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building Tenants client: %+v", err) | ||
} | ||
configureFunc(tenantsClient.Client) | ||
|
||
return &Client{ | ||
DeploymentOperations: deploymentOperationsClient, | ||
Deployments: deploymentsClient, | ||
PolicyAssignments: policyAssignmentsClient, | ||
PolicyDefinitions: policyDefinitionsClient, | ||
Providers: providersClient, | ||
ResourceGroups: resourceGroupsClient, | ||
Resources: resourcesClient, | ||
Subscriptions: subscriptionsClient, | ||
Tags: tagsClient, | ||
Tenants: tenantsClient, | ||
}, nil | ||
} |
53 changes: 53 additions & 0 deletions
53
resource-manager/resources/2015-11-01/deploymentoperations/README.md
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,53 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/deploymentoperations` Documentation | ||
|
||
The `deploymentoperations` SDK allows for interaction with the Azure Resource Manager Service `resources` (API Version `2015-11-01`). | ||
|
||
This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). | ||
|
||
### Import Path | ||
|
||
```go | ||
import "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2015-11-01/deploymentoperations" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := deploymentoperations.NewDeploymentOperationsClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `DeploymentOperationsClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := deploymentoperations.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "operationIdValue") | ||
|
||
read, err := client.Get(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `DeploymentOperationsClient.List` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := deploymentoperations.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") | ||
|
||
// alternatively `client.List(ctx, id, deploymentoperations.DefaultListOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListComplete(ctx, id, deploymentoperations.DefaultListOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
resource-manager/resources/2015-11-01/deploymentoperations/client.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package deploymentoperations | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type DeploymentOperationsClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewDeploymentOperationsClientWithBaseURI(sdkApi sdkEnv.Api) (*DeploymentOperationsClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "deploymentoperations", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating DeploymentOperationsClient: %+v", err) | ||
} | ||
|
||
return &DeploymentOperationsClient{ | ||
Client: client, | ||
}, nil | ||
} |
128 changes: 128 additions & 0 deletions
128
resource-manager/resources/2015-11-01/deploymentoperations/id_deployment.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package deploymentoperations | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" | ||
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
func init() { | ||
recaser.RegisterResourceId(&DeploymentId{}) | ||
} | ||
|
||
var _ resourceids.ResourceId = &DeploymentId{} | ||
|
||
// DeploymentId is a struct representing the Resource ID for a Deployment | ||
type DeploymentId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
DeploymentName string | ||
} | ||
|
||
// NewDeploymentID returns a new DeploymentId struct | ||
func NewDeploymentID(subscriptionId string, resourceGroupName string, deploymentName string) DeploymentId { | ||
return DeploymentId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
DeploymentName: deploymentName, | ||
} | ||
} | ||
|
||
// ParseDeploymentID parses 'input' into a DeploymentId | ||
func ParseDeploymentID(input string) (*DeploymentId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&DeploymentId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := DeploymentId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseDeploymentIDInsensitively parses 'input' case-insensitively into a DeploymentId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&DeploymentId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := DeploymentId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { | ||
var ok bool | ||
|
||
if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) | ||
} | ||
|
||
if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) | ||
} | ||
|
||
if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID | ||
func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { | ||
v, ok := input.(string) | ||
if !ok { | ||
errors = append(errors, fmt.Errorf("expected %q to be a string", key)) | ||
return | ||
} | ||
|
||
if _, err := ParseDeploymentID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Deployment ID | ||
func (id DeploymentId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/deployments/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Deployment ID | ||
func (id DeploymentId) Segments() []resourceids.Segment { | ||
return []resourceids.Segment{ | ||
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), | ||
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), | ||
resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), | ||
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), | ||
resourceids.StaticSegment("staticDeployments", "deployments", "deployments"), | ||
resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Deployment ID | ||
func (id DeploymentId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Deployment Name: %q", id.DeploymentName), | ||
} | ||
return fmt.Sprintf("Deployment (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.