Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating the Go SDK (7861ea0515e6dac3dfab9860c53eee0932fd392f) #964

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions resource-manager/resources/2024-04-01/client.go
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 resource-manager/resources/2024-04-01/policyassignments/README.md
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
}
```
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
}
Loading
Loading