package
0.20240715.1103416
Repository: https://github.com/hashicorp/go-azure-sdk.git
Documentation: pkg.go.dev
# README
github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2022-04-01/roleassignments
Documentation
The roleassignments
SDK allows for interaction with the Azure Resource Manager Service authorization
(API Version 2022-04-01
).
This readme covers example usages, but further information on using this SDK can be found in the project root.
Import Path
import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2022-04-01/roleassignments"
Client Initialization
client := roleassignments.NewRoleAssignmentsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
Example Usage: RoleAssignmentsClient.Create
ctx := context.TODO()
id := roleassignments.NewScopedRoleAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "roleAssignmentValue")
payload := roleassignments.RoleAssignmentCreateParameters{
// ...
}
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: RoleAssignmentsClient.CreateById
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
payload := roleassignments.RoleAssignmentCreateParameters{
// ...
}
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: RoleAssignmentsClient.Delete
ctx := context.TODO()
id := roleassignments.NewScopedRoleAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "roleAssignmentValue")
read, err := client.Delete(ctx, id, roleassignments.DefaultDeleteOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: RoleAssignmentsClient.DeleteById
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
read, err := client.DeleteById(ctx, id, roleassignments.DefaultDeleteByIdOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: RoleAssignmentsClient.Get
ctx := context.TODO()
id := roleassignments.NewScopedRoleAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "roleAssignmentValue")
read, err := client.Get(ctx, id, roleassignments.DefaultGetOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: RoleAssignmentsClient.GetById
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
read, err := client.GetById(ctx, id, roleassignments.DefaultGetByIdOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: RoleAssignmentsClient.ListForResource
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
// alternatively `client.ListForResource(ctx, id, roleassignments.DefaultListForResourceOperationOptions())` can be used to do batched pagination
items, err := client.ListForResourceComplete(ctx, id, roleassignments.DefaultListForResourceOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: RoleAssignmentsClient.ListForResourceGroup
ctx := context.TODO()
id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group")
// alternatively `client.ListForResourceGroup(ctx, id, roleassignments.DefaultListForResourceGroupOperationOptions())` can be used to do batched pagination
items, err := client.ListForResourceGroupComplete(ctx, id, roleassignments.DefaultListForResourceGroupOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: RoleAssignmentsClient.ListForScope
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
// alternatively `client.ListForScope(ctx, id, roleassignments.DefaultListForScopeOperationOptions())` can be used to do batched pagination
items, err := client.ListForScopeComplete(ctx, id, roleassignments.DefaultListForScopeOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: RoleAssignmentsClient.ListForSubscription
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
// alternatively `client.ListForSubscription(ctx, id, roleassignments.DefaultListForSubscriptionOperationOptions())` can be used to do batched pagination
items, err := client.ListForSubscriptionComplete(ctx, id, roleassignments.DefaultListForSubscriptionOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}