armmsi

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 15 Imported by: 28

README

Azure Managed Service Identity Module for Go

PkgGoDev

The armmsi module provides operations for working with Azure Managed Service Identity.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Managed Service Identity module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Managed Service Identity. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure Managed Service Identity module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armmsi.NewClientFactory(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armmsi.NewClientFactory(<subscription ID>, cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.NewSystemAssignedIdentitiesClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Managed Service Identity label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory added in v1.1.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v1.1.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • subscriptionID - The Id of the Subscription to which the identity belongs.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewFederatedIdentityCredentialsClient added in v1.1.0

func (c *ClientFactory) NewFederatedIdentityCredentialsClient() *FederatedIdentityCredentialsClient

NewFederatedIdentityCredentialsClient creates a new instance of FederatedIdentityCredentialsClient.

func (*ClientFactory) NewOperationsClient added in v1.1.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewSystemAssignedIdentitiesClient added in v1.1.0

func (c *ClientFactory) NewSystemAssignedIdentitiesClient() *SystemAssignedIdentitiesClient

NewSystemAssignedIdentitiesClient creates a new instance of SystemAssignedIdentitiesClient.

func (*ClientFactory) NewUserAssignedIdentitiesClient added in v1.1.0

func (c *ClientFactory) NewUserAssignedIdentitiesClient() *UserAssignedIdentitiesClient

NewUserAssignedIdentitiesClient creates a new instance of UserAssignedIdentitiesClient.

type CreatedByType added in v1.0.0

type CreatedByType string

CreatedByType - The type of identity that created the resource.

const (
	CreatedByTypeApplication     CreatedByType = "Application"
	CreatedByTypeKey             CreatedByType = "Key"
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	CreatedByTypeUser            CreatedByType = "User"
)

func PossibleCreatedByTypeValues added in v1.0.0

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type FederatedIdentityCredential added in v0.7.0

type FederatedIdentityCredential struct {
	// The properties associated with the federated identity credential.
	Properties *FederatedIdentityCredentialProperties

	// READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

FederatedIdentityCredential - Describes a federated identity credential.

func (FederatedIdentityCredential) MarshalJSON added in v0.7.0

func (f FederatedIdentityCredential) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FederatedIdentityCredential.

func (*FederatedIdentityCredential) UnmarshalJSON added in v0.7.0

func (f *FederatedIdentityCredential) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FederatedIdentityCredential.

type FederatedIdentityCredentialProperties added in v0.7.0

type FederatedIdentityCredentialProperties struct {
	// REQUIRED; The list of audiences that can appear in the issued token.
	Audiences []*string

	// REQUIRED; The URL of the issuer to be trusted.
	Issuer *string

	// REQUIRED; The identifier of the external identity.
	Subject *string
}

FederatedIdentityCredentialProperties - The properties associated with a federated identity credential.

func (FederatedIdentityCredentialProperties) MarshalJSON added in v0.7.0

func (f FederatedIdentityCredentialProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FederatedIdentityCredentialProperties.

func (*FederatedIdentityCredentialProperties) UnmarshalJSON added in v0.7.0

func (f *FederatedIdentityCredentialProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FederatedIdentityCredentialProperties.

type FederatedIdentityCredentialsClient added in v0.7.0

type FederatedIdentityCredentialsClient struct {
	// contains filtered or unexported fields
}

FederatedIdentityCredentialsClient contains the methods for the FederatedIdentityCredentials group. Don't use this type directly, use NewFederatedIdentityCredentialsClient() instead.

func NewFederatedIdentityCredentialsClient added in v0.7.0

func NewFederatedIdentityCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FederatedIdentityCredentialsClient, error)

NewFederatedIdentityCredentialsClient creates a new instance of FederatedIdentityCredentialsClient with the specified values.

  • subscriptionID - The Id of the Subscription to which the identity belongs.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*FederatedIdentityCredentialsClient) CreateOrUpdate added in v0.7.0

func (client *FederatedIdentityCredentialsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, parameters FederatedIdentityCredential, options *FederatedIdentityCredentialsClientCreateOrUpdateOptions) (FederatedIdentityCredentialsClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update a federated identity credential under the specified user assigned identity. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the identity resource.
  • federatedIdentityCredentialResourceName - The name of the federated identity credential resource.
  • parameters - Parameters to create or update the federated identity credential.
  • options - FederatedIdentityCredentialsClientCreateOrUpdateOptions contains the optional parameters for the FederatedIdentityCredentialsClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialCreate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewFederatedIdentityCredentialsClient().CreateOrUpdate(ctx, "rgName", "resourceName", "ficResourceName", armmsi.FederatedIdentityCredential{
		Properties: &armmsi.FederatedIdentityCredentialProperties{
			Audiences: []*string{
				to.Ptr("api://AzureADTokenExchange")},
			Issuer:  to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"),
			Subject: to.Ptr("system:serviceaccount:ns:svcaccount"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.FederatedIdentityCredential = armmsi.FederatedIdentityCredential{
	// 	Name: to.Ptr("ficResourceName"),
	// 	Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"),
	// 	ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"),
	// 	Properties: &armmsi.FederatedIdentityCredentialProperties{
	// 		Audiences: []*string{
	// 			to.Ptr("api://AzureADTokenExchange")},
	// 			Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"),
	// 			Subject: to.Ptr("system:serviceaccount:ns:svcaccount"),
	// 		},
	// 	}
}
Output:

func (*FederatedIdentityCredentialsClient) Delete added in v0.7.0

func (client *FederatedIdentityCredentialsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, options *FederatedIdentityCredentialsClientDeleteOptions) (FederatedIdentityCredentialsClientDeleteResponse, error)

Delete - Deletes the federated identity credential. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the identity resource.
  • federatedIdentityCredentialResourceName - The name of the federated identity credential resource.
  • options - FederatedIdentityCredentialsClientDeleteOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialDelete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewFederatedIdentityCredentialsClient().Delete(ctx, "rgName", "resourceName", "ficResourceName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*FederatedIdentityCredentialsClient) Get added in v0.7.0

func (client *FederatedIdentityCredentialsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, options *FederatedIdentityCredentialsClientGetOptions) (FederatedIdentityCredentialsClientGetResponse, error)

Get - Gets the federated identity credential. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the identity resource.
  • federatedIdentityCredentialResourceName - The name of the federated identity credential resource.
  • options - FederatedIdentityCredentialsClientGetOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewFederatedIdentityCredentialsClient().Get(ctx, "rgName", "resourceName", "ficResourceName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.FederatedIdentityCredential = armmsi.FederatedIdentityCredential{
	// 	Name: to.Ptr("ficResourceName"),
	// 	Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"),
	// 	ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"),
	// 	Properties: &armmsi.FederatedIdentityCredentialProperties{
	// 		Audiences: []*string{
	// 			to.Ptr("api://AzureADTokenExchange")},
	// 			Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"),
	// 			Subject: to.Ptr("system:serviceaccount:ns:svcaccount"),
	// 		},
	// 	}
}
Output:

func (*FederatedIdentityCredentialsClient) NewListPager added in v0.7.0

NewListPager - Lists all the federated identity credentials under the specified user assigned identity.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the identity resource.
  • options - FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewFederatedIdentityCredentialsClient().NewListPager("rgName", "resourceName", &armmsi.FederatedIdentityCredentialsClientListOptions{Top: nil,
		Skiptoken: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.FederatedIdentityCredentialsListResult = armmsi.FederatedIdentityCredentialsListResult{
		// 	Value: []*armmsi.FederatedIdentityCredential{
		// 		{
		// 			Name: to.Ptr("ficResourceName"),
		// 			Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"),
		// 			ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"),
		// 			Properties: &armmsi.FederatedIdentityCredentialProperties{
		// 				Audiences: []*string{
		// 					to.Ptr("api://AzureADTokenExchange")},
		// 					Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"),
		// 					Subject: to.Ptr("system:serviceaccount:ns:svcaccount"),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

type FederatedIdentityCredentialsClientCreateOrUpdateOptions added in v0.7.0

type FederatedIdentityCredentialsClientCreateOrUpdateOptions struct {
}

FederatedIdentityCredentialsClientCreateOrUpdateOptions contains the optional parameters for the FederatedIdentityCredentialsClient.CreateOrUpdate method.

type FederatedIdentityCredentialsClientCreateOrUpdateResponse added in v0.7.0

type FederatedIdentityCredentialsClientCreateOrUpdateResponse struct {
	// Describes a federated identity credential.
	FederatedIdentityCredential
}

FederatedIdentityCredentialsClientCreateOrUpdateResponse contains the response from method FederatedIdentityCredentialsClient.CreateOrUpdate.

type FederatedIdentityCredentialsClientDeleteOptions added in v0.7.0

type FederatedIdentityCredentialsClientDeleteOptions struct {
}

FederatedIdentityCredentialsClientDeleteOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Delete method.

type FederatedIdentityCredentialsClientDeleteResponse added in v0.7.0

type FederatedIdentityCredentialsClientDeleteResponse struct {
}

FederatedIdentityCredentialsClientDeleteResponse contains the response from method FederatedIdentityCredentialsClient.Delete.

type FederatedIdentityCredentialsClientGetOptions added in v0.7.0

type FederatedIdentityCredentialsClientGetOptions struct {
}

FederatedIdentityCredentialsClientGetOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Get method.

type FederatedIdentityCredentialsClientGetResponse added in v0.7.0

type FederatedIdentityCredentialsClientGetResponse struct {
	// Describes a federated identity credential.
	FederatedIdentityCredential
}

FederatedIdentityCredentialsClientGetResponse contains the response from method FederatedIdentityCredentialsClient.Get.

type FederatedIdentityCredentialsClientListOptions added in v0.7.0

type FederatedIdentityCredentialsClientListOptions struct {
	// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains
	// a nextLink element, the value of the nextLink element will include a
	// skipToken parameter that specifies a starting point to use for subsequent calls.
	Skiptoken *string

	// Number of records to return.
	Top *int32
}

FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.NewListPager method.

type FederatedIdentityCredentialsClientListResponse added in v0.7.0

type FederatedIdentityCredentialsClientListResponse struct {
	// Values returned by the List operation for federated identity credentials.
	FederatedIdentityCredentialsListResult
}

FederatedIdentityCredentialsClientListResponse contains the response from method FederatedIdentityCredentialsClient.NewListPager.

type FederatedIdentityCredentialsListResult added in v0.7.0

type FederatedIdentityCredentialsListResult struct {
	// The url to get the next page of results, if any.
	NextLink *string

	// The collection of federated identity credentials returned by the listing operation.
	Value []*FederatedIdentityCredential
}

FederatedIdentityCredentialsListResult - Values returned by the List operation for federated identity credentials.

func (FederatedIdentityCredentialsListResult) MarshalJSON added in v0.7.0

func (f FederatedIdentityCredentialsListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FederatedIdentityCredentialsListResult.

func (*FederatedIdentityCredentialsListResult) UnmarshalJSON added in v0.7.0

func (f *FederatedIdentityCredentialsListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FederatedIdentityCredentialsListResult.

type Identity

type Identity struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The properties associated with the identity.
	Properties *UserAssignedIdentityProperties

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Identity - Describes an identity resource.

func (Identity) MarshalJSON

func (i Identity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Identity.

func (*Identity) UnmarshalJSON added in v0.7.0

func (i *Identity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Identity.

type IdentityUpdate

type IdentityUpdate struct {
	// The geo-location where the resource lives
	Location *string

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The properties associated with the identity.
	Properties *UserAssignedIdentityProperties

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

IdentityUpdate - Describes an identity resource.

func (IdentityUpdate) MarshalJSON

func (i IdentityUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type IdentityUpdate.

func (*IdentityUpdate) UnmarshalJSON added in v0.7.0

func (i *IdentityUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type IdentityUpdate.

type Operation

type Operation struct {
	// The object that describes the operation.
	Display *OperationDisplay

	// The name of the REST Operation. This is of the format {provider}/{resource}/{operation}.
	Name *string
}

Operation supported by the Microsoft.ManagedIdentity REST API.

func (Operation) MarshalJSON added in v0.7.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.7.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// A description of the operation.
	Description *string

	// The type of operation. For example: read, write, delete.
	Operation *string

	// Friendly name of the resource provider.
	Provider *string

	// The resource type on which the operation is performed.
	Resource *string
}

OperationDisplay - The object that describes the operation.

func (OperationDisplay) MarshalJSON added in v0.7.0

func (o OperationDisplay) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v0.7.0

func (o *OperationDisplay) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// The url to get the next page of results, if any.
	NextLink *string

	// A list of operations supported by Microsoft.ManagedIdentity Resource Provider.
	Value []*Operation
}

OperationListResult - A list of operations supported by Microsoft.ManagedIdentity Resource Provider.

func (OperationListResult) MarshalJSON

func (o OperationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON added in v0.7.0

func (o *OperationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationsClient

type OperationsClient struct {
	// contains filtered or unexported fields
}

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*OperationsClient) NewListPager added in v0.5.0

NewListPager - Lists available operations for the Microsoft.ManagedIdentity provider

Generated from API version 2023-01-31

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/MsiOperationsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.OperationListResult = armmsi.OperationListResult{
		// 	Value: []*armmsi.Operation{
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/read"),
		// 			Display: &armmsi.OperationDisplay{
		// 				Description: to.Ptr("Gets an existing user assigned identity"),
		// 				Operation: to.Ptr("Get User Assigned Identity"),
		// 				Provider: to.Ptr("Managed Service Identity"),
		// 				Resource: to.Ptr("User Assigned Identities"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/write"),
		// 			Display: &armmsi.OperationDisplay{
		// 				Description: to.Ptr("Creates a new user assigned identity or updates the tags associated with an existing user assigned identity"),
		// 				Operation: to.Ptr("Create/Update User Assigned Identity"),
		// 				Provider: to.Ptr("Managed Service Identity"),
		// 				Resource: to.Ptr("User Assigned Identities"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/delete"),
		// 			Display: &armmsi.OperationDisplay{
		// 				Description: to.Ptr("Deletes an existing user assigned identity"),
		// 				Operation: to.Ptr("Delete User Assigned Identity"),
		// 				Provider: to.Ptr("Managed Service Identity"),
		// 				Resource: to.Ptr("User Assigned Identities"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions added in v0.3.0

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.

type OperationsClientListResponse added in v0.3.0

type OperationsClientListResponse struct {
	// A list of operations supported by Microsoft.ManagedIdentity Resource Provider.
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type SystemAssignedIdentitiesClient

type SystemAssignedIdentitiesClient struct {
	// contains filtered or unexported fields
}

SystemAssignedIdentitiesClient contains the methods for the SystemAssignedIdentities group. Don't use this type directly, use NewSystemAssignedIdentitiesClient() instead.

func NewSystemAssignedIdentitiesClient

func NewSystemAssignedIdentitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SystemAssignedIdentitiesClient, error)

NewSystemAssignedIdentitiesClient creates a new instance of SystemAssignedIdentitiesClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*SystemAssignedIdentitiesClient) GetByScope

GetByScope - Gets the systemAssignedIdentity available under the specified RP scope. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • scope - The resource provider scope of the resource. Parent resource being extended by Managed Identities.
  • options - SystemAssignedIdentitiesClientGetByScopeOptions contains the optional parameters for the SystemAssignedIdentitiesClient.GetByScope method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/SystemAssignedIdentityGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSystemAssignedIdentitiesClient().GetByScope(ctx, "scope", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.SystemAssignedIdentity = armmsi.SystemAssignedIdentity{
	// 	Name: to.Ptr("resourceName"),
	// 	Type: to.Ptr("ResourceProvider"),
	// 	ID: to.Ptr("/scope"),
	// 	Location: to.Ptr("cus"),
	// 	Properties: &armmsi.SystemAssignedIdentityProperties{
	// 		ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
	// 		ClientSecretURL: to.Ptr("https://serviceRoot/scope/credentials?tid=tenantId&oid=principalId&aid=clientId"),
	// 		PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
	// 		TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
	// 	},
	// }
}
Output:

type SystemAssignedIdentitiesClientGetByScopeOptions added in v0.3.0

type SystemAssignedIdentitiesClientGetByScopeOptions struct {
}

SystemAssignedIdentitiesClientGetByScopeOptions contains the optional parameters for the SystemAssignedIdentitiesClient.GetByScope method.

type SystemAssignedIdentitiesClientGetByScopeResponse added in v0.3.0

type SystemAssignedIdentitiesClientGetByScopeResponse struct {
	// Describes a system assigned identity resource.
	SystemAssignedIdentity
}

SystemAssignedIdentitiesClientGetByScopeResponse contains the response from method SystemAssignedIdentitiesClient.GetByScope.

type SystemAssignedIdentity

type SystemAssignedIdentity struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The properties associated with the identity.
	Properties *SystemAssignedIdentityProperties

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

SystemAssignedIdentity - Describes a system assigned identity resource.

func (SystemAssignedIdentity) MarshalJSON

func (s SystemAssignedIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemAssignedIdentity.

func (*SystemAssignedIdentity) UnmarshalJSON added in v0.7.0

func (s *SystemAssignedIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemAssignedIdentity.

type SystemAssignedIdentityProperties

type SystemAssignedIdentityProperties struct {
	// READ-ONLY; The id of the app associated with the identity. This is a random generated UUID by MSI.
	ClientID *string

	// READ-ONLY; The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials.
	ClientSecretURL *string

	// READ-ONLY; The id of the service principal object associated with the created identity.
	PrincipalID *string

	// READ-ONLY; The id of the tenant which the identity belongs to.
	TenantID *string
}

SystemAssignedIdentityProperties - The properties associated with the system assigned identity.

func (SystemAssignedIdentityProperties) MarshalJSON added in v0.7.0

func (s SystemAssignedIdentityProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemAssignedIdentityProperties.

func (*SystemAssignedIdentityProperties) UnmarshalJSON added in v0.7.0

func (s *SystemAssignedIdentityProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemAssignedIdentityProperties.

type SystemData added in v1.0.0

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time

	// The identity that created the resource.
	CreatedBy *string

	// The type of identity that created the resource.
	CreatedByType *CreatedByType

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time

	// The identity that last modified the resource.
	LastModifiedBy *string

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON added in v1.0.0

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON added in v1.0.0

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type UserAssignedIdentitiesClient

type UserAssignedIdentitiesClient struct {
	// contains filtered or unexported fields
}

UserAssignedIdentitiesClient contains the methods for the UserAssignedIdentities group. Don't use this type directly, use NewUserAssignedIdentitiesClient() instead.

func NewUserAssignedIdentitiesClient

func NewUserAssignedIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserAssignedIdentitiesClient, error)

NewUserAssignedIdentitiesClient creates a new instance of UserAssignedIdentitiesClient with the specified values.

  • subscriptionID - The Id of the Subscription to which the identity belongs.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*UserAssignedIdentitiesClient) CreateOrUpdate

CreateOrUpdate - Create or update an identity in the specified subscription and resource group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the Resource Group to which the identity belongs.
  • resourceName - The name of the identity resource.
  • parameters - Parameters to create or update the identity
  • options - UserAssignedIdentitiesClientCreateOrUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityCreate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewUserAssignedIdentitiesClient().CreateOrUpdate(ctx, "rgName", "resourceName", armmsi.Identity{
		Location: to.Ptr("eastus"),
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
			"key2": to.Ptr("value2"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Identity = armmsi.Identity{
	// 	Name: to.Ptr("identityName"),
	// 	Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
	// 	ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
	// 	Location: to.Ptr("eastus"),
	// 	Tags: map[string]*string{
	// 		"key1": to.Ptr("value1"),
	// 		"key2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armmsi.UserAssignedIdentityProperties{
	// 		ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
	// 		PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
	// 		TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
	// 	},
	// }
}
Output:

func (*UserAssignedIdentitiesClient) Delete

Delete - Deletes the identity. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the Resource Group to which the identity belongs.
  • resourceName - The name of the identity resource.
  • options - UserAssignedIdentitiesClientDeleteOptions contains the optional parameters for the UserAssignedIdentitiesClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityDelete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewUserAssignedIdentitiesClient().Delete(ctx, "rgName", "resourceName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*UserAssignedIdentitiesClient) Get

Get - Gets the identity. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the Resource Group to which the identity belongs.
  • resourceName - The name of the identity resource.
  • options - UserAssignedIdentitiesClientGetOptions contains the optional parameters for the UserAssignedIdentitiesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewUserAssignedIdentitiesClient().Get(ctx, "rgName", "resourceName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Identity = armmsi.Identity{
	// 	Name: to.Ptr("identityName"),
	// 	Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
	// 	ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
	// 	Location: to.Ptr("eastus"),
	// 	Tags: map[string]*string{
	// 		"key1": to.Ptr("value1"),
	// 		"key2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armmsi.UserAssignedIdentityProperties{
	// 		ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
	// 		PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
	// 		TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
	// 	},
	// }
}
Output:

func (*UserAssignedIdentitiesClient) NewListByResourceGroupPager added in v0.5.0

NewListByResourceGroupPager - Lists all the userAssignedIdentities available under the specified ResourceGroup.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the Resource Group to which the identity belongs.
  • options - UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewUserAssignedIdentitiesClient().NewListByResourceGroupPager("rgName", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.UserAssignedIdentitiesListResult = armmsi.UserAssignedIdentitiesListResult{
		// 	Value: []*armmsi.Identity{
		// 		{
		// 			Name: to.Ptr("identityName"),
		// 			Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
		// 			ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
		// 			Location: to.Ptr("eastus"),
		// 			Tags: map[string]*string{
		// 				"key1": to.Ptr("value1"),
		// 				"key2": to.Ptr("value2"),
		// 			},
		// 			Properties: &armmsi.UserAssignedIdentityProperties{
		// 				ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
		// 				PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
		// 				TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*UserAssignedIdentitiesClient) NewListBySubscriptionPager added in v0.5.0

NewListBySubscriptionPager - Lists all the userAssignedIdentities available under the specified subscription.

Generated from API version 2023-01-31

  • options - UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewUserAssignedIdentitiesClient().NewListBySubscriptionPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.UserAssignedIdentitiesListResult = armmsi.UserAssignedIdentitiesListResult{
		// 	Value: []*armmsi.Identity{
		// 		{
		// 			Name: to.Ptr("identityName"),
		// 			Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
		// 			ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
		// 			Location: to.Ptr("eastus"),
		// 			Tags: map[string]*string{
		// 				"key1": to.Ptr("value1"),
		// 				"key2": to.Ptr("value2"),
		// 			},
		// 			Properties: &armmsi.UserAssignedIdentityProperties{
		// 				ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
		// 				PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
		// 				TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*UserAssignedIdentitiesClient) Update

Update - Update an identity in the specified subscription and resource group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-01-31

  • resourceGroupName - The name of the Resource Group to which the identity belongs.
  • resourceName - The name of the identity resource.
  • parameters - Parameters to update the identity
  • options - UserAssignedIdentitiesClientUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.Update method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityUpdate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmsi.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewUserAssignedIdentitiesClient().Update(ctx, "rgName", "resourceName", armmsi.IdentityUpdate{
		Location: to.Ptr("eastus"),
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
			"key2": to.Ptr("value2"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Identity = armmsi.Identity{
	// 	Name: to.Ptr("identityName"),
	// 	Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"),
	// 	ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"),
	// 	Location: to.Ptr("eastus"),
	// 	Tags: map[string]*string{
	// 		"key1": to.Ptr("value1"),
	// 		"key2": to.Ptr("value2"),
	// 	},
	// 	Properties: &armmsi.UserAssignedIdentityProperties{
	// 		ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"),
	// 		PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"),
	// 		TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"),
	// 	},
	// }
}
Output:

type UserAssignedIdentitiesClientCreateOrUpdateOptions added in v0.3.0

type UserAssignedIdentitiesClientCreateOrUpdateOptions struct {
}

UserAssignedIdentitiesClientCreateOrUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.CreateOrUpdate method.

type UserAssignedIdentitiesClientCreateOrUpdateResponse added in v0.3.0

type UserAssignedIdentitiesClientCreateOrUpdateResponse struct {
	// Describes an identity resource.
	Identity
}

UserAssignedIdentitiesClientCreateOrUpdateResponse contains the response from method UserAssignedIdentitiesClient.CreateOrUpdate.

type UserAssignedIdentitiesClientDeleteOptions added in v0.3.0

type UserAssignedIdentitiesClientDeleteOptions struct {
}

UserAssignedIdentitiesClientDeleteOptions contains the optional parameters for the UserAssignedIdentitiesClient.Delete method.

type UserAssignedIdentitiesClientDeleteResponse added in v0.3.0

type UserAssignedIdentitiesClientDeleteResponse struct {
}

UserAssignedIdentitiesClientDeleteResponse contains the response from method UserAssignedIdentitiesClient.Delete.

type UserAssignedIdentitiesClientGetOptions added in v0.3.0

type UserAssignedIdentitiesClientGetOptions struct {
}

UserAssignedIdentitiesClientGetOptions contains the optional parameters for the UserAssignedIdentitiesClient.Get method.

type UserAssignedIdentitiesClientGetResponse added in v0.3.0

type UserAssignedIdentitiesClientGetResponse struct {
	// Describes an identity resource.
	Identity
}

UserAssignedIdentitiesClientGetResponse contains the response from method UserAssignedIdentitiesClient.Get.

type UserAssignedIdentitiesClientListByResourceGroupOptions added in v0.3.0

type UserAssignedIdentitiesClientListByResourceGroupOptions struct {
}

UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListByResourceGroupPager method.

type UserAssignedIdentitiesClientListByResourceGroupResponse added in v0.3.0

type UserAssignedIdentitiesClientListByResourceGroupResponse struct {
	// Values returned by the List operation.
	UserAssignedIdentitiesListResult
}

UserAssignedIdentitiesClientListByResourceGroupResponse contains the response from method UserAssignedIdentitiesClient.NewListByResourceGroupPager.

type UserAssignedIdentitiesClientListBySubscriptionOptions added in v0.3.0

type UserAssignedIdentitiesClientListBySubscriptionOptions struct {
}

UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListBySubscriptionPager method.

type UserAssignedIdentitiesClientListBySubscriptionResponse added in v0.3.0

type UserAssignedIdentitiesClientListBySubscriptionResponse struct {
	// Values returned by the List operation.
	UserAssignedIdentitiesListResult
}

UserAssignedIdentitiesClientListBySubscriptionResponse contains the response from method UserAssignedIdentitiesClient.NewListBySubscriptionPager.

type UserAssignedIdentitiesClientUpdateOptions added in v0.3.0

type UserAssignedIdentitiesClientUpdateOptions struct {
}

UserAssignedIdentitiesClientUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.Update method.

type UserAssignedIdentitiesClientUpdateResponse added in v0.3.0

type UserAssignedIdentitiesClientUpdateResponse struct {
	// Describes an identity resource.
	Identity
}

UserAssignedIdentitiesClientUpdateResponse contains the response from method UserAssignedIdentitiesClient.Update.

type UserAssignedIdentitiesListResult

type UserAssignedIdentitiesListResult struct {
	// The url to get the next page of results, if any.
	NextLink *string

	// The collection of userAssignedIdentities returned by the listing operation.
	Value []*Identity
}

UserAssignedIdentitiesListResult - Values returned by the List operation.

func (UserAssignedIdentitiesListResult) MarshalJSON

func (u UserAssignedIdentitiesListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentitiesListResult.

func (*UserAssignedIdentitiesListResult) UnmarshalJSON added in v0.7.0

func (u *UserAssignedIdentitiesListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentitiesListResult.

type UserAssignedIdentityProperties

type UserAssignedIdentityProperties struct {
	// READ-ONLY; The id of the app associated with the identity. This is a random generated UUID by MSI.
	ClientID *string

	// READ-ONLY; The id of the service principal object associated with the created identity.
	PrincipalID *string

	// READ-ONLY; The id of the tenant which the identity belongs to.
	TenantID *string
}

UserAssignedIdentityProperties - The properties associated with the user assigned identity.

func (UserAssignedIdentityProperties) MarshalJSON added in v0.7.0

func (u UserAssignedIdentityProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityProperties.

func (*UserAssignedIdentityProperties) UnmarshalJSON added in v0.7.0

func (u *UserAssignedIdentityProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityProperties.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL