armmsi

package
v1.23.13 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArmMsiService

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

ArmMsiService provides functionality to interact with Azure Managed Service Identity (MSI) resources. It uses a subscription credential provider and ARM client options to authenticate and configure requests.

func NewArmMsiService

func NewArmMsiService(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) ArmMsiService

func (*ArmMsiService) ApplyFederatedCredentials

func (s *ArmMsiService) ApplyFederatedCredentials(ctx context.Context,
	subscriptionId, msiResourceId string,
	federatedCredentials []armmsi.FederatedIdentityCredential) ([]armmsi.FederatedIdentityCredential, error)

func (*ArmMsiService) CreateFederatedCredential

func (s *ArmMsiService) CreateFederatedCredential(
	ctx context.Context,
	subscriptionId, resourceGroup, msiName, name, subject, issuer string,
	audiences []string) (armmsi.FederatedIdentityCredential, error)

CreateFederatedCredential creates or updates a federated identity credential for a managed identity.

Parameters:

  • ctx: The context.Context for the request
  • subscriptionId: The Azure subscription ID
  • resourceGroup: The resource group name containing the managed identity
  • msiName: The name of the managed identity
  • name: The name of the federated credential
  • subject: The subject identifier
  • issuer: The issuer URL
  • audiences: A list of audience values that will be valid for the credential

Returns:

  • FederatedIdentityCredential: The created/updated federated identity credential
  • error: An error if the operation fails, nil otherwise

func (*ArmMsiService) CreateUserIdentity

func (s *ArmMsiService) CreateUserIdentity(
	ctx context.Context,
	subscriptionId, resourceGroup, location, name string) (armmsi.Identity, error)

NewArmMsiService creates a new instance of ArmMsiService. It takes a SubscriptionCredentialProvider for managing credentials and an optional arm.ClientOptions for configuring the ARM client.

Parameters:

  • credentialProvider: Provides credentials for the subscription.
  • armClientOptions: Optional configuration options for the ARM client.

Returns:

An initialized ArmMsiService instance.
- error: An error object if the operation fails, otherwise nil.

func (*ArmMsiService) GetUserIdentity

func (s *ArmMsiService) GetUserIdentity(
	ctx context.Context,
	resourceId string) (armmsi.Identity, error)

GetUserIdentity retrieves user-assigned managed identity information from Azure.

Parameters:

  • ctx: The context.Context for the request
  • resourceId: The fully qualified resource ID of the user-assigned managed identity

Returns:

  • armmsi.Identity: The managed identity information if successful
  • error: An error if the operation fails, including:
  • Error parsing the resource ID
  • Error getting credentials for the subscription
  • Error creating the MSI client
  • Error retrieving the identity from Azure

func (*ArmMsiService) ListUserIdentities

func (s *ArmMsiService) ListUserIdentities(
	ctx context.Context, subscriptionId string) ([]armmsi.Identity, error)

ListUserIdentities retrieves a list of user-assigned managed identities within a specified Azure subscription.

Parameters:

  • ctx: The context.Context for the request
  • subscriptionId: The Azure subscription ID
  • resourceGroup: The name of the resource group

Returns:

  • []armmsi.Identity: A slice of user-assigned managed identities
  • error: An error if the operation fails, nil otherwise

The function creates a new client using the provided subscription credentials and queries the Azure ARM API to list all user-assigned managed identities in the specified resource group. It handles pagination automatically and returns the complete list of identities.

Jump to

Keyboard shortcuts

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