-
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
Apr 16, 2024
1 parent
3092664
commit 7861ea0
Showing
31 changed files
with
2,122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package v2024_04_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/2024-04-01/policyassignments" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
type Client struct { | ||
PolicyAssignments *policyassignments.PolicyAssignmentsClient | ||
} | ||
|
||
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { | ||
policyAssignmentsClient, err := policyassignments.NewPolicyAssignmentsClientWithBaseURI(sdkApi) | ||
if err != nil { | ||
return nil, fmt.Errorf("building PolicyAssignments client: %+v", err) | ||
} | ||
configureFunc(policyAssignmentsClient.Client) | ||
|
||
return &Client{ | ||
PolicyAssignments: policyAssignmentsClient, | ||
}, nil | ||
} |
237 changes: 237 additions & 0 deletions
237
resource-manager/resources/2024-04-01/policyassignments/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,237 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/resources/2024-04-01/policyassignments` Documentation | ||
|
||
The `policyassignments` SDK allows for interaction with the Azure Resource Manager Service `resources` (API Version `2024-04-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-helpers/resourcemanager/commonids" | ||
import "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2024-04-01/policyassignments" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := policyassignments.NewPolicyAssignmentsClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.Create` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue") | ||
|
||
payload := policyassignments.PolicyAssignment{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.Create(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.CreateById` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue") | ||
|
||
payload := policyassignments.PolicyAssignment{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.CreateById(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue") | ||
|
||
read, err := client.Delete(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.DeleteById` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue") | ||
|
||
read, err := client.DeleteById(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue") | ||
|
||
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: `PolicyAssignmentsClient.GetById` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue") | ||
|
||
read, err := client.GetById(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.List` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") | ||
|
||
// alternatively `client.List(ctx, id, policyassignments.DefaultListOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListComplete(ctx, id, policyassignments.DefaultListOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.ListForManagementGroup` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := commonids.NewManagementGroupID("groupIdValue") | ||
|
||
// alternatively `client.ListForManagementGroup(ctx, id, policyassignments.DefaultListForManagementGroupOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListForManagementGroupComplete(ctx, id, policyassignments.DefaultListForManagementGroupOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.ListForResource` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") | ||
|
||
// alternatively `client.ListForResource(ctx, id, policyassignments.DefaultListForResourceOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListForResourceComplete(ctx, id, policyassignments.DefaultListForResourceOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.ListForResourceGroup` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") | ||
|
||
// alternatively `client.ListForResourceGroup(ctx, id, policyassignments.DefaultListForResourceGroupOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListForResourceGroupComplete(ctx, id, policyassignments.DefaultListForResourceGroupOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.Update` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue") | ||
|
||
payload := policyassignments.PolicyAssignmentUpdate{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.Update(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PolicyAssignmentsClient.UpdateById` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue") | ||
|
||
payload := policyassignments.PolicyAssignmentUpdate{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.UpdateById(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
resource-manager/resources/2024-04-01/policyassignments/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 policyassignments | ||
|
||
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 PolicyAssignmentsClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewPolicyAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*PolicyAssignmentsClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "policyassignments", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating PolicyAssignmentsClient: %+v", err) | ||
} | ||
|
||
return &PolicyAssignmentsClient{ | ||
Client: client, | ||
}, nil | ||
} |
Oops, something went wrong.