armcompute

package module
v7.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 16 Imported by: 65

README

Azure Compute Module for Go

The armcompute module provides operations for working with Azure Compute.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Supported version of Go (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 Compute module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Compute. 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 Compute 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 := armcompute.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 := armcompute.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.NewAvailabilitySetsClient()

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.

More sample code

Major Version Upgrade

Go uses semantic import versioning to ensure a good backward compatibility for modules. For Azure Go management SDK, we usually upgrade module version according to cooresponding service's API version. Regarding it could be a complicated experience for major version upgrade, we will try our best to keep the SDK API stable and release new version in backward compatible way. However, if any unavoidable breaking changes and a new major version releases for SDK modules, you could use these commands under your module folder to upgrade:

go install github.com/icholy/gomajor@latest
gomajor get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute@latest

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Compute 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 APIEntityReference

type APIEntityReference struct {
	// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/…
	ID *string
}

APIEntityReference - The API entity reference.

func (APIEntityReference) MarshalJSON

func (a APIEntityReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type APIEntityReference.

func (*APIEntityReference) UnmarshalJSON

func (a *APIEntityReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type APIEntityReference.

type APIError

type APIError struct {
	// The error code.
	Code *string

	// The Api error details
	Details []*APIErrorBase

	// The Api inner error
	Innererror *InnerError

	// The error message.
	Message *string

	// The target of the particular error.
	Target *string
}

APIError - Api error.

func (APIError) MarshalJSON

func (a APIError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type APIError.

func (*APIError) UnmarshalJSON

func (a *APIError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type APIError.

type APIErrorBase

type APIErrorBase struct {
	// The error code.
	Code *string

	// The error message.
	Message *string

	// The target of the particular error.
	Target *string
}

APIErrorBase - Api error base.

func (APIErrorBase) MarshalJSON

func (a APIErrorBase) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type APIErrorBase.

func (*APIErrorBase) UnmarshalJSON

func (a *APIErrorBase) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type APIErrorBase.

type AccessControlRules

type AccessControlRules struct {
	// A list of identities.
	Identities []*AccessControlRulesIdentity

	// A list of privileges.
	Privileges []*AccessControlRulesPrivilege

	// A list of role assignments.
	RoleAssignments []*AccessControlRulesRoleAssignment

	// A list of roles.
	Roles []*AccessControlRulesRole
}

AccessControlRules - This is the Access Control Rules specification for an inVMAccessControlProfile version.

func (AccessControlRules) MarshalJSON

func (a AccessControlRules) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessControlRules.

func (*AccessControlRules) UnmarshalJSON

func (a *AccessControlRules) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessControlRules.

type AccessControlRulesIdentity

type AccessControlRulesIdentity struct {
	// REQUIRED; The name of the identity.
	Name *string

	// The path to the executable.
	ExePath *string

	// The groupName corresponding to this identity.
	GroupName *string

	// The process name of the executable.
	ProcessName *string

	// The username corresponding to this identity.
	UserName *string
}

AccessControlRulesIdentity - The properties of an Access Control Rule Identity.

func (AccessControlRulesIdentity) MarshalJSON

func (a AccessControlRulesIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessControlRulesIdentity.

func (*AccessControlRulesIdentity) UnmarshalJSON

func (a *AccessControlRulesIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessControlRulesIdentity.

type AccessControlRulesMode

type AccessControlRulesMode string

AccessControlRulesMode - This property allows you to specify whether the access control rules are in Audit mode, in Enforce mode or Disabled. Possible values are: 'Audit', 'Enforce' or 'Disabled'.

const (
	AccessControlRulesModeAudit    AccessControlRulesMode = "Audit"
	AccessControlRulesModeDisabled AccessControlRulesMode = "Disabled"
	AccessControlRulesModeEnforce  AccessControlRulesMode = "Enforce"
)

func PossibleAccessControlRulesModeValues

func PossibleAccessControlRulesModeValues() []AccessControlRulesMode

PossibleAccessControlRulesModeValues returns the possible values for the AccessControlRulesMode const type.

type AccessControlRulesPrivilege

type AccessControlRulesPrivilege struct {
	// REQUIRED; The name of the privilege.
	Name *string

	// REQUIRED; The HTTP path corresponding to the privilege.
	Path *string

	// The query parameters to match in the path.
	QueryParameters map[string]*string
}

AccessControlRulesPrivilege - The properties of an Access Control Rule Privilege.

func (AccessControlRulesPrivilege) MarshalJSON

func (a AccessControlRulesPrivilege) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessControlRulesPrivilege.

func (*AccessControlRulesPrivilege) UnmarshalJSON

func (a *AccessControlRulesPrivilege) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessControlRulesPrivilege.

type AccessControlRulesRole

type AccessControlRulesRole struct {
	// REQUIRED; The name of the role.
	Name *string

	// REQUIRED; A list of privileges needed by this role.
	Privileges []*string
}

AccessControlRulesRole - The properties of an Access Control Rule Role.

func (AccessControlRulesRole) MarshalJSON

func (a AccessControlRulesRole) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessControlRulesRole.

func (*AccessControlRulesRole) UnmarshalJSON

func (a *AccessControlRulesRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessControlRulesRole.

type AccessControlRulesRoleAssignment

type AccessControlRulesRoleAssignment struct {
	// REQUIRED; A list of identities that can access the privileges defined by the role.
	Identities []*string

	// REQUIRED; The name of the role.
	Role *string
}

AccessControlRulesRoleAssignment - The properties of an Access Control Rule RoleAssignment.

func (AccessControlRulesRoleAssignment) MarshalJSON

func (a AccessControlRulesRoleAssignment) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessControlRulesRoleAssignment.

func (*AccessControlRulesRoleAssignment) UnmarshalJSON

func (a *AccessControlRulesRoleAssignment) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessControlRulesRoleAssignment.

type AccessLevel

type AccessLevel string

AccessLevel - The Access Level, accepted values include None, Read, Write.

const (
	AccessLevelNone  AccessLevel = "None"
	AccessLevelRead  AccessLevel = "Read"
	AccessLevelWrite AccessLevel = "Write"
)

func PossibleAccessLevelValues

func PossibleAccessLevelValues() []AccessLevel

PossibleAccessLevelValues returns the possible values for the AccessLevel const type.

type AccessURI

type AccessURI struct {
	// READ-ONLY; A SAS uri for accessing a disk.
	AccessSAS *string

	// READ-ONLY; A SAS uri for accessing a VM guest state.
	SecurityDataAccessSAS *string

	// READ-ONLY; A SAS uri for accessing a VM metadata.
	SecurityMetadataAccessSAS *string
}

AccessURI - A disk access SAS uri.

func (AccessURI) MarshalJSON

func (a AccessURI) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AccessURI.

func (*AccessURI) UnmarshalJSON

func (a *AccessURI) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AccessURI.

type ActionType

type ActionType string

ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.

const (
	ActionTypeInternal ActionType = "Internal"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type AdditionalCapabilities

type AdditionalCapabilities struct {
	// The flag enables the usage of FIPS 140-3 compliant cryptography on the protectedSettings of an extension. Learn more at:
	// https://aka.ms/linuxagentfipssupport.
	EnableFips1403Encryption *bool

	// The flag that enables or disables hibernation capability on the VM.
	HibernationEnabled *bool

	// The flag that enables or disables a capability to have one or more managed data disks with UltraSSDLRS storage account
	// type on the VM or VMSS. Managed disks with storage account type UltraSSDLRS can
	// be added to a virtual machine or virtual machine scale set only if this property is enabled.
	UltraSSDEnabled *bool
}

AdditionalCapabilities - Enables or disables a capability on the virtual machine or virtual machine scale set.

func (AdditionalCapabilities) MarshalJSON

func (a AdditionalCapabilities) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AdditionalCapabilities.

func (*AdditionalCapabilities) UnmarshalJSON

func (a *AdditionalCapabilities) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCapabilities.

type AdditionalReplicaSet

type AdditionalReplicaSet struct {
	// The number of direct drive replicas of the Image Version to be created.This Property is updatable
	RegionalReplicaCount *int32

	// Specifies the storage account type to be used to create the direct drive replicas
	StorageAccountType *StorageAccountType
}

AdditionalReplicaSet - Describes the additional replica set information.

func (AdditionalReplicaSet) MarshalJSON

func (a AdditionalReplicaSet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AdditionalReplicaSet.

func (*AdditionalReplicaSet) UnmarshalJSON

func (a *AdditionalReplicaSet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalReplicaSet.

type AdditionalUnattendContent

type AdditionalUnattendContent struct {
	// CONSTANT; The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup.
	// Field has constant value "Microsoft-Windows-Shell-Setup", any specified value is ignored.
	ComponentName *string

	// CONSTANT; The pass name. Currently, the only allowable value is OobeSystem.
	// Field has constant value "OobeSystem", any specified value is ignored.
	PassName *string

	// Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML
	// must be less than 4KB and must include the root element for the setting or
	// feature that is being inserted.
	Content *string

	// Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon.
	SettingName *SettingNames
}

AdditionalUnattendContent - Specifies additional XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied.

func (AdditionalUnattendContent) MarshalJSON

func (a AdditionalUnattendContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AdditionalUnattendContent.

func (*AdditionalUnattendContent) UnmarshalJSON

func (a *AdditionalUnattendContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalUnattendContent.

type AggregatedReplicationState

type AggregatedReplicationState string

AggregatedReplicationState - This is the aggregated replication status based on all the regional replication status flags.

const (
	AggregatedReplicationStateCompleted  AggregatedReplicationState = "Completed"
	AggregatedReplicationStateFailed     AggregatedReplicationState = "Failed"
	AggregatedReplicationStateInProgress AggregatedReplicationState = "InProgress"
	AggregatedReplicationStateUnknown    AggregatedReplicationState = "Unknown"
)

func PossibleAggregatedReplicationStateValues

func PossibleAggregatedReplicationStateValues() []AggregatedReplicationState

PossibleAggregatedReplicationStateValues returns the possible values for the AggregatedReplicationState const type.

type AllInstancesDown added in v7.1.0

type AllInstancesDown struct {
	// Specifies if Scheduled Events should be auto-approved when all instances are down. its default value is true
	AutomaticallyApprove *bool
}

AllInstancesDown - Specifies if Scheduled Events should be auto-approved when all instances are down.

func (AllInstancesDown) MarshalJSON added in v7.1.0

func (a AllInstancesDown) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AllInstancesDown.

func (*AllInstancesDown) UnmarshalJSON added in v7.1.0

func (a *AllInstancesDown) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AllInstancesDown.

type AllocationStrategy

type AllocationStrategy string

AllocationStrategy - Specifies the allocation strategy for the virtual machine scale set based on which the VMs will be allocated.

const (
	AllocationStrategyCapacityOptimized AllocationStrategy = "CapacityOptimized"
	AllocationStrategyLowestPrice       AllocationStrategy = "LowestPrice"
	AllocationStrategyPrioritized       AllocationStrategy = "Prioritized"
)

func PossibleAllocationStrategyValues

func PossibleAllocationStrategyValues() []AllocationStrategy

PossibleAllocationStrategyValues returns the possible values for the AllocationStrategy const type.

type AlternativeOption

type AlternativeOption struct {
	// Describes the type of the alternative option.
	Type *AlternativeType

	// Indicates the alternative option value specified by the Publisher. This is the Offer name when the type is Offer or the
	// Plan name when the type is Plan.
	Value *string
}

AlternativeOption - Describes the alternative option specified by the Publisher for this image when this image is deprecated.

func (AlternativeOption) MarshalJSON

func (a AlternativeOption) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlternativeOption.

func (*AlternativeOption) UnmarshalJSON

func (a *AlternativeOption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlternativeOption.

type AlternativeType

type AlternativeType string

AlternativeType - Describes the type of the alternative option.

const (
	AlternativeTypeNone  AlternativeType = "None"
	AlternativeTypeOffer AlternativeType = "Offer"
	AlternativeTypePlan  AlternativeType = "Plan"
)

func PossibleAlternativeTypeValues

func PossibleAlternativeTypeValues() []AlternativeType

PossibleAlternativeTypeValues returns the possible values for the AlternativeType const type.

type ApplicationProfile

type ApplicationProfile struct {
	// Specifies the gallery applications that should be made available to the VM/VMSS
	GalleryApplications []*VMGalleryApplication
}

ApplicationProfile - Contains the list of gallery applications that should be made available to the VM/VMSS

func (ApplicationProfile) MarshalJSON

func (a ApplicationProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ApplicationProfile.

func (*ApplicationProfile) UnmarshalJSON

func (a *ApplicationProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProfile.

type Architecture

type Architecture string

Architecture - CPU architecture supported by an OS disk.

const (
	ArchitectureArm64 Architecture = "Arm64"
	ArchitectureX64   Architecture = "x64"
)

func PossibleArchitectureValues

func PossibleArchitectureValues() []Architecture

PossibleArchitectureValues returns the possible values for the Architecture const type.

type ArchitectureTypes

type ArchitectureTypes string

ArchitectureTypes - Specifies the Architecture Type

const (
	ArchitectureTypesArm64 ArchitectureTypes = "Arm64"
	ArchitectureTypesX64   ArchitectureTypes = "x64"
)

func PossibleArchitectureTypesValues

func PossibleArchitectureTypesValues() []ArchitectureTypes

PossibleArchitectureTypesValues returns the possible values for the ArchitectureTypes const type.

type AttachDetachDataDisksRequest

type AttachDetachDataDisksRequest struct {
	// The list of managed data disks to be attached.
	DataDisksToAttach []*DataDisksToAttach

	// The list of managed data disks to be detached.
	DataDisksToDetach []*DataDisksToDetach
}

AttachDetachDataDisksRequest - Specifies the input for attaching and detaching a list of managed data disks.

func (AttachDetachDataDisksRequest) MarshalJSON

func (a AttachDetachDataDisksRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AttachDetachDataDisksRequest.

func (*AttachDetachDataDisksRequest) UnmarshalJSON

func (a *AttachDetachDataDisksRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AttachDetachDataDisksRequest.

type AutomaticOSUpgradePolicy

type AutomaticOSUpgradePolicy struct {
	// Whether OS image rollback feature should be disabled. Default value is false.
	DisableAutomaticRollback *bool

	// Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer
	// version of the OS image becomes available. Default value is false. If this is set
	// to true for Windows based scale sets, enableAutomaticUpdates
	// [https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet]
	// is automatically set to false and cannot be set to true.
	EnableAutomaticOSUpgrade *bool

	// Indicates whether Auto OS Upgrade should undergo deferral. Deferred OS upgrades will send advanced notifications on a per-VM
	// basis that an OS upgrade from rolling upgrades is incoming, via the IMDS
	// tag 'Platform.PendingOSUpgrade'. The upgrade then defers until the upgrade is approved via an ApproveRollingUpgrade call.
	OSRollingUpgradeDeferral *bool

	// Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Default value is false. Auto OS Upgrade
	// will fallback to the default policy if no policy is defined on the VMSS.
	UseRollingUpgradePolicy *bool
}

AutomaticOSUpgradePolicy - The configuration parameters used for performing automatic OS upgrade.

func (AutomaticOSUpgradePolicy) MarshalJSON

func (a AutomaticOSUpgradePolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AutomaticOSUpgradePolicy.

func (*AutomaticOSUpgradePolicy) UnmarshalJSON

func (a *AutomaticOSUpgradePolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticOSUpgradePolicy.

type AutomaticOSUpgradeProperties

type AutomaticOSUpgradeProperties struct {
	// REQUIRED; Specifies whether automatic OS upgrade is supported on the image.
	AutomaticOSUpgradeSupported *bool
}

AutomaticOSUpgradeProperties - Describes automatic OS upgrade properties on the image.

func (AutomaticOSUpgradeProperties) MarshalJSON

func (a AutomaticOSUpgradeProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AutomaticOSUpgradeProperties.

func (*AutomaticOSUpgradeProperties) UnmarshalJSON

func (a *AutomaticOSUpgradeProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticOSUpgradeProperties.

type AutomaticRepairsPolicy

type AutomaticRepairsPolicy struct {
	// Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false.
	Enabled *bool

	// The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the
	// state change has completed. This helps avoid premature or accidental repairs.
	// The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 10 minutes (PT10M), which
	// is also the default value. The maximum allowed grace period is 90 minutes
	// (PT90M).
	GracePeriod *string

	// Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy virtual machines in the scale
	// set. Default value is replace.
	RepairAction *RepairAction
}

AutomaticRepairsPolicy - Specifies the configuration parameters for automatic repairs on the virtual machine scale set.

func (AutomaticRepairsPolicy) MarshalJSON

func (a AutomaticRepairsPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AutomaticRepairsPolicy.

func (*AutomaticRepairsPolicy) UnmarshalJSON

func (a *AutomaticRepairsPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticRepairsPolicy.

type AutomaticZoneRebalancingPolicy

type AutomaticZoneRebalancingPolicy struct {
	// Specifies whether Automatic AZ Balancing should be enabled on the virtual machine scale set. The default value is false.
	Enabled *bool

	// Type of rebalance behavior that will be used for recreating virtual machines in the scale set across availability zones.
	// Default and only supported value for now is CreateBeforeDelete.
	RebalanceBehavior *RebalanceBehavior

	// Type of rebalance strategy that will be used for rebalancing virtual machines in the scale set across availability zones.
	// Default and only supported value for now is Recreate.
	RebalanceStrategy *RebalanceStrategy
}

AutomaticZoneRebalancingPolicy - The configuration parameters used while performing automatic AZ balancing.

func (AutomaticZoneRebalancingPolicy) MarshalJSON

func (a AutomaticZoneRebalancingPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AutomaticZoneRebalancingPolicy.

func (*AutomaticZoneRebalancingPolicy) UnmarshalJSON

func (a *AutomaticZoneRebalancingPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticZoneRebalancingPolicy.

type AvailabilityPolicy

type AvailabilityPolicy struct {
	// Determines on how to handle disks with slow I/O.
	ActionOnDiskDelay *AvailabilityPolicyDiskDelay
}

AvailabilityPolicy - In the case of an availability or connectivity issue with the data disk, specify the behavior of your VM

func (AvailabilityPolicy) MarshalJSON

func (a AvailabilityPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailabilityPolicy.

func (*AvailabilityPolicy) UnmarshalJSON

func (a *AvailabilityPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityPolicy.

type AvailabilityPolicyDiskDelay

type AvailabilityPolicyDiskDelay string

AvailabilityPolicyDiskDelay - Determines on how to handle disks with slow I/O.

const (
	// AvailabilityPolicyDiskDelayAutomaticReattach - Upon a disk io failure or slow response, try detaching then reattaching
	// the disk.
	AvailabilityPolicyDiskDelayAutomaticReattach AvailabilityPolicyDiskDelay = "AutomaticReattach"
	// AvailabilityPolicyDiskDelayNone - Defaults to behavior without av policy specified, which is VM restart upon slow disk
	// io.
	AvailabilityPolicyDiskDelayNone AvailabilityPolicyDiskDelay = "None"
)

func PossibleAvailabilityPolicyDiskDelayValues

func PossibleAvailabilityPolicyDiskDelayValues() []AvailabilityPolicyDiskDelay

PossibleAvailabilityPolicyDiskDelayValues returns the possible values for the AvailabilityPolicyDiskDelay const type.

type AvailabilitySet

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

	// The instance view of a resource.
	Properties *AvailabilitySetProperties

	// Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use
	// 'Aligned' for virtual machines with managed disks and 'Classic' for virtual
	// machines with unmanaged disks. Default value is 'Classic'.
	SKU *SKU

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates]. Currently, a VM can only be added to an availability set at creation time. An existing VM cannot be added to an availability set.

func (AvailabilitySet) MarshalJSON

func (a AvailabilitySet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailabilitySet.

func (*AvailabilitySet) UnmarshalJSON

func (a *AvailabilitySet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySet.

type AvailabilitySetListResult

type AvailabilitySetListResult struct {
	// REQUIRED; The list of availability sets.
	Value []*AvailabilitySet

	// The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets.
	NextLink *string
}

AvailabilitySetListResult - The List Availability Set operation response.

func (AvailabilitySetListResult) MarshalJSON

func (a AvailabilitySetListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailabilitySetListResult.

func (*AvailabilitySetListResult) UnmarshalJSON

func (a *AvailabilitySetListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetListResult.

type AvailabilitySetProperties

type AvailabilitySetProperties struct {
	// Fault Domain count.
	PlatformFaultDomainCount *int32

	// Update Domain count.
	PlatformUpdateDomainCount *int32

	// Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version:
	// 2018-04-01.
	ProximityPlacementGroup *SubResource

	// Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the
	// availability set.
	ScheduledEventsPolicy *ScheduledEventsPolicy

	// A list of references to all virtual machines in the availability set.
	VirtualMachines []*SubResource

	// READ-ONLY; The resource status information.
	Statuses []*InstanceViewStatus

	// READ-ONLY; Describes the migration properties on the Availability Set.
	VirtualMachineScaleSetMigrationInfo *VirtualMachineScaleSetMigrationInfo
}

AvailabilitySetProperties - The instance view of a resource.

func (AvailabilitySetProperties) MarshalJSON

func (a AvailabilitySetProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailabilitySetProperties.

func (*AvailabilitySetProperties) UnmarshalJSON

func (a *AvailabilitySetProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetProperties.

type AvailabilitySetUpdate

type AvailabilitySetUpdate struct {
	// The instance view of a resource.
	Properties *AvailabilitySetProperties

	// Sku of the availability set
	SKU *SKU

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

AvailabilitySetUpdate - Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be updated.

func (AvailabilitySetUpdate) MarshalJSON

func (a AvailabilitySetUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailabilitySetUpdate.

func (*AvailabilitySetUpdate) UnmarshalJSON

func (a *AvailabilitySetUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetUpdate.

type AvailabilitySetsClient

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

AvailabilitySetsClient contains the methods for the AvailabilitySets group. Don't use this type directly, use NewAvailabilitySetsClient() instead.

func NewAvailabilitySetsClient

func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailabilitySetsClient, error)

NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*AvailabilitySetsClient) BeginConvertToVirtualMachineScaleSet

BeginConvertToVirtualMachineScaleSet - Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the Availability Set. This does not trigger a downtime on the Virtual Machines. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • options - AvailabilitySetsClientBeginConvertToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.BeginConvertToVirtualMachineScaleSet method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAvailabilitySetsClient().BeginConvertToVirtualMachineScaleSet(ctx, "rgcompute", "myAvailabilitySet", &armcompute.AvailabilitySetsClientBeginConvertToVirtualMachineScaleSetOptions{Parameters: &armcompute.ConvertToVirtualMachineScaleSetInput{
		VirtualMachineScaleSetName: to.Ptr("{vmss-name}"),
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*AvailabilitySetsClient) CancelMigrationToVirtualMachineScaleSet

CancelMigrationToVirtualMachineScaleSet - Cancel the migration operation on an Availability Set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • options - AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAvailabilitySetsClient().CancelMigrationToVirtualMachineScaleSet(ctx, "rgcompute", "myAvailabilitySet", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

func (*AvailabilitySetsClient) CreateOrUpdate

func (client *AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsClientCreateOrUpdateOptions) (AvailabilitySetsClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update an availability set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • parameters - Parameters supplied to the Create Availability Set operation.
  • options - AvailabilitySetsClientCreateOrUpdateOptions contains the optional parameters for the AvailabilitySetsClient.CreateOrUpdate method.
Example (CreateAnAvailabilitySet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().CreateOrUpdate(ctx, "myResourceGroup", "myAvailabilitySet", armcompute.AvailabilitySet{
		Location: to.Ptr("westus"),
		Properties: &armcompute.AvailabilitySetProperties{
			PlatformFaultDomainCount:  to.Ptr[int32](2),
			PlatformUpdateDomainCount: to.Ptr[int32](20),
		},
	}, 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	Name: to.Ptr("myAvailabilitySet"),
	// 	Type: to.Ptr("Microsoft.Compute/availabilitySets"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.AvailabilitySetProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](2),
	// 		PlatformUpdateDomainCount: to.Ptr[int32](20),
	// 		VirtualMachineScaleSetMigrationInfo: &armcompute.VirtualMachineScaleSetMigrationInfo{
	// 			DefaultVirtualMachineScaleSetInfo: &armcompute.DefaultVirtualMachineScaleSetInfo{
	// 				ConstrainedMaximumCapacity: to.Ptr(false),
	// 				DefaultVirtualMachineScaleSet: &armcompute.SubResource{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"),
	// 				},
	// 			},
	// 			MigrateToVirtualMachineScaleSet: &armcompute.SubResource{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"),
	// 			},
	// 		},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Classic"),
	// 	},
	// }
}
Example (CreateAnAvailabilitySetWithScheduledEventPolicy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().CreateOrUpdate(ctx, "myResourceGroup", "myAvailabilitySet", armcompute.AvailabilitySet{
		Location: to.Ptr("westus"),
		Properties: &armcompute.AvailabilitySetProperties{
			PlatformFaultDomainCount:  to.Ptr[int32](2),
			PlatformUpdateDomainCount: to.Ptr[int32](20),
		},
	}, 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	Name: to.Ptr("myAvailabilitySet"),
	// 	Type: to.Ptr("Microsoft.Compute/availabilitySets"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.AvailabilitySetProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](2),
	// 		PlatformUpdateDomainCount: to.Ptr[int32](20),
	// 		ScheduledEventsPolicy: &armcompute.ScheduledEventsPolicy{
	// 			AllInstancesDown: &armcompute.AllInstancesDown{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 			ScheduledEventsAdditionalPublishingTargets: &armcompute.ScheduledEventsAdditionalPublishingTargets{
	// 				EventGridAndResourceGraph: &armcompute.EventGridAndResourceGraph{
	// 					Enable: to.Ptr(true),
	// 					ScheduledEventsAPIVersion: to.Ptr("2020-07-01"),
	// 				},
	// 			},
	// 			UserInitiatedReboot: &armcompute.UserInitiatedReboot{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 			UserInitiatedRedeploy: &armcompute.UserInitiatedRedeploy{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 		},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Classic"),
	// 	},
	// }
}

func (*AvailabilitySetsClient) Delete

func (client *AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientDeleteOptions) (AvailabilitySetsClientDeleteResponse, error)

Delete - Delete an availability set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • options - AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method.
Example (AvailabilitySetDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

func (*AvailabilitySetsClient) Get

func (client *AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientGetOptions) (AvailabilitySetsClientGetResponse, error)

Get - Retrieves information about an availability set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • options - AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method.
Example (AvailabilitySetGetMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaa", 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	Name: to.Ptr("myAvailabilitySet"),
	// 	Type: to.Ptr("Microsoft.Compute/availabilitySets"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"key2505": to.Ptr("aa"),
	// 		"key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
	// 	},
	// 	Properties: &armcompute.AvailabilitySetProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](2),
	// 		PlatformUpdateDomainCount: to.Ptr[int32](20),
	// 		ProximityPlacementGroup: &armcompute.SubResource{
	// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
	// 		},
	// 		ScheduledEventsPolicy: &armcompute.ScheduledEventsPolicy{
	// 			AllInstancesDown: &armcompute.AllInstancesDown{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 			ScheduledEventsAdditionalPublishingTargets: &armcompute.ScheduledEventsAdditionalPublishingTargets{
	// 				EventGridAndResourceGraph: &armcompute.EventGridAndResourceGraph{
	// 					Enable: to.Ptr(true),
	// 					ScheduledEventsAPIVersion: to.Ptr("2020-07-01"),
	// 				},
	// 			},
	// 			UserInitiatedReboot: &armcompute.UserInitiatedReboot{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 			UserInitiatedRedeploy: &armcompute.UserInitiatedRedeploy{
	// 				AutomaticallyApprove: to.Ptr(true),
	// 			},
	// 		},
	// 		Statuses: []*armcompute.InstanceViewStatus{
	// 			{
	// 				Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 				DisplayStatus: to.Ptr("aaaaaa"),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 				Message: to.Ptr("a"),
	// 				Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 		}},
	// 		VirtualMachineScaleSetMigrationInfo: &armcompute.VirtualMachineScaleSetMigrationInfo{
	// 			DefaultVirtualMachineScaleSetInfo: &armcompute.DefaultVirtualMachineScaleSetInfo{
	// 				ConstrainedMaximumCapacity: to.Ptr(false),
	// 				DefaultVirtualMachineScaleSet: &armcompute.SubResource{
	// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"),
	// 				},
	// 			},
	// 			MigrateToVirtualMachineScaleSet: &armcompute.SubResource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/{vmss-name}"),
	// 			},
	// 		},
	// 		VirtualMachines: []*armcompute.SubResource{
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Classic"),
	// 		Capacity: to.Ptr[int64](29),
	// 		Tier: to.Ptr("aaaaaaaaaaaaaa"),
	// 	},
	// }
}
Example (AvailabilitySetGetMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"),
	// 	Location: to.Ptr("westus"),
	// }
}

func (*AvailabilitySetsClient) NewListAvailableSizesPager

func (client *AvailabilitySetsClient) NewListAvailableSizesPager(resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientListAvailableSizesOptions) *runtime.Pager[AvailabilitySetsClientListAvailableSizesResponse]

NewListAvailableSizesPager - Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • options - AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.NewListAvailableSizesPager method.
Example (AvailabilitySetListAvailableSizesMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", 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.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{
		// 	Value: []*armcompute.VirtualMachineSize{
		// 		{
		// 			Name: to.Ptr("Standard_A1_V2"),
		// 			MaxDataDiskCount: to.Ptr[int32](2),
		// 			MemoryInMB: to.Ptr[int32](2048),
		// 			NumberOfCores: to.Ptr[int32](1),
		// 			OSDiskSizeInMB: to.Ptr[int32](1047552),
		// 			ResourceDiskSizeInMB: to.Ptr[int32](10240),
		// 		},
		// 		{
		// 			Name: to.Ptr("Standard_A2_V2"),
		// 			MaxDataDiskCount: to.Ptr[int32](4),
		// 			MemoryInMB: to.Ptr[int32](4096),
		// 			NumberOfCores: to.Ptr[int32](2),
		// 			OSDiskSizeInMB: to.Ptr[int32](1047552),
		// 			ResourceDiskSizeInMB: to.Ptr[int32](20480),
		// 	}},
		// }
	}
}
Example (AvailabilitySetListAvailableSizesMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aa", 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.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{
		// }
	}
}

func (*AvailabilitySetsClient) NewListBySubscriptionPager

NewListBySubscriptionPager - Lists all availability sets in a subscription.

Generated from API version 2025-04-01

  • options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAvailabilitySetsClient().NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")})
	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.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{
		// 	Value: []*armcompute.AvailabilitySet{
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				VirtualMachines: []*armcompute.SubResource{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				VirtualMachines: []*armcompute.SubResource{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("westcentralus"),
		// 			Tags: map[string]*string{
		// 				"{tagName}": to.Ptr("{tagValue}"),
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				VirtualMachines: []*armcompute.SubResource{
		// 				},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("westcentralus"),
		// 			Tags: map[string]*string{
		// 				"{tagName}": to.Ptr("{tagValue}"),
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				VirtualMachines: []*armcompute.SubResource{
		// 				},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 			},
		// 	}},
		// }
	}
}

func (*AvailabilitySetsClient) NewListPager

NewListPager - Lists all availability sets in a resource group.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.NewListPager method.
Example (AvailabilitySetListMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", 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.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{
		// 	Value: []*armcompute.AvailabilitySet{
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 			Tags: map[string]*string{
		// 				"key2039": to.Ptr("aaaaaaaaaaaaa"),
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				ProximityPlacementGroup: &armcompute.SubResource{
		// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 				},
		// 				Statuses: []*armcompute.InstanceViewStatus{
		// 					{
		// 						Code: to.Ptr("aaaaaaaaaaaaaaa"),
		// 						DisplayStatus: to.Ptr("aaaaaaaaaaa"),
		// 						Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 						Message: to.Ptr("aaaaaa"),
		// 						Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()),
		// 				}},
		// 				VirtualMachines: []*armcompute.SubResource{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 				Capacity: to.Ptr[int64](22),
		// 				Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 			Tags: map[string]*string{
		// 				"key5849": to.Ptr("aaaaaaaaaaaaaaa"),
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				ProximityPlacementGroup: &armcompute.SubResource{
		// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 				},
		// 				Statuses: []*armcompute.InstanceViewStatus{
		// 					{
		// 						Code: to.Ptr("aaaaaaaaaaaaaaa"),
		// 						DisplayStatus: to.Ptr("aaaaaaaaaaa"),
		// 						Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 						Message: to.Ptr("aaaaaa"),
		// 						Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()),
		// 				}},
		// 				VirtualMachines: []*armcompute.SubResource{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 				Capacity: to.Ptr[int64](23),
		// 				Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("westcentralus"),
		// 			Tags: map[string]*string{
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				ProximityPlacementGroup: &armcompute.SubResource{
		// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 				},
		// 				Statuses: []*armcompute.InstanceViewStatus{
		// 					{
		// 						Code: to.Ptr("aaaaaaaaaaaaaaa"),
		// 						DisplayStatus: to.Ptr("aaaaaaaaaaa"),
		// 						Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 						Message: to.Ptr("aaaaaa"),
		// 						Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()),
		// 				}},
		// 				VirtualMachines: []*armcompute.SubResource{
		// 				},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 				Capacity: to.Ptr[int64](26),
		// 				Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{availabilitySetName}"),
		// 			Type: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 			Location: to.Ptr("westcentralus"),
		// 			Tags: map[string]*string{
		// 			},
		// 			Properties: &armcompute.AvailabilitySetProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				PlatformUpdateDomainCount: to.Ptr[int32](5),
		// 				ProximityPlacementGroup: &armcompute.SubResource{
		// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
		// 				},
		// 				Statuses: []*armcompute.InstanceViewStatus{
		// 					{
		// 						Code: to.Ptr("aaaaaaaaaaaaaaa"),
		// 						DisplayStatus: to.Ptr("aaaaaaaaaaa"),
		// 						Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 						Message: to.Ptr("aaaaaa"),
		// 						Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()),
		// 				}},
		// 				VirtualMachines: []*armcompute.SubResource{
		// 				},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Classic"),
		// 				Capacity: to.Ptr[int64](6),
		// 				Tier: to.Ptr("aaaaaaaaaaaaaaaaaa"),
		// 			},
		// 	}},
		// }
	}
}
Example (AvailabilitySetListMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", 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.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{
		// 	Value: []*armcompute.AvailabilitySet{
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet1"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 		},
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet2"),
		// 			Location: to.Ptr("australiasoutheast"),
		// 		},
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet3"),
		// 			Location: to.Ptr("westcentralus"),
		// 		},
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet4"),
		// 			Location: to.Ptr("westcentralus"),
		// 	}},
		// }
	}
}

func (*AvailabilitySetsClient) StartMigrationToVirtualMachineScaleSet

StartMigrationToVirtualMachineScaleSet - Start migration operation on an Availability Set to move its Virtual Machines to a Virtual Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that triggers a downtime on the Virtual Machine. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • parameters - Parameters supplied to the migrate operation on the availability set.
  • options - AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAvailabilitySetsClient().StartMigrationToVirtualMachineScaleSet(ctx, "rgcompute", "myAvailabilitySet", armcompute.MigrateToVirtualMachineScaleSetInput{
		VirtualMachineScaleSetFlexible: &armcompute.SubResource{
			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

func (*AvailabilitySetsClient) Update

func (client *AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsClientUpdateOptions) (AvailabilitySetsClientUpdateResponse, error)

Update - Update an availability set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • parameters - Parameters supplied to the Update Availability Set operation.
  • options - AvailabilitySetsClientUpdateOptions contains the optional parameters for the AvailabilitySetsClient.Update method.
Example (AvailabilitySetUpdateMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{
		Tags: map[string]*string{
			"key2574": to.Ptr("aaaaaaaa"),
		},
		Properties: &armcompute.AvailabilitySetProperties{
			PlatformFaultDomainCount:  to.Ptr[int32](2),
			PlatformUpdateDomainCount: to.Ptr[int32](20),
			ProximityPlacementGroup: &armcompute.SubResource{
				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
			},
			VirtualMachines: []*armcompute.SubResource{
				{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
				}},
		},
		SKU: &armcompute.SKU{
			Name:     to.Ptr("DSv3-Type1"),
			Capacity: to.Ptr[int64](7),
			Tier:     to.Ptr("aaa"),
		},
	}, 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	Name: to.Ptr("myAvailabilitySet"),
	// 	Type: to.Ptr("Microsoft.Compute/availabilitySets"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"key2505": to.Ptr("aa"),
	// 		"key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
	// 	},
	// 	Properties: &armcompute.AvailabilitySetProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](2),
	// 		PlatformUpdateDomainCount: to.Ptr[int32](20),
	// 		ProximityPlacementGroup: &armcompute.SubResource{
	// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
	// 		},
	// 		Statuses: []*armcompute.InstanceViewStatus{
	// 			{
	// 				Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 				DisplayStatus: to.Ptr("aaaaaa"),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 				Message: to.Ptr("a"),
	// 				Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 		}},
	// 		VirtualMachines: []*armcompute.SubResource{
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Classic"),
	// 		Capacity: to.Ptr[int64](29),
	// 		Tier: to.Ptr("aaaaaaaaaaaaaa"),
	// 	},
	// }
}
Example (AvailabilitySetUpdateMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Update_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, 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.AvailabilitySet = armcompute.AvailabilitySet{
	// 	Location: to.Ptr("westus"),
	// }
}

func (*AvailabilitySetsClient) ValidateMigrationToVirtualMachineScaleSet

ValidateMigrationToVirtualMachineScaleSet - Validates that the Virtual Machines in the Availability Set can be migrated to the provided Virtual Machine Scale Set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • availabilitySetName - The name of the availability set.
  • parameters - Parameters supplied to the migrate operation on the availability set.
  • options - AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAvailabilitySetsClient().ValidateMigrationToVirtualMachineScaleSet(ctx, "rgcompute", "myAvailabilitySet", armcompute.MigrateToVirtualMachineScaleSetInput{
		VirtualMachineScaleSetFlexible: &armcompute.SubResource{
			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

type AvailabilitySetsClientBeginConvertToVirtualMachineScaleSetOptions

type AvailabilitySetsClientBeginConvertToVirtualMachineScaleSetOptions struct {
	// Parameters supplied to the migrate operation on the availability set.
	Parameters *ConvertToVirtualMachineScaleSetInput

	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

AvailabilitySetsClientBeginConvertToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.BeginConvertToVirtualMachineScaleSet method.

type AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetOptions

type AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetOptions struct {
}

AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet method.

type AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetResponse

type AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetResponse struct {
}

AvailabilitySetsClientCancelMigrationToVirtualMachineScaleSetResponse contains the response from method AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet.

type AvailabilitySetsClientConvertToVirtualMachineScaleSetResponse

type AvailabilitySetsClientConvertToVirtualMachineScaleSetResponse struct {
}

AvailabilitySetsClientConvertToVirtualMachineScaleSetResponse contains the response from method AvailabilitySetsClient.BeginConvertToVirtualMachineScaleSet.

type AvailabilitySetsClientCreateOrUpdateOptions

type AvailabilitySetsClientCreateOrUpdateOptions struct {
}

AvailabilitySetsClientCreateOrUpdateOptions contains the optional parameters for the AvailabilitySetsClient.CreateOrUpdate method.

type AvailabilitySetsClientCreateOrUpdateResponse

type AvailabilitySetsClientCreateOrUpdateResponse struct {
	// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified
	// in the same availability set are allocated to different nodes to maximize availability. For more information about availability
	// sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For
	// more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates).
	// Currently, a VM can only be added to an availability set at creation time. An existing VM cannot be added to an availability
	// set.
	AvailabilitySet
}

AvailabilitySetsClientCreateOrUpdateResponse contains the response from method AvailabilitySetsClient.CreateOrUpdate.

type AvailabilitySetsClientDeleteOptions

type AvailabilitySetsClientDeleteOptions struct {
}

AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method.

type AvailabilitySetsClientDeleteResponse

type AvailabilitySetsClientDeleteResponse struct {
}

AvailabilitySetsClientDeleteResponse contains the response from method AvailabilitySetsClient.Delete.

type AvailabilitySetsClientGetOptions

type AvailabilitySetsClientGetOptions struct {
}

AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method.

type AvailabilitySetsClientGetResponse

type AvailabilitySetsClientGetResponse struct {
	// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified
	// in the same availability set are allocated to different nodes to maximize availability. For more information about availability
	// sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For
	// more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates).
	// Currently, a VM can only be added to an availability set at creation time. An existing VM cannot be added to an availability
	// set.
	AvailabilitySet
}

AvailabilitySetsClientGetResponse contains the response from method AvailabilitySetsClient.Get.

type AvailabilitySetsClientListAvailableSizesOptions

type AvailabilitySetsClientListAvailableSizesOptions struct {
}

AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.NewListAvailableSizesPager method.

type AvailabilitySetsClientListAvailableSizesResponse

type AvailabilitySetsClientListAvailableSizesResponse struct {
	// The List Virtual Machine operation response.
	VirtualMachineSizeListResult
}

AvailabilitySetsClientListAvailableSizesResponse contains the response from method AvailabilitySetsClient.NewListAvailableSizesPager.

type AvailabilitySetsClientListBySubscriptionOptions

type AvailabilitySetsClientListBySubscriptionOptions struct {
	// The expand expression to apply to the operation. Allowed values are 'instanceView'.
	Expand *string
}

AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager method.

type AvailabilitySetsClientListBySubscriptionResponse

type AvailabilitySetsClientListBySubscriptionResponse struct {
	// The List Availability Set operation response.
	AvailabilitySetListResult
}

AvailabilitySetsClientListBySubscriptionResponse contains the response from method AvailabilitySetsClient.NewListBySubscriptionPager.

type AvailabilitySetsClientListOptions

type AvailabilitySetsClientListOptions struct {
}

AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.NewListPager method.

type AvailabilitySetsClientListResponse

type AvailabilitySetsClientListResponse struct {
	// The List Availability Set operation response.
	AvailabilitySetListResult
}

AvailabilitySetsClientListResponse contains the response from method AvailabilitySetsClient.NewListPager.

type AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetOptions

type AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetOptions struct {
}

AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet method.

type AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetResponse

type AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetResponse struct {
}

AvailabilitySetsClientStartMigrationToVirtualMachineScaleSetResponse contains the response from method AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet.

type AvailabilitySetsClientUpdateOptions

type AvailabilitySetsClientUpdateOptions struct {
}

AvailabilitySetsClientUpdateOptions contains the optional parameters for the AvailabilitySetsClient.Update method.

type AvailabilitySetsClientUpdateResponse

type AvailabilitySetsClientUpdateResponse struct {
	// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified
	// in the same availability set are allocated to different nodes to maximize availability. For more information about availability
	// sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For
	// more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates).
	// Currently, a VM can only be added to an availability set at creation time. An existing VM cannot be added to an availability
	// set.
	AvailabilitySet
}

AvailabilitySetsClientUpdateResponse contains the response from method AvailabilitySetsClient.Update.

type AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetOptions

type AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetOptions struct {
}

AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetOptions contains the optional parameters for the AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet method.

type AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetResponse

type AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetResponse struct {
}

AvailabilitySetsClientValidateMigrationToVirtualMachineScaleSetResponse contains the response from method AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet.

type AvailablePatchSummary

type AvailablePatchSummary struct {
	// READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension
	// logs.
	AssessmentActivityID *string

	// READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed.
	CriticalAndSecurityPatchCount *int32

	// READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them.
	Error *APIError

	// READ-ONLY; The UTC timestamp when the operation began.
	LastModifiedTime *time.Time

	// READ-ONLY; The number of all available patches excluding critical and security.
	OtherPatchCount *int32

	// READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete
	// installation but the reboot has not yet occurred.
	RebootPending *bool

	// READ-ONLY; The UTC timestamp when the operation began.
	StartTime *time.Time

	// READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes.
	// At that point it will become "Unknown", "Failed", "Succeeded", or
	// "CompletedWithWarnings."
	Status *PatchOperationStatus
}

AvailablePatchSummary - Describes the properties of an virtual machine instance view for available patch summary.

func (AvailablePatchSummary) MarshalJSON

func (a AvailablePatchSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AvailablePatchSummary.

func (*AvailablePatchSummary) UnmarshalJSON

func (a *AvailablePatchSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchSummary.

type BillingProfile

type BillingProfile struct {
	// Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars.
	// This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time
	// of create/update of Azure Spot VM/VMSS and the operation will only succeed if
	// the maxPrice is greater than the current Azure Spot price.
	// The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice
	// after creation of VM/VMSS.
	// Possible values are:
	// - Any decimal value greater than zero. Example: 0.01538
	// -1 – indicates default price to be up-to on-demand.
	// You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the
	// default max price is -1 if it is not provided by you.
	// Minimum api-version: 2019-03-01.
	MaxPrice *float64
}

BillingProfile - Specifies the billing related details of a Azure Spot VM or VMSS. Minimum api-version: 2019-03-01.

func (BillingProfile) MarshalJSON

func (b BillingProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type BillingProfile.

func (*BillingProfile) UnmarshalJSON

func (b *BillingProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type BillingProfile.

type BootDiagnostics

type BootDiagnostics struct {
	// Whether boot diagnostics should be enabled on the Virtual Machine.
	Enabled *bool

	// Uri of the storage account to use for placing the console output and screenshot. If storageUri is not specified while enabling
	// boot diagnostics, managed storage will be used.
	StorageURI *string
}

BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor.

func (BootDiagnostics) MarshalJSON

func (b BootDiagnostics) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type BootDiagnostics.

func (*BootDiagnostics) UnmarshalJSON

func (b *BootDiagnostics) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type BootDiagnostics.

type BootDiagnosticsInstanceView

type BootDiagnosticsInstanceView struct {
	// READ-ONLY; The console screenshot blob URI. Note: This will not be set if boot diagnostics is currently enabled with managed
	// storage.
	ConsoleScreenshotBlobURI *string

	// READ-ONLY; The serial console log blob Uri. Note: This will not be set if boot diagnostics is currently enabled with managed
	// storage.
	SerialConsoleLogBlobURI *string

	// READ-ONLY; The boot diagnostics status information for the VM. Note: It will be set only if there are errors encountered
	// in enabling boot diagnostics.
	Status *InstanceViewStatus
}

BootDiagnosticsInstanceView - The instance view of a virtual machine boot diagnostics.

func (BootDiagnosticsInstanceView) MarshalJSON

func (b BootDiagnosticsInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type BootDiagnosticsInstanceView.

func (*BootDiagnosticsInstanceView) UnmarshalJSON

func (b *BootDiagnosticsInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type BootDiagnosticsInstanceView.

type CachingTypes

type CachingTypes string

CachingTypes - Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage

const (
	CachingTypesNone      CachingTypes = "None"
	CachingTypesReadOnly  CachingTypes = "ReadOnly"
	CachingTypesReadWrite CachingTypes = "ReadWrite"
)

func PossibleCachingTypesValues

func PossibleCachingTypesValues() []CachingTypes

PossibleCachingTypesValues returns the possible values for the CachingTypes const type.

type CapacityReservation

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

	// REQUIRED; SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. For
	// Block capacity reservations, sku.capacity can only accept values 1, 2, 4, 8, 16, 32, 64.
	// Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported'
	// is true, the SKU capability also specifies the
	// 'SupportedCapacityReservationTypes', which lists the types of capacity reservations (such as Targeted or Block) that the
	// SKU supports. Refer to List Microsoft.Compute SKUs in a region
	// (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values.
	SKU *SKU

	// Properties of the Capacity reservation.
	Properties *CapacityReservationProperties

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

	// The availability zones.
	Zones []*string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

CapacityReservation - Specifies information about the capacity reservation.

func (CapacityReservation) MarshalJSON

func (c CapacityReservation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservation.

func (*CapacityReservation) UnmarshalJSON

func (c *CapacityReservation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservation.

type CapacityReservationGroup

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

	// capacity reservation group Properties.
	Properties *CapacityReservationGroupProperties

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

	// The availability zones.
	Zones []*string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

CapacityReservationGroup - Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved to another capacity reservation group.

func (CapacityReservationGroup) MarshalJSON

func (c CapacityReservationGroup) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroup.

func (*CapacityReservationGroup) UnmarshalJSON

func (c *CapacityReservationGroup) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroup.

type CapacityReservationGroupInstanceView

type CapacityReservationGroupInstanceView struct {
	// READ-ONLY; List of instance view of the capacity reservations under the capacity reservation group.
	CapacityReservations []*CapacityReservationInstanceViewWithName

	// READ-ONLY; List of the subscriptions that the capacity reservation group is shared with. Note: Minimum api-version: 2023-09-01.
	// Please refer to https://aka.ms/computereservationsharing for more details.
	SharedSubscriptionIDs []*SubResourceReadOnly
}

func (CapacityReservationGroupInstanceView) MarshalJSON

func (c CapacityReservationGroupInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupInstanceView.

func (*CapacityReservationGroupInstanceView) UnmarshalJSON

func (c *CapacityReservationGroupInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupInstanceView.

type CapacityReservationGroupInstanceViewTypes

type CapacityReservationGroupInstanceViewTypes string
const (
	CapacityReservationGroupInstanceViewTypesInstanceView CapacityReservationGroupInstanceViewTypes = "instanceView"
)

func PossibleCapacityReservationGroupInstanceViewTypesValues

func PossibleCapacityReservationGroupInstanceViewTypesValues() []CapacityReservationGroupInstanceViewTypes

PossibleCapacityReservationGroupInstanceViewTypesValues returns the possible values for the CapacityReservationGroupInstanceViewTypes const type.

type CapacityReservationGroupListResult

type CapacityReservationGroupListResult struct {
	// REQUIRED; The list of capacity reservation groups.
	Value []*CapacityReservationGroup

	// The URI to fetch the next page of capacity reservation groups. Call ListNext() with this URI to fetch the next page of
	// capacity reservation groups.
	NextLink *string
}

CapacityReservationGroupListResult - The List capacity reservation group with resource group response.

func (CapacityReservationGroupListResult) MarshalJSON

func (c CapacityReservationGroupListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupListResult.

func (*CapacityReservationGroupListResult) UnmarshalJSON

func (c *CapacityReservationGroupListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupListResult.

type CapacityReservationGroupProperties

type CapacityReservationGroupProperties struct {
	// Indicates the type of capacity reservation. Allowed values are 'Block' for block capacity reservations and 'Targeted' for
	// reservations that enable a VM to consume a specific capacity reservation when
	// a capacity reservation group is provided. The reservation type is immutable and cannot be changed after it is assigned.
	ReservationType *ReservationType

	// Specifies the settings to enable sharing across subscriptions for the capacity reservation group resource. The capacity
	// reservation group resource can generally be shared across subscriptions
	// belonging to a single Azure AAD tenant or across AAD tenants if there is a trust relationship established between the tenants.
	// Block capacity reservation does not support sharing across subscriptions.
	// Note: Minimum api-version: 2023-09-01. Please refer to https://aka.ms/computereservationsharing for more details.
	SharingProfile *ResourceSharingProfile

	// READ-ONLY; A list of all capacity reservation resource ids that belong to capacity reservation group.
	CapacityReservations []*SubResourceReadOnly

	// READ-ONLY; The capacity reservation group instance view which has the list of instance views for all the capacity reservations
	// that belong to the capacity reservation group.
	InstanceView *CapacityReservationGroupInstanceView

	// READ-ONLY; A list of references to all virtual machines associated to the capacity reservation group.
	VirtualMachinesAssociated []*SubResourceReadOnly
}

CapacityReservationGroupProperties - capacity reservation group Properties.

func (CapacityReservationGroupProperties) MarshalJSON

func (c CapacityReservationGroupProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupProperties.

func (*CapacityReservationGroupProperties) UnmarshalJSON

func (c *CapacityReservationGroupProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupProperties.

type CapacityReservationGroupUpdate

type CapacityReservationGroupUpdate struct {
	// capacity reservation group Properties.
	Properties *CapacityReservationGroupProperties

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

CapacityReservationGroupUpdate - Specifies information about the capacity reservation group. Only tags can be updated.

func (CapacityReservationGroupUpdate) MarshalJSON

func (c CapacityReservationGroupUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupUpdate.

func (*CapacityReservationGroupUpdate) UnmarshalJSON

func (c *CapacityReservationGroupUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupUpdate.

type CapacityReservationGroupsClient

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

CapacityReservationGroupsClient contains the methods for the CapacityReservationGroups group. Don't use this type directly, use NewCapacityReservationGroupsClient() instead.

func NewCapacityReservationGroupsClient

func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapacityReservationGroupsClient, error)

NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CapacityReservationGroupsClient) CreateOrUpdate

CreateOrUpdate - The operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags and sharing profile may be modified. Please refer to https://aka.ms/CapacityReservation for more details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • parameters - Parameters supplied to the Create capacity reservation Group.
  • options - CapacityReservationGroupsClientCreateOrUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.CreateOrUpdate method.
Example (CreateOrUpdateABlockCapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "blockCapacityReservationGroup", armcompute.CapacityReservationGroup{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("finance"),
		},
		Properties: &armcompute.CapacityReservationGroupProperties{
			ReservationType: to.Ptr(armcompute.ReservationTypeBlock),
		},
		Zones: []*string{
			to.Ptr("1"),
			to.Ptr("2")},
	}, 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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("blockCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/blockCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("finance"),
	// 		"owner": to.Ptr("myCompany"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		ReservationType: to.Ptr(armcompute.ReservationTypeBlock),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1"),
	// 		to.Ptr("2")},
	// 	}
}
Example (CreateOrUpdateACapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", armcompute.CapacityReservationGroup{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("finance"),
		},
		Properties: &armcompute.CapacityReservationGroupProperties{
			SharingProfile: &armcompute.ResourceSharingProfile{
				SubscriptionIDs: []*armcompute.SubResource{
					{
						ID: to.Ptr("/subscriptions/{subscription-id1}"),
					},
					{
						ID: to.Ptr("/subscriptions/{subscription-id2}"),
					}},
			},
		},
		Zones: []*string{
			to.Ptr("1"),
			to.Ptr("2")},
	}, 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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("myCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("finance"),
	// 		"owner": to.Ptr("myCompany"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		SharingProfile: &armcompute.ResourceSharingProfile{
	// 			SubscriptionIDs: []*armcompute.SubResource{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1"),
	// 		to.Ptr("2")},
	// 	}
}
Example (CreateOrUpdateATargetedCapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "targetedCapacityReservationGroup", armcompute.CapacityReservationGroup{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("finance"),
		},
		Properties: &armcompute.CapacityReservationGroupProperties{
			ReservationType: to.Ptr(armcompute.ReservationTypeTargeted),
			SharingProfile: &armcompute.ResourceSharingProfile{
				SubscriptionIDs: []*armcompute.SubResource{
					{
						ID: to.Ptr("/subscriptions/{subscription-id1}"),
					},
					{
						ID: to.Ptr("/subscriptions/{subscription-id2}"),
					}},
			},
		},
		Zones: []*string{
			to.Ptr("1"),
			to.Ptr("2")},
	}, 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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("targetedCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/targetedCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("finance"),
	// 		"owner": to.Ptr("myCompany"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		ReservationType: to.Ptr(armcompute.ReservationTypeTargeted),
	// 		SharingProfile: &armcompute.ResourceSharingProfile{
	// 			SubscriptionIDs: []*armcompute.SubResource{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1"),
	// 		to.Ptr("2")},
	// 	}
}

func (*CapacityReservationGroupsClient) Delete

Delete - The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources are disassociated from the reservation group and all capacity reservations under the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • options - CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete method.
Example (CapacityReservationGroupDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

func (*CapacityReservationGroupsClient) Get

Get - The operation that retrieves information about a capacity reservation group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • options - CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get method.
Example (GetABlockCapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "blockCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)})
	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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("blockCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/blockCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"{tagName}": to.Ptr("{tagValue}"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		CapacityReservations: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation2"),
	// 		}},
	// 		InstanceView: &armcompute.CapacityReservationGroupInstanceView{
	// 			CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("blockCapacityReservation1"),
	// 				},
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("blockCapacityReservation2"),
	// 			}},
	// 		},
	// 		ReservationType: to.Ptr(armcompute.ReservationTypeBlock),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("3"),
	// 		to.Ptr("1")},
	// 	}
}
Example (GetACapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)})
	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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("myCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"{tagName}": to.Ptr("{tagValue}"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		CapacityReservations: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"),
	// 		}},
	// 		InstanceView: &armcompute.CapacityReservationGroupInstanceView{
	// 			CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("myCapacityReservation1"),
	// 				},
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("myCapacityReservation2"),
	// 			}},
	// 			SharedSubscriptionIDs: []*armcompute.SubResourceReadOnly{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 		SharingProfile: &armcompute.ResourceSharingProfile{
	// 			SubscriptionIDs: []*armcompute.SubResource{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("3"),
	// 		to.Ptr("1")},
	// 	}
}
Example (GetATargetedCapacityReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "targetedCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)})
	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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("targetedCapacityReservationGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/targetedCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"{tagName}": to.Ptr("{tagValue}"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		CapacityReservations: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation2"),
	// 		}},
	// 		InstanceView: &armcompute.CapacityReservationGroupInstanceView{
	// 			CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("targetedCapacityReservation1"),
	// 				},
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						CurrentCapacity: to.Ptr[int32](5),
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 							},
	// 							{
	// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("targetedCapacityReservation2"),
	// 			}},
	// 			SharedSubscriptionIDs: []*armcompute.SubResourceReadOnly{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 		ReservationType: to.Ptr(armcompute.ReservationTypeTargeted),
	// 		SharingProfile: &armcompute.ResourceSharingProfile{
	// 			SubscriptionIDs: []*armcompute.SubResource{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id1}"),
	// 				},
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id2}"),
	// 			}},
	// 		},
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("3"),
	// 		to.Ptr("1")},
	// 	}
}

func (*CapacityReservationGroupsClient) NewListByResourceGroupPager

NewListByResourceGroupPager - Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the response to get the next page of capacity reservation groups.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationGroupsClient().NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)})
	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.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{
		// 	Value: []*armcompute.CapacityReservationGroup{
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"),
		// 				}},
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"),
		// 				}},
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation2"),
		// 				}},
		// 				ReservationType: to.Ptr(armcompute.ReservationTypeBlock),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation2"),
		// 				}},
		// 				ReservationType: to.Ptr(armcompute.ReservationTypeTargeted),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 	}},
		// }
	}
}

func (*CapacityReservationGroupsClient) NewListBySubscriptionPager

NewListBySubscriptionPager - Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups.

Generated from API version 2025-04-01

  • options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListBySubscriptionPager method.
Example (ListCapacityReservationGroupsInSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationGroupsClient().NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef),
		ResourceIDsOnly: 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.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{
		// 	Value: []*armcompute.CapacityReservationGroup{
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"),
		// 				}},
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM2"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"),
		// 				}},
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation2"),
		// 				}},
		// 				ReservationType: to.Ptr(armcompute.ReservationTypeBlock),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("{capacityReservationGroupName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.CapacityReservationGroupProperties{
		// 				CapacityReservations: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation2"),
		// 				}},
		// 				ReservationType: to.Ptr(armcompute.ReservationTypeTargeted),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 	}},
		// }
	}
}
Example (ListCapacityReservationGroupsWithResourceIdsOnlyInSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationGroupsClient().NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: nil,
		ResourceIDsOnly: to.Ptr(armcompute.ResourceIDOptionsForGetCapacityReservationGroupsAll),
	})
	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.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{
		// 	Value: []*armcompute.CapacityReservationGroup{
		// 		{
		// 			Type: to.Ptr("Microsoft.Compute/capacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName1}"),
		// 			Location: to.Ptr("SouthCentralUSSTG"),
		// 		},
		// 		{
		// 			Type: to.Ptr("Microsoft.Compute/capacityReservationGroups"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId2}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName2}"),
		// 			Location: to.Ptr("SouthCentralUSSTG"),
		// 	}},
		// }
	}
}

func (*CapacityReservationGroupsClient) Update

Update - The operation to update a capacity reservation group. When updating a capacity reservation group, only tags and sharing profile may be modified. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • parameters - Parameters supplied to the Update capacity reservation Group operation.
  • options - CapacityReservationGroupsClientUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.Update method.
Example (CapacityReservationGroupUpdateMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{
		Tags: map[string]*string{
			"key5355": to.Ptr("aaa"),
		},
		Properties: &armcompute.CapacityReservationGroupProperties{
			InstanceView: &armcompute.CapacityReservationGroupInstanceView{},
		},
	}, 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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Name: to.Ptr("myCapacityReservationGroup"),
	// 	Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armcompute.CapacityReservationGroupProperties{
	// 		CapacityReservations: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 		InstanceView: &armcompute.CapacityReservationGroupInstanceView{
	// 			CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{
	// 				{
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 							DisplayStatus: to.Ptr("aaaaaa"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 							Message: to.Ptr("a"),
	// 							Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 					}},
	// 					UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 						VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 							{
	// 								ID: to.Ptr("aaaa"),
	// 						}},
	// 					},
	// 					Name: to.Ptr("aaaaaaaaaaaaaaaa"),
	// 			}},
	// 		},
	// 		VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1"),
	// 		to.Ptr("2")},
	// 	}
}
Example (CapacityReservationGroupUpdateMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, 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.CapacityReservationGroup = armcompute.CapacityReservationGroup{
	// 	Location: to.Ptr("westus"),
	// }
}

type CapacityReservationGroupsClientCreateOrUpdateOptions

type CapacityReservationGroupsClientCreateOrUpdateOptions struct {
}

CapacityReservationGroupsClientCreateOrUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.CreateOrUpdate method.

type CapacityReservationGroupsClientCreateOrUpdateResponse

type CapacityReservationGroupsClientCreateOrUpdateResponse struct {
	// Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently,
	// a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation
	// cannot be added or moved to another capacity reservation group.
	CapacityReservationGroup
}

CapacityReservationGroupsClientCreateOrUpdateResponse contains the response from method CapacityReservationGroupsClient.CreateOrUpdate.

type CapacityReservationGroupsClientDeleteOptions

type CapacityReservationGroupsClientDeleteOptions struct {
}

CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete method.

type CapacityReservationGroupsClientDeleteResponse

type CapacityReservationGroupsClientDeleteResponse struct {
}

CapacityReservationGroupsClientDeleteResponse contains the response from method CapacityReservationGroupsClient.Delete.

type CapacityReservationGroupsClientGetOptions

type CapacityReservationGroupsClientGetOptions struct {
	// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity
	// reservations under the capacity reservation group which is a snapshot of the
	// runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations.
	Expand *CapacityReservationGroupInstanceViewTypes
}

CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get method.

type CapacityReservationGroupsClientGetResponse

type CapacityReservationGroupsClientGetResponse struct {
	// Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently,
	// a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation
	// cannot be added or moved to another capacity reservation group.
	CapacityReservationGroup
}

CapacityReservationGroupsClientGetResponse contains the response from method CapacityReservationGroupsClient.Get.

type CapacityReservationGroupsClientListByResourceGroupOptions

type CapacityReservationGroupsClientListByResourceGroupOptions struct {
	// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet
	// VM Instance or both resource Ids which are associated to capacity
	// reservation group in the response.
	Expand *ExpandTypesForGetCapacityReservationGroups
}

CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListByResourceGroupPager method.

type CapacityReservationGroupsClientListByResourceGroupResponse

type CapacityReservationGroupsClientListByResourceGroupResponse struct {
	// The List capacity reservation group with resource group response.
	CapacityReservationGroupListResult
}

CapacityReservationGroupsClientListByResourceGroupResponse contains the response from method CapacityReservationGroupsClient.NewListByResourceGroupPager.

type CapacityReservationGroupsClientListBySubscriptionOptions

type CapacityReservationGroupsClientListBySubscriptionOptions struct {
	// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet
	// VM Instance or both resource Ids which are associated to capacity
	// reservation group in the response.
	Expand *ExpandTypesForGetCapacityReservationGroups

	// The query option to fetch Capacity Reservation Group Resource Ids.
	// 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation group resources created in the subscription.
	// 'SharedWithSubscription' enables fetching Resource Ids for all capacity reservation group resources shared with the subscription.
	// 'All' enables fetching Resource Ids for all capacity reservation group resources shared with the subscription and created
	// in the subscription.
	ResourceIDsOnly *ResourceIDOptionsForGetCapacityReservationGroups
}

CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListBySubscriptionPager method.

type CapacityReservationGroupsClientListBySubscriptionResponse

type CapacityReservationGroupsClientListBySubscriptionResponse struct {
	// The List capacity reservation group with resource group response.
	CapacityReservationGroupListResult
}

CapacityReservationGroupsClientListBySubscriptionResponse contains the response from method CapacityReservationGroupsClient.NewListBySubscriptionPager.

type CapacityReservationGroupsClientUpdateOptions

type CapacityReservationGroupsClientUpdateOptions struct {
}

CapacityReservationGroupsClientUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.Update method.

type CapacityReservationGroupsClientUpdateResponse

type CapacityReservationGroupsClientUpdateResponse struct {
	// Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently,
	// a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation
	// cannot be added or moved to another capacity reservation group.
	CapacityReservationGroup
}

CapacityReservationGroupsClientUpdateResponse contains the response from method CapacityReservationGroupsClient.Update.

type CapacityReservationInstanceView

type CapacityReservationInstanceView struct {
	// The resource status information.
	Statuses []*InstanceViewStatus

	// Unutilized capacity of the capacity reservation.
	UtilizationInfo *CapacityReservationUtilization
}

CapacityReservationInstanceView - The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations.

func (CapacityReservationInstanceView) MarshalJSON

func (c CapacityReservationInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceView.

func (*CapacityReservationInstanceView) UnmarshalJSON

func (c *CapacityReservationInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationInstanceView.

type CapacityReservationInstanceViewTypes

type CapacityReservationInstanceViewTypes string
const (
	CapacityReservationInstanceViewTypesInstanceView CapacityReservationInstanceViewTypes = "instanceView"
)

func PossibleCapacityReservationInstanceViewTypesValues

func PossibleCapacityReservationInstanceViewTypesValues() []CapacityReservationInstanceViewTypes

PossibleCapacityReservationInstanceViewTypesValues returns the possible values for the CapacityReservationInstanceViewTypes const type.

type CapacityReservationInstanceViewWithName

type CapacityReservationInstanceViewWithName struct {
	// The resource status information.
	Statuses []*InstanceViewStatus

	// Unutilized capacity of the capacity reservation.
	UtilizationInfo *CapacityReservationUtilization

	// READ-ONLY; The name of the capacity reservation.
	Name *string
}

CapacityReservationInstanceViewWithName - The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group.

func (CapacityReservationInstanceViewWithName) MarshalJSON

func (c CapacityReservationInstanceViewWithName) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceViewWithName.

func (*CapacityReservationInstanceViewWithName) UnmarshalJSON

func (c *CapacityReservationInstanceViewWithName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationInstanceViewWithName.

type CapacityReservationListResult

type CapacityReservationListResult struct {
	// REQUIRED; The list of capacity reservations.
	Value []*CapacityReservation

	// The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity
	// reservations.
	NextLink *string
}

CapacityReservationListResult - The list capacity reservation operation response.

func (CapacityReservationListResult) MarshalJSON

func (c CapacityReservationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationListResult.

func (*CapacityReservationListResult) UnmarshalJSON

func (c *CapacityReservationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationListResult.

type CapacityReservationProfile

type CapacityReservationProfile struct {
	// Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset
	// vm instances provided enough capacity has been reserved. Please refer to
	// https://aka.ms/CapacityReservation for more details.
	CapacityReservationGroup *SubResource
}

CapacityReservationProfile - The parameters of a capacity reservation Profile.

func (CapacityReservationProfile) MarshalJSON

func (c CapacityReservationProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationProfile.

func (*CapacityReservationProfile) UnmarshalJSON

func (c *CapacityReservationProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProfile.

type CapacityReservationProperties

type CapacityReservationProperties struct {
	// Defines the schedule for Block-type capacity reservations. Specifies the schedule during which capacity reservation is
	// active and VM or VMSS resource can be allocated using reservation. This property
	// is required and only supported when the capacity reservation group type is 'Block'. The scheduleProfile, start, and end
	// fields are immutable after creation. Minimum API version: 2025-04-01. Please
	// refer to https://aka.ms/blockcapacityreservation for more details.
	ScheduleProfile *ScheduleProfile

	// READ-ONLY; The Capacity reservation instance view.
	InstanceView *CapacityReservationInstanceView

	// READ-ONLY; Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. Note: The
	// fault domain count specified for a resource (like virtual machines scale set) must be less
	// than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01.
	PlatformFaultDomainCount *int32

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *string

	// READ-ONLY; The date time when the capacity reservation was last updated.
	ProvisioningTime *time.Time

	// READ-ONLY; A unique id generated and assigned to the capacity reservation by the platform which does not change throughout
	// the lifetime of the resource.
	ReservationID *string

	// READ-ONLY; Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01.
	TimeCreated *time.Time

	// READ-ONLY; A list of all virtual machine resource ids that are associated with the capacity reservation.
	VirtualMachinesAssociated []*SubResourceReadOnly
}

CapacityReservationProperties - Properties of the Capacity reservation.

func (CapacityReservationProperties) MarshalJSON

func (c CapacityReservationProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationProperties.

func (*CapacityReservationProperties) UnmarshalJSON

func (c *CapacityReservationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProperties.

type CapacityReservationUpdate

type CapacityReservationUpdate struct {
	// Properties of the Capacity reservation.
	Properties *CapacityReservationProperties

	// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM
	// Skus with the capability called 'CapacityReservationSupported' set to true are
	// supported. When 'CapacityReservationSupported' is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes',
	// which lists the types of capacity reservations (such as Targeted or
	// Block) that the SKU supports. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list)
	// for supported values. Note: The SKU name and capacity
	// cannot be updated for Block capacity reservations.
	SKU *SKU

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

CapacityReservationUpdate - Specifies information about the capacity reservation. sku.capacity cannot be updated for Block Capacity Reservation. Tags can be update for all Capacity Reservation Types.

func (CapacityReservationUpdate) MarshalJSON

func (c CapacityReservationUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationUpdate.

func (*CapacityReservationUpdate) UnmarshalJSON

func (c *CapacityReservationUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationUpdate.

type CapacityReservationUtilization

type CapacityReservationUtilization struct {
	// READ-ONLY; The value provides the current capacity of the VM size which was reserved successfully and for which the customer
	// is getting billed. Minimum api-version: 2022-08-01.
	CurrentCapacity *int32

	// READ-ONLY; A list of all virtual machines resource ids allocated against the capacity reservation.
	VirtualMachinesAllocated []*SubResourceReadOnly
}

CapacityReservationUtilization - Represents the capacity reservation utilization in terms of resources allocated.

func (CapacityReservationUtilization) MarshalJSON

func (c CapacityReservationUtilization) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapacityReservationUtilization.

func (*CapacityReservationUtilization) UnmarshalJSON

func (c *CapacityReservationUtilization) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationUtilization.

type CapacityReservationsClient

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

CapacityReservationsClient contains the methods for the CapacityReservations group. Don't use this type directly, use NewCapacityReservationsClient() instead.

func NewCapacityReservationsClient

func NewCapacityReservationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapacityReservationsClient, error)

NewCapacityReservationsClient creates a new instance of CapacityReservationsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CapacityReservationsClient) BeginCreateOrUpdate

func (client *CapacityReservationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[CapacityReservationsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • capacityReservationName - The name of the capacity reservation.
  • parameters - Parameters supplied to the Create capacity reservation.
  • options - CapacityReservationsClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginCreateOrUpdate method.
Example (CreateOrUpdateABlockCapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "blockCapacityReservationGroup", "blockCapacityReservation", armcompute.CapacityReservation{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("HR"),
		},
		Properties: &armcompute.CapacityReservationProperties{
			ScheduleProfile: &armcompute.ScheduleProfile{
				End:   to.Ptr("2025-08-02"),
				Start: to.Ptr("2025-08-01"),
			},
		},
		SKU: &armcompute.SKU{
			Name:     to.Ptr("Standard_ND96isr_H100_v5"),
			Capacity: to.Ptr[int64](1),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("blockCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 		ScheduleProfile: &armcompute.ScheduleProfile{
	// 			End: to.Ptr("2025-08-02"),
	// 			Start: to.Ptr("2025-08-01"),
	// 		},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_ND96isr_H100_v5"),
	// 		Capacity: to.Ptr[int64](1),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (CreateOrUpdateACapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", armcompute.CapacityReservation{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("HR"),
		},
		SKU: &armcompute.SKU{
			Name:     to.Ptr("Standard_DS1_v2"),
			Capacity: to.Ptr[int64](4),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("myCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_DS1_v2"),
	// 		Capacity: to.Ptr[int64](4),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (CreateOrUpdateATargetedCapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "targetedCapacityReservationGroup", "targetedCapacityReservation", armcompute.CapacityReservation{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("HR"),
		},
		SKU: &armcompute.SKU{
			Name:     to.Ptr("Standard_DS1_v2"),
			Capacity: to.Ptr[int64](4),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("targetedCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_DS1_v2"),
	// 		Capacity: to.Ptr[int64](4),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}

func (*CapacityReservationsClient) BeginDelete

func (client *CapacityReservationsClient) BeginDelete(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*runtime.Poller[CapacityReservationsClientDeleteResponse], error)

BeginDelete - The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more details. Note: Block capacity reservations cannot be deleted after it has been successfully allocated until the schedule end time. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • capacityReservationName - The name of the capacity reservation.
  • options - CapacityReservationsClientBeginDeleteOptions contains the optional parameters for the CapacityReservationsClient.BeginDelete method.
Example (CapacityReservationDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Example (CapacityReservationDeleteMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginDelete(ctx, "rgcompute", "aaa", "aaaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CapacityReservationsClient) BeginUpdate

func (client *CapacityReservationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*runtime.Poller[CapacityReservationsClientUpdateResponse], error)

BeginUpdate - The operation to update a capacity reservation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • capacityReservationName - The name of the capacity reservation.
  • parameters - Parameters supplied to the Update capacity reservation operation.
  • options - CapacityReservationsClientBeginUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginUpdate method.
Example (CapacityReservationUpdateMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationUpdate{
		Tags: map[string]*string{
			"key4974": to.Ptr("aaaaaaaaaaaaaaaa"),
		},
		Properties: &armcompute.CapacityReservationProperties{
			InstanceView: &armcompute.CapacityReservationInstanceView{
				Statuses: []*armcompute.InstanceViewStatus{
					{
						Code:          to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
						DisplayStatus: to.Ptr("aaaaaa"),
						Level:         to.Ptr(armcompute.StatusLevelTypesInfo),
						Message:       to.Ptr("a"),
						Time:          to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
					}},
				UtilizationInfo: &armcompute.CapacityReservationUtilization{},
			},
		},
		SKU: &armcompute.SKU{
			Name:     to.Ptr("Standard_DS1_v2"),
			Capacity: to.Ptr[int64](7),
			Tier:     to.Ptr("aaa"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("myCapacityReservation"),
	// 	Type: to.Ptr("aaaaaaaaaaaaaaa"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		InstanceView: &armcompute.CapacityReservationInstanceView{
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 					DisplayStatus: to.Ptr("aaaaaa"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					Message: to.Ptr("a"),
	// 					Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 			}},
	// 			UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 				VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 					{
	// 						ID: to.Ptr("aaaa"),
	// 				}},
	// 			},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 		VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_DS1_v2"),
	// 		Capacity: to.Ptr[int64](4),
	// 		Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (CapacityReservationUpdateMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCapacityReservationsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", armcompute.CapacityReservationUpdate{}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CapacityReservation = armcompute.CapacityReservation{
	// 	Location: to.Ptr("westus"),
	// 	SKU: &armcompute.SKU{
	// 	},
	// }
}

func (*CapacityReservationsClient) Get

func (client *CapacityReservationsClient) Get(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientGetOptions) (CapacityReservationsClientGetResponse, error)

Get - The operation that retrieves information about the capacity reservation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • capacityReservationName - The name of the capacity reservation.
  • options - CapacityReservationsClientGetOptions contains the optional parameters for the CapacityReservationsClient.Get method.
Example (GetABlockCapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "blockCapacityReservationGroup", "blockCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)})
	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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("blockCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/blockCapacityReservationGroup/capacityReservations/blockCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		InstanceView: &armcompute.CapacityReservationInstanceView{
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("ProvisioningState/succeeded"),
	// 					DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			}},
	// 			UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 				CurrentCapacity: to.Ptr[int32](5),
	// 				VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 					},
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 				}},
	// 			},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 		ScheduleProfile: &armcompute.ScheduleProfile{
	// 			End: to.Ptr("2025-08-02T11:30:00Z"),
	// 			Start: to.Ptr("2025-08-01T12:00:00Z"),
	// 		},
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_ND96isr_H100_v5"),
	// 		Capacity: to.Ptr[int64](1),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (GetACapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)})
	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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("myCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		InstanceView: &armcompute.CapacityReservationInstanceView{
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("ProvisioningState/succeeded"),
	// 					DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			}},
	// 			UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 				CurrentCapacity: to.Ptr[int32](5),
	// 				VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 					},
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 				}},
	// 			},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_DS1_v2"),
	// 		Capacity: to.Ptr[int64](4),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (GetATargetedCapacityReservation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "targetedCapacityReservationGroup", "targetedCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)})
	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.CapacityReservation = armcompute.CapacityReservation{
	// 	Name: to.Ptr("targetedCapacityReservation"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/targetedCapacityReservationGroup/capacityReservations/targetedCapacityReservation"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.CapacityReservationProperties{
	// 		InstanceView: &armcompute.CapacityReservationInstanceView{
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("ProvisioningState/succeeded"),
	// 					DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			}},
	// 			UtilizationInfo: &armcompute.CapacityReservationUtilization{
	// 				CurrentCapacity: to.Ptr[int32](5),
	// 				VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 					},
	// 					{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 				}},
	// 			},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		ReservationID: to.Ptr("{GUID}"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
	// 		VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
	// 			},
	// 			{
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("Standard_DS1_v2"),
	// 		Capacity: to.Ptr[int64](4),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}

func (*CapacityReservationsClient) NewListByCapacityReservationGroupPager

func (client *CapacityReservationsClient) NewListByCapacityReservationGroupPager(resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationsClientListByCapacityReservationGroupOptions) *runtime.Pager[CapacityReservationsClientListByCapacityReservationGroupResponse]

NewListByCapacityReservationGroupPager - Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in the response to get the next page of capacity reservations.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • capacityReservationGroupName - The name of the capacity reservation group.
  • options - CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.NewListByCapacityReservationGroupPager method.
Example (ListBlockCapacityReservationsInReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "blockCapacityReservationGroup", 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.CapacityReservationListResult = armcompute.CapacityReservationListResult{
		// 	Value: []*armcompute.CapacityReservation{
		// 		{
		// 			Name: to.Ptr("{capacityReservationName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 			Location: to.Ptr("West US"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("HR"),
		// 			},
		// 			Properties: &armcompute.CapacityReservationProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 				ReservationID: to.Ptr("{GUID}"),
		// 				ScheduleProfile: &armcompute.ScheduleProfile{
		// 					End: to.Ptr("2025-08-02T11:30:00Z"),
		// 					Start: to.Ptr("2025-08-01T12:00:00Z"),
		// 				},
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Standard_ND96isr_H100_v5"),
		// 				Capacity: to.Ptr[int64](1),
		// 			},
		// 			Zones: []*string{
		// 				to.Ptr("1")},
		// 			},
		// 			{
		// 				Name: to.Ptr("{capacityReservationName}"),
		// 				Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 				Location: to.Ptr("West US"),
		// 				Tags: map[string]*string{
		// 					"department": to.Ptr("HR"),
		// 				},
		// 				Properties: &armcompute.CapacityReservationProperties{
		// 					PlatformFaultDomainCount: to.Ptr[int32](3),
		// 					ProvisioningState: to.Ptr("Succeeded"),
		// 					ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 					ReservationID: to.Ptr("{GUID}"),
		// 					ScheduleProfile: &armcompute.ScheduleProfile{
		// 						End: to.Ptr("2025-08-02T11:30:00Z"),
		// 						Start: to.Ptr("2025-08-01T12:00:00Z"),
		// 					},
		// 					VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
		// 					}},
		// 				},
		// 				SKU: &armcompute.SKU{
		// 					Name: to.Ptr("Standard_ND96isr_H100_v5"),
		// 					Capacity: to.Ptr[int64](1),
		// 				},
		// 				Zones: []*string{
		// 					to.Ptr("1")},
		// 			}},
		// 		}
	}
}
Example (ListCapacityReservationsInReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", 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.CapacityReservationListResult = armcompute.CapacityReservationListResult{
		// 	Value: []*armcompute.CapacityReservation{
		// 		{
		// 			Name: to.Ptr("{capacityReservationName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 			Location: to.Ptr("West US"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("HR"),
		// 			},
		// 			Properties: &armcompute.CapacityReservationProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 				ReservationID: to.Ptr("{GUID}"),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Standard_DS1_v2"),
		// 				Capacity: to.Ptr[int64](4),
		// 			},
		// 			Zones: []*string{
		// 				to.Ptr("1")},
		// 			},
		// 			{
		// 				Name: to.Ptr("{capacityReservationName}"),
		// 				Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 				Location: to.Ptr("West US"),
		// 				Tags: map[string]*string{
		// 					"department": to.Ptr("HR"),
		// 				},
		// 				Properties: &armcompute.CapacityReservationProperties{
		// 					PlatformFaultDomainCount: to.Ptr[int32](3),
		// 					ProvisioningState: to.Ptr("Succeeded"),
		// 					ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 					ReservationID: to.Ptr("{GUID}"),
		// 					VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
		// 					}},
		// 				},
		// 				SKU: &armcompute.SKU{
		// 					Name: to.Ptr("Standard_A1_v2"),
		// 					Capacity: to.Ptr[int64](4),
		// 				},
		// 				Zones: []*string{
		// 					to.Ptr("1")},
		// 			}},
		// 		}
	}
}
Example (ListCapacityReservationsInTargetedReservationGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "targetedCapacityReservationGroup", 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.CapacityReservationListResult = armcompute.CapacityReservationListResult{
		// 	Value: []*armcompute.CapacityReservation{
		// 		{
		// 			Name: to.Ptr("{capacityReservationName}"),
		// 			Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 			Location: to.Ptr("West US"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("HR"),
		// 			},
		// 			Properties: &armcompute.CapacityReservationProperties{
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 				ReservationID: to.Ptr("{GUID}"),
		// 				VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"),
		// 					},
		// 					{
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("Standard_DS1_v2"),
		// 				Capacity: to.Ptr[int64](4),
		// 			},
		// 			Zones: []*string{
		// 				to.Ptr("1")},
		// 			},
		// 			{
		// 				Name: to.Ptr("{capacityReservationName}"),
		// 				Type: to.Ptr("Microsoft.Compute/CapacityReservations"),
		// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"),
		// 				Location: to.Ptr("West US"),
		// 				Tags: map[string]*string{
		// 					"department": to.Ptr("HR"),
		// 				},
		// 				Properties: &armcompute.CapacityReservationProperties{
		// 					PlatformFaultDomainCount: to.Ptr[int32](3),
		// 					ProvisioningState: to.Ptr("Succeeded"),
		// 					ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()),
		// 					ReservationID: to.Ptr("{GUID}"),
		// 					VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"),
		// 					}},
		// 				},
		// 				SKU: &armcompute.SKU{
		// 					Name: to.Ptr("Standard_A1_v2"),
		// 					Capacity: to.Ptr[int64](4),
		// 				},
		// 				Zones: []*string{
		// 					to.Ptr("1")},
		// 			}},
		// 		}
	}
}

type CapacityReservationsClientBeginCreateOrUpdateOptions

type CapacityReservationsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CapacityReservationsClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginCreateOrUpdate method.

type CapacityReservationsClientBeginDeleteOptions

type CapacityReservationsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CapacityReservationsClientBeginDeleteOptions contains the optional parameters for the CapacityReservationsClient.BeginDelete method.

type CapacityReservationsClientBeginUpdateOptions

type CapacityReservationsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CapacityReservationsClientBeginUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginUpdate method.

type CapacityReservationsClientCreateOrUpdateResponse

type CapacityReservationsClientCreateOrUpdateResponse struct {
	// Specifies information about the capacity reservation.
	CapacityReservation
}

CapacityReservationsClientCreateOrUpdateResponse contains the response from method CapacityReservationsClient.BeginCreateOrUpdate.

type CapacityReservationsClientDeleteResponse

type CapacityReservationsClientDeleteResponse struct {
}

CapacityReservationsClientDeleteResponse contains the response from method CapacityReservationsClient.BeginDelete.

type CapacityReservationsClientGetOptions

type CapacityReservationsClientGetOptions struct {
	// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity
	// reservation that is managed by the platform and can change outside of
	// control plane operations.
	Expand *CapacityReservationInstanceViewTypes
}

CapacityReservationsClientGetOptions contains the optional parameters for the CapacityReservationsClient.Get method.

type CapacityReservationsClientGetResponse

type CapacityReservationsClientGetResponse struct {
	// Specifies information about the capacity reservation.
	CapacityReservation
}

CapacityReservationsClientGetResponse contains the response from method CapacityReservationsClient.Get.

type CapacityReservationsClientListByCapacityReservationGroupOptions

type CapacityReservationsClientListByCapacityReservationGroupOptions struct {
}

CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.NewListByCapacityReservationGroupPager method.

type CapacityReservationsClientListByCapacityReservationGroupResponse

type CapacityReservationsClientListByCapacityReservationGroupResponse struct {
	// The list capacity reservation operation response.
	CapacityReservationListResult
}

CapacityReservationsClientListByCapacityReservationGroupResponse contains the response from method CapacityReservationsClient.NewListByCapacityReservationGroupPager.

type CapacityReservationsClientUpdateResponse

type CapacityReservationsClientUpdateResponse struct {
	// Specifies information about the capacity reservation.
	CapacityReservation
}

CapacityReservationsClientUpdateResponse contains the response from method CapacityReservationsClient.BeginUpdate.

type ClientFactory

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

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 target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewAvailabilitySetsClient

func (c *ClientFactory) NewAvailabilitySetsClient() *AvailabilitySetsClient

NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient.

func (*ClientFactory) NewCapacityReservationGroupsClient

func (c *ClientFactory) NewCapacityReservationGroupsClient() *CapacityReservationGroupsClient

NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient.

func (*ClientFactory) NewCapacityReservationsClient

func (c *ClientFactory) NewCapacityReservationsClient() *CapacityReservationsClient

NewCapacityReservationsClient creates a new instance of CapacityReservationsClient.

func (*ClientFactory) NewCloudServiceOperatingSystemsClient

func (c *ClientFactory) NewCloudServiceOperatingSystemsClient() *CloudServiceOperatingSystemsClient

NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient.

func (*ClientFactory) NewCloudServiceRoleInstancesClient

func (c *ClientFactory) NewCloudServiceRoleInstancesClient() *CloudServiceRoleInstancesClient

NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient.

func (*ClientFactory) NewCloudServiceRolesClient

func (c *ClientFactory) NewCloudServiceRolesClient() *CloudServiceRolesClient

NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient.

func (*ClientFactory) NewCloudServicesClient

func (c *ClientFactory) NewCloudServicesClient() *CloudServicesClient

NewCloudServicesClient creates a new instance of CloudServicesClient.

func (*ClientFactory) NewCloudServicesUpdateDomainClient

func (c *ClientFactory) NewCloudServicesUpdateDomainClient() *CloudServicesUpdateDomainClient

NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient.

func (*ClientFactory) NewCommunityGalleriesClient

func (c *ClientFactory) NewCommunityGalleriesClient() *CommunityGalleriesClient

NewCommunityGalleriesClient creates a new instance of CommunityGalleriesClient.

func (*ClientFactory) NewCommunityGalleryImageVersionsClient

func (c *ClientFactory) NewCommunityGalleryImageVersionsClient() *CommunityGalleryImageVersionsClient

NewCommunityGalleryImageVersionsClient creates a new instance of CommunityGalleryImageVersionsClient.

func (*ClientFactory) NewCommunityGalleryImagesClient

func (c *ClientFactory) NewCommunityGalleryImagesClient() *CommunityGalleryImagesClient

NewCommunityGalleryImagesClient creates a new instance of CommunityGalleryImagesClient.

func (*ClientFactory) NewDedicatedHostGroupsClient

func (c *ClientFactory) NewDedicatedHostGroupsClient() *DedicatedHostGroupsClient

NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient.

func (*ClientFactory) NewDedicatedHostsClient

func (c *ClientFactory) NewDedicatedHostsClient() *DedicatedHostsClient

NewDedicatedHostsClient creates a new instance of DedicatedHostsClient.

func (*ClientFactory) NewDiskAccessesClient

func (c *ClientFactory) NewDiskAccessesClient() *DiskAccessesClient

NewDiskAccessesClient creates a new instance of DiskAccessesClient.

func (*ClientFactory) NewDiskEncryptionSetsClient

func (c *ClientFactory) NewDiskEncryptionSetsClient() *DiskEncryptionSetsClient

NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient.

func (*ClientFactory) NewDiskRestorePointClient

func (c *ClientFactory) NewDiskRestorePointClient() *DiskRestorePointClient

NewDiskRestorePointClient creates a new instance of DiskRestorePointClient.

func (*ClientFactory) NewDisksClient

func (c *ClientFactory) NewDisksClient() *DisksClient

NewDisksClient creates a new instance of DisksClient.

func (*ClientFactory) NewGalleriesClient

func (c *ClientFactory) NewGalleriesClient() *GalleriesClient

NewGalleriesClient creates a new instance of GalleriesClient.

func (*ClientFactory) NewGalleryApplicationVersionsClient

func (c *ClientFactory) NewGalleryApplicationVersionsClient() *GalleryApplicationVersionsClient

NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient.

func (*ClientFactory) NewGalleryApplicationsClient

func (c *ClientFactory) NewGalleryApplicationsClient() *GalleryApplicationsClient

NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient.

func (*ClientFactory) NewGalleryImageVersionsClient

func (c *ClientFactory) NewGalleryImageVersionsClient() *GalleryImageVersionsClient

NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient.

func (*ClientFactory) NewGalleryImagesClient

func (c *ClientFactory) NewGalleryImagesClient() *GalleryImagesClient

NewGalleryImagesClient creates a new instance of GalleryImagesClient.

func (*ClientFactory) NewGalleryInVMAccessControlProfileVersionsClient

func (c *ClientFactory) NewGalleryInVMAccessControlProfileVersionsClient() *GalleryInVMAccessControlProfileVersionsClient

NewGalleryInVMAccessControlProfileVersionsClient creates a new instance of GalleryInVMAccessControlProfileVersionsClient.

func (*ClientFactory) NewGalleryInVMAccessControlProfilesClient

func (c *ClientFactory) NewGalleryInVMAccessControlProfilesClient() *GalleryInVMAccessControlProfilesClient

NewGalleryInVMAccessControlProfilesClient creates a new instance of GalleryInVMAccessControlProfilesClient.

func (*ClientFactory) NewGalleryScriptVersionsClient added in v7.3.0

func (c *ClientFactory) NewGalleryScriptVersionsClient() *GalleryScriptVersionsClient

NewGalleryScriptVersionsClient creates a new instance of GalleryScriptVersionsClient.

func (*ClientFactory) NewGalleryScriptsClient added in v7.3.0

func (c *ClientFactory) NewGalleryScriptsClient() *GalleryScriptsClient

NewGalleryScriptsClient creates a new instance of GalleryScriptsClient.

func (*ClientFactory) NewGallerySharingProfileClient

func (c *ClientFactory) NewGallerySharingProfileClient() *GallerySharingProfileClient

NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient.

func (*ClientFactory) NewImagesClient

func (c *ClientFactory) NewImagesClient() *ImagesClient

NewImagesClient creates a new instance of ImagesClient.

func (*ClientFactory) NewLogAnalyticsClient

func (c *ClientFactory) NewLogAnalyticsClient() *LogAnalyticsClient

NewLogAnalyticsClient creates a new instance of LogAnalyticsClient.

func (*ClientFactory) NewOperationsClient

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewProximityPlacementGroupsClient

func (c *ClientFactory) NewProximityPlacementGroupsClient() *ProximityPlacementGroupsClient

NewProximityPlacementGroupsClient creates a new instance of ProximityPlacementGroupsClient.

func (*ClientFactory) NewResourceSKUsClient

func (c *ClientFactory) NewResourceSKUsClient() *ResourceSKUsClient

NewResourceSKUsClient creates a new instance of ResourceSKUsClient.

func (*ClientFactory) NewRestorePointCollectionsClient

func (c *ClientFactory) NewRestorePointCollectionsClient() *RestorePointCollectionsClient

NewRestorePointCollectionsClient creates a new instance of RestorePointCollectionsClient.

func (*ClientFactory) NewRestorePointsClient

func (c *ClientFactory) NewRestorePointsClient() *RestorePointsClient

NewRestorePointsClient creates a new instance of RestorePointsClient.

func (*ClientFactory) NewSSHPublicKeysClient

func (c *ClientFactory) NewSSHPublicKeysClient() *SSHPublicKeysClient

NewSSHPublicKeysClient creates a new instance of SSHPublicKeysClient.

func (*ClientFactory) NewSharedGalleriesClient

func (c *ClientFactory) NewSharedGalleriesClient() *SharedGalleriesClient

NewSharedGalleriesClient creates a new instance of SharedGalleriesClient.

func (*ClientFactory) NewSharedGalleryImageVersionsClient

func (c *ClientFactory) NewSharedGalleryImageVersionsClient() *SharedGalleryImageVersionsClient

NewSharedGalleryImageVersionsClient creates a new instance of SharedGalleryImageVersionsClient.

func (*ClientFactory) NewSharedGalleryImagesClient

func (c *ClientFactory) NewSharedGalleryImagesClient() *SharedGalleryImagesClient

NewSharedGalleryImagesClient creates a new instance of SharedGalleryImagesClient.

func (*ClientFactory) NewSnapshotsClient

func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient

NewSnapshotsClient creates a new instance of SnapshotsClient.

func (*ClientFactory) NewSoftDeletedResourceClient

func (c *ClientFactory) NewSoftDeletedResourceClient() *SoftDeletedResourceClient

NewSoftDeletedResourceClient creates a new instance of SoftDeletedResourceClient.

func (*ClientFactory) NewUsageClient

func (c *ClientFactory) NewUsageClient() *UsageClient

NewUsageClient creates a new instance of UsageClient.

func (*ClientFactory) NewVirtualMachineExtensionImagesClient

func (c *ClientFactory) NewVirtualMachineExtensionImagesClient() *VirtualMachineExtensionImagesClient

NewVirtualMachineExtensionImagesClient creates a new instance of VirtualMachineExtensionImagesClient.

func (*ClientFactory) NewVirtualMachineExtensionsClient

func (c *ClientFactory) NewVirtualMachineExtensionsClient() *VirtualMachineExtensionsClient

NewVirtualMachineExtensionsClient creates a new instance of VirtualMachineExtensionsClient.

func (*ClientFactory) NewVirtualMachineImagesClient

func (c *ClientFactory) NewVirtualMachineImagesClient() *VirtualMachineImagesClient

NewVirtualMachineImagesClient creates a new instance of VirtualMachineImagesClient.

func (*ClientFactory) NewVirtualMachineImagesEdgeZoneClient

func (c *ClientFactory) NewVirtualMachineImagesEdgeZoneClient() *VirtualMachineImagesEdgeZoneClient

NewVirtualMachineImagesEdgeZoneClient creates a new instance of VirtualMachineImagesEdgeZoneClient.

func (*ClientFactory) NewVirtualMachineRunCommandsClient

func (c *ClientFactory) NewVirtualMachineRunCommandsClient() *VirtualMachineRunCommandsClient

NewVirtualMachineRunCommandsClient creates a new instance of VirtualMachineRunCommandsClient.

func (*ClientFactory) NewVirtualMachineScaleSetExtensionsClient

func (c *ClientFactory) NewVirtualMachineScaleSetExtensionsClient() *VirtualMachineScaleSetExtensionsClient

NewVirtualMachineScaleSetExtensionsClient creates a new instance of VirtualMachineScaleSetExtensionsClient.

func (*ClientFactory) NewVirtualMachineScaleSetRollingUpgradesClient

func (c *ClientFactory) NewVirtualMachineScaleSetRollingUpgradesClient() *VirtualMachineScaleSetRollingUpgradesClient

NewVirtualMachineScaleSetRollingUpgradesClient creates a new instance of VirtualMachineScaleSetRollingUpgradesClient.

func (*ClientFactory) NewVirtualMachineScaleSetVMExtensionsClient

func (c *ClientFactory) NewVirtualMachineScaleSetVMExtensionsClient() *VirtualMachineScaleSetVMExtensionsClient

NewVirtualMachineScaleSetVMExtensionsClient creates a new instance of VirtualMachineScaleSetVMExtensionsClient.

func (*ClientFactory) NewVirtualMachineScaleSetVMRunCommandsClient

func (c *ClientFactory) NewVirtualMachineScaleSetVMRunCommandsClient() *VirtualMachineScaleSetVMRunCommandsClient

NewVirtualMachineScaleSetVMRunCommandsClient creates a new instance of VirtualMachineScaleSetVMRunCommandsClient.

func (*ClientFactory) NewVirtualMachineScaleSetVMsClient

func (c *ClientFactory) NewVirtualMachineScaleSetVMsClient() *VirtualMachineScaleSetVMsClient

NewVirtualMachineScaleSetVMsClient creates a new instance of VirtualMachineScaleSetVMsClient.

func (*ClientFactory) NewVirtualMachineScaleSetsClient

func (c *ClientFactory) NewVirtualMachineScaleSetsClient() *VirtualMachineScaleSetsClient

NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient.

func (*ClientFactory) NewVirtualMachineSizesClient

func (c *ClientFactory) NewVirtualMachineSizesClient() *VirtualMachineSizesClient

NewVirtualMachineSizesClient creates a new instance of VirtualMachineSizesClient.

func (*ClientFactory) NewVirtualMachinesClient

func (c *ClientFactory) NewVirtualMachinesClient() *VirtualMachinesClient

NewVirtualMachinesClient creates a new instance of VirtualMachinesClient.

type CloudService

type CloudService struct {
	// REQUIRED; Resource location.
	Location *string

	// Cloud service properties
	Properties *CloudServiceProperties

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

	// List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned.
	// This field is optional.
	Zones []*string

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Metadata pertaining to creation and last modification of the resource.
	SystemData *SystemData

	// READ-ONLY; Resource type.
	Type *string
}

CloudService - Describes the cloud service.

func (CloudService) MarshalJSON

func (c CloudService) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudService.

func (*CloudService) UnmarshalJSON

func (c *CloudService) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudService.

type CloudServiceExtensionProfile

type CloudServiceExtensionProfile struct {
	// List of extensions for the cloud service.
	Extensions []*Extension
}

CloudServiceExtensionProfile - Describes a cloud service extension profile.

func (CloudServiceExtensionProfile) MarshalJSON

func (c CloudServiceExtensionProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceExtensionProfile.

func (*CloudServiceExtensionProfile) UnmarshalJSON

func (c *CloudServiceExtensionProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceExtensionProfile.

type CloudServiceExtensionProperties

type CloudServiceExtensionProperties struct {
	// Explicitly specify whether platform can automatically upgrade typeHandlerVersion to higher minor versions when they become
	// available.
	AutoUpgradeMinorVersion *bool

	// Tag to force apply the provided public and protected settings. Changing the tag value allows for re-running the extension
	// without changing any of the public or protected settings. If forceUpdateTag is
	// not changed, updates to public or protected settings would still be applied by the handler. If neither forceUpdateTag nor
	// any of public or protected settings change, extension would flow to the role
	// instance with the same sequence-number, and it is up to handler implementation whether to re-run it or not
	ForceUpdateTag *string

	// Protected settings for the extension which are encrypted before sent to the role instance.
	ProtectedSettings any

	// Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance.
	ProtectedSettingsFromKeyVault *CloudServiceVaultAndSecretReference

	// The name of the extension handler publisher.
	Publisher *string

	// Optional list of roles to apply this extension. If property is not specified or '*' is specified, extension is applied
	// to all roles in the cloud service.
	RolesAppliedTo []*string

	// Public settings for the extension. For JSON extensions, this is the JSON settings for the extension. For XML Extension
	// (like RDP), this is the XML setting for the extension.
	Settings any

	// Specifies the type of the extension.
	Type *string

	// Specifies the version of the extension. Specifies the version of the extension. If this element is not specified or an
	// asterisk (*) is used as the value, the latest version of the extension is used.
	// If the value is specified with a major version number and an asterisk as the minor version number (X.), the latest minor
	// version of the specified major version is selected. If a major version number
	// and a minor version number are specified (X.Y), the specific extension version is selected. If a version is specified,
	// an auto-upgrade is performed on the role instance.
	TypeHandlerVersion *string

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *string
}

CloudServiceExtensionProperties - Extension Properties.

func (CloudServiceExtensionProperties) MarshalJSON

func (c CloudServiceExtensionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceExtensionProperties.

func (*CloudServiceExtensionProperties) UnmarshalJSON

func (c *CloudServiceExtensionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceExtensionProperties.

type CloudServiceInstanceView

type CloudServiceInstanceView struct {
	// Instance view statuses.
	RoleInstance *InstanceViewStatusesSummary

	// READ-ONLY; Specifies a list of unique identifiers generated internally for the cloud service.
	// NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details.
	PrivateIDs []*string

	// READ-ONLY; The version of the SDK that was used to generate the package for the cloud service.
	SdkVersion *string

	// READ-ONLY
	Statuses []*ResourceInstanceViewStatus
}

CloudServiceInstanceView - InstanceView of CloudService as a whole

func (CloudServiceInstanceView) MarshalJSON

func (c CloudServiceInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceInstanceView.

func (*CloudServiceInstanceView) UnmarshalJSON

func (c *CloudServiceInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceInstanceView.

type CloudServiceListResult

type CloudServiceListResult struct {
	// REQUIRED; The list of resources.
	Value []*CloudService

	// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null
	// to fetch all the resources.
	NextLink *string
}

CloudServiceListResult - The list operation result.

func (CloudServiceListResult) MarshalJSON

func (c CloudServiceListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceListResult.

func (*CloudServiceListResult) UnmarshalJSON

func (c *CloudServiceListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceListResult.

type CloudServiceNetworkProfile

type CloudServiceNetworkProfile struct {
	// List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a
	// Public Load Balancer and an Internal Load Balancer.
	LoadBalancerConfigurations []*LoadBalancerConfiguration

	// Slot type for the cloud service. Possible values are
	// Production
	// Staging
	// If not specified, the default value is Production.
	SlotType *CloudServiceSlotType

	// The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap.
	// This property cannot be updated once it is set. The swappable cloud service
	// referred by this id must be present otherwise an error will be thrown.
	SwappableCloudService *SubResource
}

CloudServiceNetworkProfile - Network Profile for the cloud service.

func (CloudServiceNetworkProfile) MarshalJSON

func (c CloudServiceNetworkProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceNetworkProfile.

func (*CloudServiceNetworkProfile) UnmarshalJSON

func (c *CloudServiceNetworkProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceNetworkProfile.

type CloudServiceOperatingSystemsClient

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

CloudServiceOperatingSystemsClient contains the methods for the CloudServiceOperatingSystems group. Don't use this type directly, use NewCloudServiceOperatingSystemsClient() instead.

func NewCloudServiceOperatingSystemsClient

func NewCloudServiceOperatingSystemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceOperatingSystemsClient, error)

NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CloudServiceOperatingSystemsClient) GetOSFamily

GetOSFamily - Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • location - Name of the location that the OS family pertains to.
  • osFamilyName - Name of the OS family.
  • options - CloudServiceOperatingSystemsClientGetOSFamilyOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSFamily method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamily_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSFamily(ctx, "westus2", "3", 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.OSFamily = armcompute.OSFamily{
	// 	Name: to.Ptr("3"),
	// 	Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"),
	// 	Location: to.Ptr("westus2"),
	// 	Properties: &armcompute.OSFamilyProperties{
	// 		Name: to.Ptr("3"),
	// 		Label: to.Ptr("Windows Server 2012"),
	// 		Versions: []*armcompute.OSVersionPropertiesBase{
	// 			{
	// 				IsActive: to.Ptr(true),
	// 				IsDefault: to.Ptr(true),
	// 				Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"),
	// 				Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
	// 		}},
	// 	},
	// }
}

func (*CloudServiceOperatingSystemsClient) GetOSVersion

GetOSVersion - Gets properties of a guest operating system version that can be specified in the XML service configuration (.cscfg) for a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • location - Name of the location that the OS version pertains to.
  • osVersionName - Name of the OS version.
  • options - CloudServiceOperatingSystemsClientGetOSVersionOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSVersion method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", 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.OSVersion = armcompute.OSVersion{
	// 	Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
	// 	Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"),
	// 	Location: to.Ptr("westus2"),
	// 	Properties: &armcompute.OSVersionProperties{
	// 		Family: to.Ptr("3"),
	// 		FamilyLabel: to.Ptr("Windows Server 2012"),
	// 		IsActive: to.Ptr(true),
	// 		IsDefault: to.Ptr(true),
	// 		Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"),
	// 		Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
	// 	},
	// }
}

func (*CloudServiceOperatingSystemsClient) NewListOSFamiliesPager

NewListOSFamiliesPager - Gets a list of all guest operating system families available to be specified in the XML service configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this till nextLink is null to fetch all the OS Families.

Generated from API version 2024-11-04

  • location - Name of the location that the OS families pertain to.
  • options - CloudServiceOperatingSystemsClientListOSFamiliesOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSFamiliesPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamilies_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSFamiliesPager("westus2", 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.OSFamilyListResult = armcompute.OSFamilyListResult{
		// 	Value: []*armcompute.OSFamily{
		// 		{
		// 			Name: to.Ptr("3"),
		// 			Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"),
		// 			Location: to.Ptr("westus2"),
		// 			Properties: &armcompute.OSFamilyProperties{
		// 				Name: to.Ptr("3"),
		// 				Label: to.Ptr("Windows Server 2012"),
		// 				Versions: []*armcompute.OSVersionPropertiesBase{
		// 					{
		// 						IsActive: to.Ptr(true),
		// 						IsDefault: to.Ptr(true),
		// 						Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"),
		// 						Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
		// 				}},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("4"),
		// 			Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/4"),
		// 			Location: to.Ptr("westus2"),
		// 			Properties: &armcompute.OSFamilyProperties{
		// 				Name: to.Ptr("4"),
		// 				Label: to.Ptr("Windows Server 2012 R2"),
		// 				Versions: []*armcompute.OSVersionPropertiesBase{
		// 					{
		// 						IsActive: to.Ptr(true),
		// 						IsDefault: to.Ptr(true),
		// 						Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"),
		// 						Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"),
		// 				}},
		// 			},
		// 	}},
		// }
	}
}

func (*CloudServiceOperatingSystemsClient) NewListOSVersionsPager

NewListOSVersionsPager - Gets a list of all guest operating system versions available to be specified in the XML service configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this till nextLink is null to fetch all the OS versions.

Generated from API version 2024-11-04

  • location - Name of the location that the OS versions pertain to.
  • options - CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSVersionsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSVersionsPager("westus2", 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.OSVersionListResult = armcompute.OSVersionListResult{
		// 	Value: []*armcompute.OSVersion{
		// 		{
		// 			Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
		// 			Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"),
		// 			Location: to.Ptr("westus2"),
		// 			Properties: &armcompute.OSVersionProperties{
		// 				Family: to.Ptr("3"),
		// 				FamilyLabel: to.Ptr("Windows Server 2012"),
		// 				IsActive: to.Ptr(true),
		// 				IsDefault: to.Ptr(true),
		// 				Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"),
		// 				Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("WA-GUEST-OS-4.83_202010-02"),
		// 			Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-4.83_202010-02"),
		// 			Location: to.Ptr("westus2"),
		// 			Properties: &armcompute.OSVersionProperties{
		// 				Family: to.Ptr("4"),
		// 				FamilyLabel: to.Ptr("Windows Server 2012 R2"),
		// 				IsActive: to.Ptr(true),
		// 				IsDefault: to.Ptr(true),
		// 				Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"),
		// 				Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"),
		// 			},
		// 	}},
		// }
	}
}

type CloudServiceOperatingSystemsClientGetOSFamilyOptions

type CloudServiceOperatingSystemsClientGetOSFamilyOptions struct {
}

CloudServiceOperatingSystemsClientGetOSFamilyOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSFamily method.

type CloudServiceOperatingSystemsClientGetOSFamilyResponse

type CloudServiceOperatingSystemsClientGetOSFamilyResponse struct {
	// Describes a cloud service OS family.
	OSFamily
}

CloudServiceOperatingSystemsClientGetOSFamilyResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSFamily.

type CloudServiceOperatingSystemsClientGetOSVersionOptions

type CloudServiceOperatingSystemsClientGetOSVersionOptions struct {
}

CloudServiceOperatingSystemsClientGetOSVersionOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSVersion method.

type CloudServiceOperatingSystemsClientGetOSVersionResponse

type CloudServiceOperatingSystemsClientGetOSVersionResponse struct {
	// Describes a cloud service OS version.
	OSVersion
}

CloudServiceOperatingSystemsClientGetOSVersionResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSVersion.

type CloudServiceOperatingSystemsClientListOSFamiliesOptions

type CloudServiceOperatingSystemsClientListOSFamiliesOptions struct {
}

CloudServiceOperatingSystemsClientListOSFamiliesOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSFamiliesPager method.

type CloudServiceOperatingSystemsClientListOSFamiliesResponse

type CloudServiceOperatingSystemsClientListOSFamiliesResponse struct {
	// The list operation result.
	OSFamilyListResult
}

CloudServiceOperatingSystemsClientListOSFamiliesResponse contains the response from method CloudServiceOperatingSystemsClient.NewListOSFamiliesPager.

type CloudServiceOperatingSystemsClientListOSVersionsOptions

type CloudServiceOperatingSystemsClientListOSVersionsOptions struct {
}

CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSVersionsPager method.

type CloudServiceOperatingSystemsClientListOSVersionsResponse

type CloudServiceOperatingSystemsClientListOSVersionsResponse struct {
	// The list operation result.
	OSVersionListResult
}

CloudServiceOperatingSystemsClientListOSVersionsResponse contains the response from method CloudServiceOperatingSystemsClient.NewListOSVersionsPager.

type CloudServiceOsProfile

type CloudServiceOsProfile struct {
	// Specifies set of certificates that should be installed onto the role instances.
	Secrets []*CloudServiceVaultSecretGroup
}

CloudServiceOsProfile - Describes the OS profile for the cloud service.

func (CloudServiceOsProfile) MarshalJSON

func (c CloudServiceOsProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceOsProfile.

func (*CloudServiceOsProfile) UnmarshalJSON

func (c *CloudServiceOsProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceOsProfile.

type CloudServiceProperties

type CloudServiceProperties struct {
	// (Optional) Indicates whether the role sku properties (roleProfile.roles.sku) specified in the model/template should override
	// the role instance count and vm size specified in the .cscfg and .csdef
	// respectively. The default value is false.
	AllowModelOverride *bool

	// Specifies the XML service configuration (.cscfg) for the cloud service.
	Configuration *string

	// Specifies a URL that refers to the location of the service configuration in the Blob service. The service package URL can
	// be Shared Access Signature (SAS) URI from any storage account. This is a
	// write-only property and is not returned in GET calls.
	ConfigurationURL *string

	// Describes a cloud service extension profile.
	ExtensionProfile *CloudServiceExtensionProfile

	// Network Profile for the cloud service.
	NetworkProfile *CloudServiceNetworkProfile

	// Describes the OS profile for the cloud service.
	OSProfile *CloudServiceOsProfile

	// Specifies a URL that refers to the location of the service package in the Blob service. The service package URL can be
	// Shared Access Signature (SAS) URI from any storage account. This is a write-only
	// property and is not returned in GET calls.
	PackageURL *string

	// Describes the role profile for the cloud service.
	RoleProfile *CloudServiceRoleProfile

	// (Optional) Indicates whether to start the cloud service immediately after it is created. The default value is true. If
	// false, the service model is still deployed, but the code is not run immediately.
	// Instead, the service is PoweredOff until you call Start, at which time the service will be started. A deployed service
	// still incurs charges, even if it is poweredoff.
	StartCloudService *bool

	// Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates
	// can be initiated manually in each update domain or initiated automatically in
	// all update domains. Possible Values are
	// Auto
	// Manual
	// Simultaneous
	// If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If
	// set to Auto, the update is automatically applied to each update domain in
	// sequence.
	UpgradeMode *CloudServiceUpgradeMode

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *string

	// READ-ONLY; The unique identifier for the cloud service.
	UniqueID *string
}

CloudServiceProperties - Cloud service properties

func (CloudServiceProperties) MarshalJSON

func (c CloudServiceProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceProperties.

func (*CloudServiceProperties) UnmarshalJSON

func (c *CloudServiceProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceProperties.

type CloudServiceRole

type CloudServiceRole struct {
	// The cloud service role properties.
	Properties *CloudServiceRoleProperties

	// Describes the cloud service role sku.
	SKU *CloudServiceRoleSKU

	// READ-ONLY; Resource id
	ID *string

	// READ-ONLY; Resource location
	Location *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

CloudServiceRole - Describes a role of the cloud service.

func (CloudServiceRole) MarshalJSON

func (c CloudServiceRole) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRole.

func (*CloudServiceRole) UnmarshalJSON

func (c *CloudServiceRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRole.

type CloudServiceRoleInstancesClient

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

CloudServiceRoleInstancesClient contains the methods for the CloudServiceRoleInstances group. Don't use this type directly, use NewCloudServiceRoleInstancesClient() instead.

func NewCloudServiceRoleInstancesClient

func NewCloudServiceRoleInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceRoleInstancesClient, error)

NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CloudServiceRoleInstancesClient) BeginDelete

BeginDelete - Deletes a role instance from a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientBeginDeleteOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginDelete(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServiceRoleInstancesClient) BeginRebuild

BeginRebuild - The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instance. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientBeginRebuildOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRebuild method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginRebuild(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServiceRoleInstancesClient) BeginReimage

BeginReimage - The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientBeginReimageOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginReimage method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginReimage(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServiceRoleInstancesClient) BeginRestart

BeginRestart - The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientBeginRestartOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRestart method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginRestart(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServiceRoleInstancesClient) Get

func (client *CloudServiceRoleInstancesClient) Get(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetOptions) (CloudServiceRoleInstancesClientGetResponse, error)

Get - Gets a role instance from a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientGetOptions contains the optional parameters for the CloudServiceRoleInstancesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServiceRoleInstancesClient().Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: 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.RoleInstance = armcompute.RoleInstance{
	// 	Name: to.Ptr("{roleInstance-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}"),
	// 	Location: to.Ptr("eastus2euap"),
	// 	Properties: &armcompute.RoleInstanceProperties{
	// 		NetworkProfile: &armcompute.RoleInstanceNetworkProfile{
	// 			NetworkInterfaces: []*armcompute.SubResource{
	// 				{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}/networkInterfaces/nic1"),
	// 			}},
	// 		},
	// 	},
	// 	SKU: &armcompute.InstanceSKU{
	// 		Name: to.Ptr("Standard_D1_v2"),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}

func (*CloudServiceRoleInstancesClient) GetInstanceView

GetInstanceView - Retrieves information about the run-time state of a role instance in a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientGetInstanceViewOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetInstanceView method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_InstanceView.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServiceRoleInstancesClient().GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", 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.RoleInstanceView = armcompute.RoleInstanceView{
	// 	PlatformFaultDomain: to.Ptr[int32](0),
	// 	PlatformUpdateDomain: to.Ptr[int32](0),
	// 	PrivateID: to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e"),
	// 	Statuses: []*armcompute.ResourceInstanceViewStatus{
	// 		{
	// 			Code: to.Ptr("RoleState/RoleStateStarted"),
	// 			DisplayStatus: to.Ptr("RoleStateStarted"),
	// 			Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			Message: to.Ptr(""),
	// 	}},
	// }
}

func (*CloudServiceRoleInstancesClient) GetRemoteDesktopFile

GetRemoteDesktopFile - Gets a remote desktop file for a role instance in a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleInstanceName - Name of the role instance.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetRemoteDesktopFile method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewCloudServiceRoleInstancesClient().GetRemoteDesktopFile(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "rgcloudService", "aaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

func (*CloudServiceRoleInstancesClient) NewListPager

NewListPager - Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRoleInstancesClientListOptions contains the optional parameters for the CloudServiceRoleInstancesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRolesInstance_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServiceRoleInstancesClient().NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: 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.RoleInstanceListResult = armcompute.RoleInstanceListResult{
		// 	Value: []*armcompute.RoleInstance{
		// 		{
		// 			Name: to.Ptr("ContosoFrontend_IN_0"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.RoleInstanceProperties{
		// 				NetworkProfile: &armcompute.RoleInstanceNetworkProfile{
		// 					NetworkInterfaces: []*armcompute.SubResource{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0/networkInterfaces/nic1"),
		// 					}},
		// 				},
		// 			},
		// 			SKU: &armcompute.InstanceSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("ContosoFrontend_IN_1"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.RoleInstanceProperties{
		// 				NetworkProfile: &armcompute.RoleInstanceNetworkProfile{
		// 					NetworkInterfaces: []*armcompute.SubResource{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1/networkInterfaces/nic1"),
		// 					}},
		// 				},
		// 			},
		// 			SKU: &armcompute.InstanceSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("ContosoBackend_IN_0"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.RoleInstanceProperties{
		// 				NetworkProfile: &armcompute.RoleInstanceNetworkProfile{
		// 					NetworkInterfaces: []*armcompute.SubResource{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0/networkInterfaces/nic1"),
		// 					}},
		// 				},
		// 			},
		// 			SKU: &armcompute.InstanceSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("ContosoBackend_IN_1"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.RoleInstanceProperties{
		// 				NetworkProfile: &armcompute.RoleInstanceNetworkProfile{
		// 					NetworkInterfaces: []*armcompute.SubResource{
		// 						{
		// 							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1/networkInterfaces/nic1"),
		// 					}},
		// 				},
		// 			},
		// 			SKU: &armcompute.InstanceSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 	}},
		// }
	}
}

type CloudServiceRoleInstancesClientBeginDeleteOptions

type CloudServiceRoleInstancesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServiceRoleInstancesClientBeginDeleteOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginDelete method.

type CloudServiceRoleInstancesClientBeginRebuildOptions

type CloudServiceRoleInstancesClientBeginRebuildOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServiceRoleInstancesClientBeginRebuildOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRebuild method.

type CloudServiceRoleInstancesClientBeginReimageOptions

type CloudServiceRoleInstancesClientBeginReimageOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServiceRoleInstancesClientBeginReimageOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginReimage method.

type CloudServiceRoleInstancesClientBeginRestartOptions

type CloudServiceRoleInstancesClientBeginRestartOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServiceRoleInstancesClientBeginRestartOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRestart method.

type CloudServiceRoleInstancesClientDeleteResponse

type CloudServiceRoleInstancesClientDeleteResponse struct {
}

CloudServiceRoleInstancesClientDeleteResponse contains the response from method CloudServiceRoleInstancesClient.BeginDelete.

type CloudServiceRoleInstancesClientGetInstanceViewOptions

type CloudServiceRoleInstancesClientGetInstanceViewOptions struct {
}

CloudServiceRoleInstancesClientGetInstanceViewOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetInstanceView method.

type CloudServiceRoleInstancesClientGetInstanceViewResponse

type CloudServiceRoleInstancesClientGetInstanceViewResponse struct {
	// The instance view of the role instance.
	RoleInstanceView
}

CloudServiceRoleInstancesClientGetInstanceViewResponse contains the response from method CloudServiceRoleInstancesClient.GetInstanceView.

type CloudServiceRoleInstancesClientGetOptions

type CloudServiceRoleInstancesClientGetOptions struct {
	// The expand expression to apply to the operation. 'UserData' is not supported for cloud services.
	Expand *InstanceViewTypes
}

CloudServiceRoleInstancesClientGetOptions contains the optional parameters for the CloudServiceRoleInstancesClient.Get method.

type CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions

type CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions struct {
}

CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetRemoteDesktopFile method.

type CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse

type CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse struct {
	// Body contains the streaming response.
	Body io.ReadCloser
}

CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse contains the response from method CloudServiceRoleInstancesClient.GetRemoteDesktopFile.

type CloudServiceRoleInstancesClientGetResponse

type CloudServiceRoleInstancesClientGetResponse struct {
	// Describes the cloud service role instance.
	RoleInstance
}

CloudServiceRoleInstancesClientGetResponse contains the response from method CloudServiceRoleInstancesClient.Get.

type CloudServiceRoleInstancesClientListOptions

type CloudServiceRoleInstancesClientListOptions struct {
	// The expand expression to apply to the operation. 'UserData' is not supported for cloud services.
	Expand *InstanceViewTypes
}

CloudServiceRoleInstancesClientListOptions contains the optional parameters for the CloudServiceRoleInstancesClient.NewListPager method.

type CloudServiceRoleInstancesClientListResponse

type CloudServiceRoleInstancesClientListResponse struct {
	// The list operation result.
	RoleInstanceListResult
}

CloudServiceRoleInstancesClientListResponse contains the response from method CloudServiceRoleInstancesClient.NewListPager.

type CloudServiceRoleInstancesClientRebuildResponse

type CloudServiceRoleInstancesClientRebuildResponse struct {
}

CloudServiceRoleInstancesClientRebuildResponse contains the response from method CloudServiceRoleInstancesClient.BeginRebuild.

type CloudServiceRoleInstancesClientReimageResponse

type CloudServiceRoleInstancesClientReimageResponse struct {
}

CloudServiceRoleInstancesClientReimageResponse contains the response from method CloudServiceRoleInstancesClient.BeginReimage.

type CloudServiceRoleInstancesClientRestartResponse

type CloudServiceRoleInstancesClientRestartResponse struct {
}

CloudServiceRoleInstancesClientRestartResponse contains the response from method CloudServiceRoleInstancesClient.BeginRestart.

type CloudServiceRoleListResult

type CloudServiceRoleListResult struct {
	// REQUIRED; The list of resources.
	Value []*CloudServiceRole

	// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null
	// to fetch all the resources.
	NextLink *string
}

CloudServiceRoleListResult - The list operation result.

func (CloudServiceRoleListResult) MarshalJSON

func (c CloudServiceRoleListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleListResult.

func (*CloudServiceRoleListResult) UnmarshalJSON

func (c *CloudServiceRoleListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleListResult.

type CloudServiceRoleProfile

type CloudServiceRoleProfile struct {
	// List of roles for the cloud service.
	Roles []*CloudServiceRoleProfileProperties
}

CloudServiceRoleProfile - Describes the role profile for the cloud service.

func (CloudServiceRoleProfile) MarshalJSON

func (c CloudServiceRoleProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProfile.

func (*CloudServiceRoleProfile) UnmarshalJSON

func (c *CloudServiceRoleProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProfile.

type CloudServiceRoleProfileProperties

type CloudServiceRoleProfileProperties struct {
	// Resource name.
	Name *string

	// Describes the cloud service role sku.
	SKU *CloudServiceRoleSKU
}

CloudServiceRoleProfileProperties - Describes the role properties.

func (CloudServiceRoleProfileProperties) MarshalJSON

func (c CloudServiceRoleProfileProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProfileProperties.

func (*CloudServiceRoleProfileProperties) UnmarshalJSON

func (c *CloudServiceRoleProfileProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProfileProperties.

type CloudServiceRoleProperties

type CloudServiceRoleProperties struct {
	// READ-ONLY; Specifies the ID which uniquely identifies a cloud service role.
	UniqueID *string
}

CloudServiceRoleProperties - The cloud service role properties.

func (CloudServiceRoleProperties) MarshalJSON

func (c CloudServiceRoleProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProperties.

func (*CloudServiceRoleProperties) UnmarshalJSON

func (c *CloudServiceRoleProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProperties.

type CloudServiceRoleSKU

type CloudServiceRoleSKU struct {
	// Specifies the number of role instances in the cloud service.
	Capacity *int64

	// The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is currently on, you need to delete
	// and recreate the cloud service or move back to the old sku.
	Name *string

	// Specifies the tier of the cloud service. Possible Values are
	// Standard
	// Basic
	Tier *string
}

CloudServiceRoleSKU - Describes the cloud service role sku.

func (CloudServiceRoleSKU) MarshalJSON

func (c CloudServiceRoleSKU) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleSKU.

func (*CloudServiceRoleSKU) UnmarshalJSON

func (c *CloudServiceRoleSKU) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleSKU.

type CloudServiceRolesClient

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

CloudServiceRolesClient contains the methods for the CloudServiceRoles group. Don't use this type directly, use NewCloudServiceRolesClient() instead.

func NewCloudServiceRolesClient

func NewCloudServiceRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceRolesClient, error)

NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CloudServiceRolesClient) Get

func (client *CloudServiceRolesClient) Get(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientGetOptions) (CloudServiceRolesClientGetResponse, error)

Get - Gets a role from a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • roleName - Name of the role.
  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRolesClientGetOptions contains the optional parameters for the CloudServiceRolesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServiceRolesClient().Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", 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.CloudServiceRole = armcompute.CloudServiceRole{
	// 	Name: to.Ptr("{role-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices/roles"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/{role-name}"),
	// 	Location: to.Ptr("eastus2euap"),
	// 	Properties: &armcompute.CloudServiceRoleProperties{
	// 		UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:{role-name}"),
	// 	},
	// 	SKU: &armcompute.CloudServiceRoleSKU{
	// 		Name: to.Ptr("Standard_D1_v2"),
	// 		Capacity: to.Ptr[int64](2),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}

func (*CloudServiceRolesClient) NewListPager

func (client *CloudServiceRolesClient) NewListPager(resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientListOptions) *runtime.Pager[CloudServiceRolesClientListResponse]

NewListPager - Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. Do this till nextLink is null to fetch all the roles.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServiceRolesClientListOptions contains the optional parameters for the CloudServiceRolesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServiceRolesClient().NewListPager("ConstosoRG", "{cs-name}", 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.CloudServiceRoleListResult = armcompute.CloudServiceRoleListResult{
		// 	Value: []*armcompute.CloudServiceRole{
		// 		{
		// 			Name: to.Ptr("ContosoFrontend"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roles"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoFrontend"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.CloudServiceRoleProperties{
		// 				UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoFrontend"),
		// 			},
		// 			SKU: &armcompute.CloudServiceRoleSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Capacity: to.Ptr[int64](2),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("ContosoBackend"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices/roles"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoBackend"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.CloudServiceRoleProperties{
		// 				UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoBackend"),
		// 			},
		// 			SKU: &armcompute.CloudServiceRoleSKU{
		// 				Name: to.Ptr("Standard_D1_v2"),
		// 				Capacity: to.Ptr[int64](2),
		// 				Tier: to.Ptr("Standard"),
		// 			},
		// 	}},
		// }
	}
}

type CloudServiceRolesClientGetOptions

type CloudServiceRolesClientGetOptions struct {
}

CloudServiceRolesClientGetOptions contains the optional parameters for the CloudServiceRolesClient.Get method.

type CloudServiceRolesClientGetResponse

type CloudServiceRolesClientGetResponse struct {
	// Describes a role of the cloud service.
	CloudServiceRole
}

CloudServiceRolesClientGetResponse contains the response from method CloudServiceRolesClient.Get.

type CloudServiceRolesClientListOptions

type CloudServiceRolesClientListOptions struct {
}

CloudServiceRolesClientListOptions contains the optional parameters for the CloudServiceRolesClient.NewListPager method.

type CloudServiceRolesClientListResponse

type CloudServiceRolesClientListResponse struct {
	// The list operation result.
	CloudServiceRoleListResult
}

CloudServiceRolesClientListResponse contains the response from method CloudServiceRolesClient.NewListPager.

type CloudServiceSlotType

type CloudServiceSlotType string

CloudServiceSlotType - Slot type for the cloud service. Possible values are Production Staging If not specified, the default value is Production.

const (
	CloudServiceSlotTypeProduction CloudServiceSlotType = "Production"
	CloudServiceSlotTypeStaging    CloudServiceSlotType = "Staging"
)

func PossibleCloudServiceSlotTypeValues

func PossibleCloudServiceSlotTypeValues() []CloudServiceSlotType

PossibleCloudServiceSlotTypeValues returns the possible values for the CloudServiceSlotType const type.

type CloudServiceUpdate

type CloudServiceUpdate struct {
	// Resource tags
	Tags map[string]*string
}

func (CloudServiceUpdate) MarshalJSON

func (c CloudServiceUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceUpdate.

func (*CloudServiceUpdate) UnmarshalJSON

func (c *CloudServiceUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceUpdate.

type CloudServiceUpgradeMode

type CloudServiceUpgradeMode string

CloudServiceUpgradeMode - Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates can be initiated manually in each update domain or initiated automatically in all update domains. Possible Values are Auto Manual Simultaneous If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If set to Auto, the update is automatically applied to each update domain in sequence.

const (
	CloudServiceUpgradeModeAuto         CloudServiceUpgradeMode = "Auto"
	CloudServiceUpgradeModeManual       CloudServiceUpgradeMode = "Manual"
	CloudServiceUpgradeModeSimultaneous CloudServiceUpgradeMode = "Simultaneous"
)

func PossibleCloudServiceUpgradeModeValues

func PossibleCloudServiceUpgradeModeValues() []CloudServiceUpgradeMode

PossibleCloudServiceUpgradeModeValues returns the possible values for the CloudServiceUpgradeMode const type.

type CloudServiceVaultAndSecretReference

type CloudServiceVaultAndSecretReference struct {
	// Secret URL which contains the protected settings of the extension
	SecretURL *string

	// The ARM Resource ID of the Key Vault
	SourceVault *SubResource
}

CloudServiceVaultAndSecretReference - Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance.

func (CloudServiceVaultAndSecretReference) MarshalJSON

func (c CloudServiceVaultAndSecretReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultAndSecretReference.

func (*CloudServiceVaultAndSecretReference) UnmarshalJSON

func (c *CloudServiceVaultAndSecretReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultAndSecretReference.

type CloudServiceVaultCertificate

type CloudServiceVaultCertificate struct {
	// This is the URL of a certificate that has been uploaded to Key Vault as a secret.
	CertificateURL *string

	// Flag indicating if the certificate provided is a bootstrap certificate to be used by the Key Vault Extension to fetch the
	// remaining certificates.
	IsBootstrapCertificate *bool
}

CloudServiceVaultCertificate - Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance.

func (CloudServiceVaultCertificate) MarshalJSON

func (c CloudServiceVaultCertificate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultCertificate.

func (*CloudServiceVaultCertificate) UnmarshalJSON

func (c *CloudServiceVaultCertificate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultCertificate.

type CloudServiceVaultSecretGroup

type CloudServiceVaultSecretGroup struct {
	// The relative URL of the Key Vault containing all of the certificates in VaultCertificates.
	SourceVault *SubResource

	// The list of key vault references in SourceVault which contain certificates.
	VaultCertificates []*CloudServiceVaultCertificate
}

CloudServiceVaultSecretGroup - Describes a set of certificates which are all in the same Key Vault.

func (CloudServiceVaultSecretGroup) MarshalJSON

func (c CloudServiceVaultSecretGroup) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultSecretGroup.

func (*CloudServiceVaultSecretGroup) UnmarshalJSON

func (c *CloudServiceVaultSecretGroup) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultSecretGroup.

type CloudServicesClient

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

CloudServicesClient contains the methods for the CloudServices group. Don't use this type directly, use NewCloudServicesClient() instead.

func NewCloudServicesClient

func NewCloudServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServicesClient, error)

NewCloudServicesClient creates a new instance of CloudServicesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CloudServicesClient) BeginCreateOrUpdate

func (client *CloudServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudServicesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service creation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • parameters - The cloud service object.
  • options - CloudServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudServicesClient.BeginCreateOrUpdate method.
Example (CreateNewCloudServiceWithMultipleRoles)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
		Location: to.Ptr("westus"),
		Properties: &armcompute.CloudServiceProperties{
			Configuration: to.Ptr("{ServiceConfiguration}"),
			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
					{
						Name: to.Ptr("contosolb"),
						Properties: &armcompute.LoadBalancerConfigurationProperties{
							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
								{
									Name: to.Ptr("contosofe"),
									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
										PublicIPAddress: &armcompute.SubResource{
											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
										},
									},
								}},
						},
					}},
			},
			PackageURL: to.Ptr("{PackageUrl}"),
			RoleProfile: &armcompute.CloudServiceRoleProfile{
				Roles: []*armcompute.CloudServiceRoleProfileProperties{
					{
						Name: to.Ptr("ContosoFrontend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					},
					{
						Name: to.Ptr("ContosoBackend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					}},
			},
			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 			LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 				{
	// 					Name: to.Ptr("contosolb"),
	// 					Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 						FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 							{
	// 								Name: to.Ptr("contosofe"),
	// 								Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 									PublicIPAddress: &armcompute.SubResource{
	// 										ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 									},
	// 								},
	// 						}},
	// 					},
	// 			}},
	// 		},
	// 		OSProfile: &armcompute.CloudServiceOsProfile{
	// 			Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 			},
	// 		},
	// 		PackageURL: to.Ptr("{PackageUrl}"),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 			Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 				{
	// 					Name: to.Ptr("ContosoFrontend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 				},
	// 				{
	// 					Name: to.Ptr("ContosoBackend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 			}},
	// 		},
	// 		UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"),
	// 		UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 	},
	// 	SystemData: &armcompute.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 	},
	// }
}
Example (CreateNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole_WithZones.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
		Location: to.Ptr("westus"),
		Properties: &armcompute.CloudServiceProperties{
			Configuration: to.Ptr("{ServiceConfiguration}"),
			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
					{
						Name: to.Ptr("contosolb"),
						Properties: &armcompute.LoadBalancerConfigurationProperties{
							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
								{
									Name: to.Ptr("contosofe"),
									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
										PublicIPAddress: &armcompute.SubResource{
											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
										},
									},
								}},
						},
					}},
			},
			PackageURL: to.Ptr("{PackageUrl}"),
			RoleProfile: &armcompute.CloudServiceRoleProfile{
				Roles: []*armcompute.CloudServiceRoleProfileProperties{
					{
						Name: to.Ptr("ContosoFrontend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					},
					{
						Name: to.Ptr("ContosoBackend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					}},
			},
			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 			LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 				{
	// 					Name: to.Ptr("contosolb"),
	// 					Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 						FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 							{
	// 								Name: to.Ptr("contosofe"),
	// 								Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 									PublicIPAddress: &armcompute.SubResource{
	// 										ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 									},
	// 								},
	// 						}},
	// 					},
	// 			}},
	// 		},
	// 		OSProfile: &armcompute.CloudServiceOsProfile{
	// 			Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 			},
	// 		},
	// 		PackageURL: to.Ptr("{PackageUrl}"),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 			Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 				{
	// 					Name: to.Ptr("ContosoFrontend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 				},
	// 				{
	// 					Name: to.Ptr("ContosoBackend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 			}},
	// 		},
	// 		UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"),
	// 		UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 	},
	// 	SystemData: &armcompute.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (CreateNewCloudServiceWithSingleRole)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRole.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
		Location: to.Ptr("westus"),
		Properties: &armcompute.CloudServiceProperties{
			Configuration: to.Ptr("{ServiceConfiguration}"),
			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
					{
						Name: to.Ptr("myLoadBalancer"),
						Properties: &armcompute.LoadBalancerConfigurationProperties{
							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
								{
									Name: to.Ptr("myfe"),
									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
										PublicIPAddress: &armcompute.SubResource{
											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
										},
									},
								}},
						},
					}},
			},
			PackageURL: to.Ptr("{PackageUrl}"),
			RoleProfile: &armcompute.CloudServiceRoleProfile{
				Roles: []*armcompute.CloudServiceRoleProfileProperties{
					{
						Name: to.Ptr("ContosoFrontend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					}},
			},
			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 			LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 				{
	// 					Name: to.Ptr("myLoadBalancer"),
	// 					Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 						FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 							{
	// 								Name: to.Ptr("myfe"),
	// 								Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 									PublicIPAddress: &armcompute.SubResource{
	// 										ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
	// 									},
	// 								},
	// 						}},
	// 					},
	// 			}},
	// 		},
	// 		OSProfile: &armcompute.CloudServiceOsProfile{
	// 			Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 			},
	// 		},
	// 		PackageURL: to.Ptr("{PackageUrl}"),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 			Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 				{
	// 					Name: to.Ptr("ContosoFrontend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 			}},
	// 		},
	// 		UniqueID: to.Ptr("14d10b45-ced7-42ef-a406-50a3df2cea7d"),
	// 		UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 	},
	// 	SystemData: &armcompute.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 	},
	// }
}
Example (CreateNewCloudServiceWithSingleRoleAndCertificateFromKeyVault)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndCertificate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
		Location: to.Ptr("westus"),
		Properties: &armcompute.CloudServiceProperties{
			Configuration: to.Ptr("{ServiceConfiguration}"),
			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
					{
						Name: to.Ptr("contosolb"),
						Properties: &armcompute.LoadBalancerConfigurationProperties{
							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
								{
									Name: to.Ptr("contosofe"),
									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
										PublicIPAddress: &armcompute.SubResource{
											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
										},
									},
								}},
						},
					}},
			},
			OSProfile: &armcompute.CloudServiceOsProfile{
				Secrets: []*armcompute.CloudServiceVaultSecretGroup{
					{
						SourceVault: &armcompute.SubResource{
							ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
						},
						VaultCertificates: []*armcompute.CloudServiceVaultCertificate{
							{
								CertificateURL:         to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
								IsBootstrapCertificate: to.Ptr(true),
							}},
					}},
			},
			PackageURL: to.Ptr("{PackageUrl}"),
			RoleProfile: &armcompute.CloudServiceRoleProfile{
				Roles: []*armcompute.CloudServiceRoleProfileProperties{
					{
						Name: to.Ptr("ContosoFrontend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					}},
			},
			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 			LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 				{
	// 					Name: to.Ptr("contosolb"),
	// 					Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 						FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 							{
	// 								Name: to.Ptr("contosofe"),
	// 								Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 									PublicIPAddress: &armcompute.SubResource{
	// 										ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 									},
	// 								},
	// 						}},
	// 					},
	// 			}},
	// 		},
	// 		OSProfile: &armcompute.CloudServiceOsProfile{
	// 			Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 				{
	// 					SourceVault: &armcompute.SubResource{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
	// 					},
	// 					VaultCertificates: []*armcompute.CloudServiceVaultCertificate{
	// 						{
	// 							CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
	// 							IsBootstrapCertificate: to.Ptr(true),
	// 					}},
	// 			}},
	// 		},
	// 		PackageURL: to.Ptr("{PackageUrl}"),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 			Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 				{
	// 					Name: to.Ptr("ContosoFrontend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](1),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 			}},
	// 		},
	// 		UniqueID: to.Ptr("60b6cd59-600b-4e02-b717-521b07aa94bf"),
	// 		UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 	},
	// 	SystemData: &armcompute.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 	},
	// }
}
Example (CreateNewCloudServiceWithSingleRoleAndRdpExtension)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndRDP.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
		Location: to.Ptr("westus"),
		Properties: &armcompute.CloudServiceProperties{
			Configuration: to.Ptr("{ServiceConfiguration}"),
			ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
				Extensions: []*armcompute.Extension{
					{
						Name: to.Ptr("RDPExtension"),
						Properties: &armcompute.CloudServiceExtensionProperties{
							Type:                    to.Ptr("RDP"),
							AutoUpgradeMinorVersion: to.Ptr(false),
							ProtectedSettings:       "<PrivateConfig><Password>{password}</Password></PrivateConfig>",
							Publisher:               to.Ptr("Microsoft.Windows.Azure.Extensions"),
							Settings:                "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
							TypeHandlerVersion:      to.Ptr("1.2"),
						},
					}},
			},
			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
					{
						Name: to.Ptr("contosolb"),
						Properties: &armcompute.LoadBalancerConfigurationProperties{
							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
								{
									Name: to.Ptr("contosofe"),
									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
										PublicIPAddress: &armcompute.SubResource{
											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
										},
									},
								}},
						},
					}},
			},
			PackageURL: to.Ptr("{PackageUrl}"),
			RoleProfile: &armcompute.CloudServiceRoleProfile{
				Roles: []*armcompute.CloudServiceRoleProfileProperties{
					{
						Name: to.Ptr("ContosoFrontend"),
						SKU: &armcompute.CloudServiceRoleSKU{
							Name:     to.Ptr("Standard_D1_v2"),
							Capacity: to.Ptr[int64](1),
							Tier:     to.Ptr("Standard"),
						},
					}},
			},
			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
	// 			Extensions: []*armcompute.Extension{
	// 				{
	// 					Name: to.Ptr("RDPExtension"),
	// 					Properties: &armcompute.CloudServiceExtensionProperties{
	// 						Type: to.Ptr("RDP"),
	// 						AutoUpgradeMinorVersion: to.Ptr(false),
	// 						ProvisioningState: to.Ptr("Succeeded"),
	// 						Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
	// 						RolesAppliedTo: []*string{
	// 							to.Ptr("*")},
	// 							Settings: "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
	// 							TypeHandlerVersion: to.Ptr("1.2"),
	// 						},
	// 				}},
	// 			},
	// 			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 					{
	// 						Name: to.Ptr("contosolb"),
	// 						Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 								{
	// 									Name: to.Ptr("contosofe"),
	// 									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 										PublicIPAddress: &armcompute.SubResource{
	// 											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 										},
	// 									},
	// 							}},
	// 						},
	// 				}},
	// 			},
	// 			OSProfile: &armcompute.CloudServiceOsProfile{
	// 				Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 				},
	// 			},
	// 			PackageURL: to.Ptr("{PackageUrl}"),
	// 			ProvisioningState: to.Ptr("Succeeded"),
	// 			RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 				Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 					{
	// 						Name: to.Ptr("ContosoFrontend"),
	// 						SKU: &armcompute.CloudServiceRoleSKU{
	// 							Name: to.Ptr("Standard_D1_v2"),
	// 							Capacity: to.Ptr[int64](1),
	// 							Tier: to.Ptr("Standard"),
	// 						},
	// 				}},
	// 			},
	// 			UniqueID: to.Ptr("c948cccb-bbfa-4516-a250-c28abc4d0c15"),
	// 			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 		},
	// 		SystemData: &armcompute.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		},
	// 	}
}

func (*CloudServicesClient) BeginDelete

func (client *CloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteOptions) (*runtime.Poller[CloudServicesClientDeleteResponse], error)

BeginDelete - Deletes a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginDeleteOptions contains the optional parameters for the CloudServicesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginDelete(ctx, "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginDeleteInstances

func (client *CloudServicesClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteInstancesOptions) (*runtime.Poller[CloudServicesClientDeleteInstancesResponse], error)

BeginDeleteInstances - Deletes role instances in a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginDeleteInstancesOptions contains the optional parameters for the CloudServicesClient.BeginDeleteInstances method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginDeleteInstances(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginDeleteInstancesOptions{Parameters: &armcompute.RoleInstances{
		RoleInstances: []*string{
			to.Ptr("ContosoFrontend_IN_0"),
			to.Ptr("ContosoBackend_IN_1")},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginPowerOff

func (client *CloudServicesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginPowerOffOptions) (*runtime.Poller[CloudServicesClientPowerOffResponse], error)

BeginPowerOff - Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginPowerOffOptions contains the optional parameters for the CloudServicesClient.BeginPowerOff method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_PowerOff.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginPowerOff(ctx, "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginRebuild

func (client *CloudServicesClient) BeginRebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRebuildOptions) (*runtime.Poller[CloudServicesClientRebuildResponse], error)

BeginRebuild - Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginRebuildOptions contains the optional parameters for the CloudServicesClient.BeginRebuild method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginRebuild(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRebuildOptions{Parameters: &armcompute.RoleInstances{
		RoleInstances: []*string{
			to.Ptr("ContosoFrontend_IN_0"),
			to.Ptr("ContosoBackend_IN_1")},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginReimage

func (client *CloudServicesClient) BeginReimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginReimageOptions) (*runtime.Poller[CloudServicesClientReimageResponse], error)

BeginReimage - Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginReimageOptions contains the optional parameters for the CloudServicesClient.BeginReimage method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginReimage(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginReimageOptions{Parameters: &armcompute.RoleInstances{
		RoleInstances: []*string{
			to.Ptr("ContosoFrontend_IN_0"),
			to.Ptr("ContosoBackend_IN_1")},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginRestart

func (client *CloudServicesClient) BeginRestart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRestartOptions) (*runtime.Poller[CloudServicesClientRestartResponse], error)

BeginRestart - Restarts one or more role instances in a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginRestartOptions contains the optional parameters for the CloudServicesClient.BeginRestart method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginRestart(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRestartOptions{Parameters: &armcompute.RoleInstances{
		RoleInstances: []*string{
			to.Ptr("ContosoFrontend_IN_0"),
			to.Ptr("ContosoBackend_IN_1")},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginStart

func (client *CloudServicesClient) BeginStart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginStartOptions) (*runtime.Poller[CloudServicesClientStartResponse], error)

BeginStart - Starts the cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientBeginStartOptions contains the optional parameters for the CloudServicesClient.BeginStart method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Start.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginStart(ctx, "ConstosoRG", "{cs-name}", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesClient) BeginUpdate

func (client *CloudServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*runtime.Poller[CloudServicesClientUpdateResponse], error)

BeginUpdate - Update a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • parameters - The cloud service object.
  • options - CloudServicesClientBeginUpdateOptions contains the optional parameters for the CloudServicesClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Update_ToIncludeTags.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesClient().BeginUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudServiceUpdate{
		Tags: map[string]*string{
			"Documentation": to.Ptr("RestAPI"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("eastus2euap"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 			LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 				{
	// 					Name: to.Ptr("contosolb"),
	// 					Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 						FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 							{
	// 								Name: to.Ptr("contosofe"),
	// 								Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 									PublicIPAddress: &armcompute.SubResource{
	// 										ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 									},
	// 								},
	// 						}},
	// 					},
	// 			}},
	// 		},
	// 		OSProfile: &armcompute.CloudServiceOsProfile{
	// 			Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 			},
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 			Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 				{
	// 					Name: to.Ptr("ContosoFrontend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](2),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 				},
	// 				{
	// 					Name: to.Ptr("ContosoBackend"),
	// 					SKU: &armcompute.CloudServiceRoleSKU{
	// 						Name: to.Ptr("Standard_D1_v2"),
	// 						Capacity: to.Ptr[int64](2),
	// 						Tier: to.Ptr("Standard"),
	// 					},
	// 			}},
	// 		},
	// 		UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"),
	// 		UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 	},
	// 	Tags: map[string]*string{
	// 		"Documentation": to.Ptr("RestAPI"),
	// 	},
	// }
}

func (*CloudServicesClient) Get

func (client *CloudServicesClient) Get(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetOptions) (CloudServicesClientGetResponse, error)

Get - Display information about a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientGetOptions contains the optional parameters for the CloudServicesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_WithMultiRoleAndRDP.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServicesClient().Get(ctx, "ConstosoRG", "{cs-name}", 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.CloudService = armcompute.CloudService{
	// 	Name: to.Ptr("{cs-name}"),
	// 	Type: to.Ptr("Microsoft.Compute/cloudServices"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
	// 	Location: to.Ptr("eastus2euap"),
	// 	Properties: &armcompute.CloudServiceProperties{
	// 		Configuration: to.Ptr("{ServiceConfiguration}"),
	// 		ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
	// 			Extensions: []*armcompute.Extension{
	// 				{
	// 					Name: to.Ptr("RDPExtension"),
	// 					Properties: &armcompute.CloudServiceExtensionProperties{
	// 						Type: to.Ptr("RDP"),
	// 						AutoUpgradeMinorVersion: to.Ptr(false),
	// 						ProvisioningState: to.Ptr("Succeeded"),
	// 						Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
	// 						RolesAppliedTo: []*string{
	// 							to.Ptr("*")},
	// 							Settings: "<PublicConfig><UserName>userazure</UserName><Expiration>01/12/2022 16:29:02</Expiration></PublicConfig>",
	// 							TypeHandlerVersion: to.Ptr("1.2"),
	// 						},
	// 				}},
	// 			},
	// 			NetworkProfile: &armcompute.CloudServiceNetworkProfile{
	// 				LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
	// 					{
	// 						Name: to.Ptr("contosolb"),
	// 						Properties: &armcompute.LoadBalancerConfigurationProperties{
	// 							FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
	// 								{
	// 									Name: to.Ptr("contosofe"),
	// 									Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
	// 										PublicIPAddress: &armcompute.SubResource{
	// 											ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
	// 										},
	// 									},
	// 							}},
	// 						},
	// 				}},
	// 			},
	// 			OSProfile: &armcompute.CloudServiceOsProfile{
	// 				Secrets: []*armcompute.CloudServiceVaultSecretGroup{
	// 				},
	// 			},
	// 			ProvisioningState: to.Ptr("Succeeded"),
	// 			RoleProfile: &armcompute.CloudServiceRoleProfile{
	// 				Roles: []*armcompute.CloudServiceRoleProfileProperties{
	// 					{
	// 						Name: to.Ptr("ContosoFrontend"),
	// 						SKU: &armcompute.CloudServiceRoleSKU{
	// 							Name: to.Ptr("Standard_D1_v2"),
	// 							Capacity: to.Ptr[int64](2),
	// 							Tier: to.Ptr("Standard"),
	// 						},
	// 					},
	// 					{
	// 						Name: to.Ptr("ContosoBackend"),
	// 						SKU: &armcompute.CloudServiceRoleSKU{
	// 							Name: to.Ptr("Standard_D1_v2"),
	// 							Capacity: to.Ptr[int64](2),
	// 							Tier: to.Ptr("Standard"),
	// 						},
	// 				}},
	// 			},
	// 			UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"),
	// 			UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
	// 		},
	// 		SystemData: &armcompute.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
	// 		},
	// 	}
}

func (*CloudServicesClient) GetInstanceView

func (client *CloudServicesClient) GetInstanceView(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetInstanceViewOptions) (CloudServicesClientGetInstanceViewResponse, error)

GetInstanceView - Gets the status of a cloud service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesClientGetInstanceViewOptions contains the optional parameters for the CloudServicesClient.GetInstanceView method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_InstanceViewWithMultiRole.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServicesClient().GetInstanceView(ctx, "ConstosoRG", "{cs-name}", 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.CloudServiceInstanceView = armcompute.CloudServiceInstanceView{
	// 	PrivateIDs: []*string{
	// 		to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e")},
	// 		RoleInstance: &armcompute.InstanceViewStatusesSummary{
	// 			StatusesSummary: []*armcompute.StatusCodeCount{
	// 				{
	// 					Code: to.Ptr("ProvisioningState/succeeded"),
	// 					Count: to.Ptr[int32](4),
	// 				},
	// 				{
	// 					Code: to.Ptr("PowerState/started"),
	// 					Count: to.Ptr[int32](4),
	// 				},
	// 				{
	// 					Code: to.Ptr("RoleState/RoleStateStarted"),
	// 					Count: to.Ptr[int32](4),
	// 			}},
	// 		},
	// 		SdkVersion: to.Ptr("2.9.6496.3"),
	// 		Statuses: []*armcompute.ResourceInstanceViewStatus{
	// 			{
	// 				Code: to.Ptr("ProvisioningState/succeeded"),
	// 				DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 				Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T11:20:07.095Z"); return t}()),
	// 			},
	// 			{
	// 				Code: to.Ptr("PowerState/started"),
	// 				DisplayStatus: to.Ptr("Started"),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 				Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T11:20:07.095Z"); return t}()),
	// 			},
	// 			{
	// 				Code: to.Ptr("CurrentUpgradeDomain/-1"),
	// 				DisplayStatus: to.Ptr("Current Upgrade Domain of cloud service is -1."),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			},
	// 			{
	// 				Code: to.Ptr("MaxUpgradeDomain/1"),
	// 				DisplayStatus: to.Ptr("Max Upgrade Domain of cloud service is 1."),
	// 				Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 		}},
	// 	}
}

func (*CloudServicesClient) NewListAllPager

NewListAllPager - Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

Generated from API version 2024-11-04

  • options - CloudServicesClientListAllOptions contains the optional parameters for the CloudServicesClient.NewListAllPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_BySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServicesClient().NewListAllPager(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.CloudServiceListResult = armcompute.CloudServiceListResult{
		// 	Value: []*armcompute.CloudService{
		// 		{
		// 			Name: to.Ptr("{cs-name}"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.CloudServiceProperties{
		// 				Configuration: to.Ptr("{ServiceConfiguration}"),
		// 				ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
		// 					Extensions: []*armcompute.Extension{
		// 						{
		// 							Name: to.Ptr("RDPExtension"),
		// 							Properties: &armcompute.CloudServiceExtensionProperties{
		// 								Type: to.Ptr("RDP"),
		// 								AutoUpgradeMinorVersion: to.Ptr(false),
		// 								ProvisioningState: to.Ptr("Succeeded"),
		// 								Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
		// 								RolesAppliedTo: []*string{
		// 									to.Ptr("*")},
		// 									Settings: "<PublicConfig><UserName>userazure</UserName><Expiration>01/12/2022 16:29:02</Expiration></PublicConfig>",
		// 									TypeHandlerVersion: to.Ptr("1.2"),
		// 								},
		// 						}},
		// 					},
		// 					NetworkProfile: &armcompute.CloudServiceNetworkProfile{
		// 						LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
		// 							{
		// 								Name: to.Ptr("contosolb"),
		// 								Properties: &armcompute.LoadBalancerConfigurationProperties{
		// 									FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
		// 										{
		// 											Name: to.Ptr("contosofe"),
		// 											Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
		// 												PublicIPAddress: &armcompute.SubResource{
		// 													ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
		// 												},
		// 											},
		// 									}},
		// 								},
		// 						}},
		// 					},
		// 					OSProfile: &armcompute.CloudServiceOsProfile{
		// 						Secrets: []*armcompute.CloudServiceVaultSecretGroup{
		// 						},
		// 					},
		// 					ProvisioningState: to.Ptr("Succeeded"),
		// 					RoleProfile: &armcompute.CloudServiceRoleProfile{
		// 						Roles: []*armcompute.CloudServiceRoleProfileProperties{
		// 							{
		// 								Name: to.Ptr("ContosoFrontend"),
		// 								SKU: &armcompute.CloudServiceRoleSKU{
		// 									Name: to.Ptr("Standard_D1_v2"),
		// 									Capacity: to.Ptr[int64](2),
		// 									Tier: to.Ptr("Standard"),
		// 								},
		// 							},
		// 							{
		// 								Name: to.Ptr("ContosoBackend"),
		// 								SKU: &armcompute.CloudServiceRoleSKU{
		// 									Name: to.Ptr("Standard_D1_v2"),
		// 									Capacity: to.Ptr[int64](2),
		// 									Tier: to.Ptr("Standard"),
		// 								},
		// 						}},
		// 					},
		// 					UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"),
		// 					UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		// 				},
		// 		}},
		// 	}
	}
}

func (*CloudServicesClient) NewListPager

func (client *CloudServicesClient) NewListPager(resourceGroupName string, options *CloudServicesClientListOptions) *runtime.Pager[CloudServicesClientListResponse]

NewListPager - Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • options - CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_ByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServicesClient().NewListPager("ConstosoRG", 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.CloudServiceListResult = armcompute.CloudServiceListResult{
		// 	Value: []*armcompute.CloudService{
		// 		{
		// 			Name: to.Ptr("{cs-name}"),
		// 			Type: to.Ptr("Microsoft.Compute/cloudServices"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
		// 			Location: to.Ptr("eastus2euap"),
		// 			Properties: &armcompute.CloudServiceProperties{
		// 				Configuration: to.Ptr("{ServiceConfiguration}"),
		// 				ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
		// 					Extensions: []*armcompute.Extension{
		// 						{
		// 							Name: to.Ptr("RDPExtension"),
		// 							Properties: &armcompute.CloudServiceExtensionProperties{
		// 								Type: to.Ptr("RDP"),
		// 								AutoUpgradeMinorVersion: to.Ptr(false),
		// 								ProvisioningState: to.Ptr("Succeeded"),
		// 								Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
		// 								RolesAppliedTo: []*string{
		// 									to.Ptr("*")},
		// 									Settings: "<PublicConfig><UserName>userazure</UserName><Expiration>01/12/2022 16:29:02</Expiration></PublicConfig>",
		// 									TypeHandlerVersion: to.Ptr("1.2"),
		// 								},
		// 						}},
		// 					},
		// 					NetworkProfile: &armcompute.CloudServiceNetworkProfile{
		// 						LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
		// 							{
		// 								Name: to.Ptr("contosolb"),
		// 								Properties: &armcompute.LoadBalancerConfigurationProperties{
		// 									FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
		// 										{
		// 											Name: to.Ptr("contosofe"),
		// 											Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
		// 												PublicIPAddress: &armcompute.SubResource{
		// 													ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
		// 												},
		// 											},
		// 									}},
		// 								},
		// 						}},
		// 					},
		// 					OSProfile: &armcompute.CloudServiceOsProfile{
		// 						Secrets: []*armcompute.CloudServiceVaultSecretGroup{
		// 						},
		// 					},
		// 					ProvisioningState: to.Ptr("Succeeded"),
		// 					RoleProfile: &armcompute.CloudServiceRoleProfile{
		// 						Roles: []*armcompute.CloudServiceRoleProfileProperties{
		// 							{
		// 								Name: to.Ptr("ContosoFrontend"),
		// 								SKU: &armcompute.CloudServiceRoleSKU{
		// 									Name: to.Ptr("Standard_D1_v2"),
		// 									Capacity: to.Ptr[int64](2),
		// 									Tier: to.Ptr("Standard"),
		// 								},
		// 							},
		// 							{
		// 								Name: to.Ptr("ContosoBackend"),
		// 								SKU: &armcompute.CloudServiceRoleSKU{
		// 									Name: to.Ptr("Standard_D1_v2"),
		// 									Capacity: to.Ptr[int64](2),
		// 									Tier: to.Ptr("Standard"),
		// 								},
		// 						}},
		// 					},
		// 					UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"),
		// 					UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
		// 				},
		// 		}},
		// 	}
	}
}

type CloudServicesClientBeginCreateOrUpdateOptions

type CloudServicesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudServicesClient.BeginCreateOrUpdate method.

type CloudServicesClientBeginDeleteInstancesOptions

type CloudServicesClientBeginDeleteInstancesOptions struct {
	// List of cloud service role instance names.
	Parameters *RoleInstances

	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginDeleteInstancesOptions contains the optional parameters for the CloudServicesClient.BeginDeleteInstances method.

type CloudServicesClientBeginDeleteOptions

type CloudServicesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginDeleteOptions contains the optional parameters for the CloudServicesClient.BeginDelete method.

type CloudServicesClientBeginPowerOffOptions

type CloudServicesClientBeginPowerOffOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginPowerOffOptions contains the optional parameters for the CloudServicesClient.BeginPowerOff method.

type CloudServicesClientBeginRebuildOptions

type CloudServicesClientBeginRebuildOptions struct {
	// List of cloud service role instance names.
	Parameters *RoleInstances

	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginRebuildOptions contains the optional parameters for the CloudServicesClient.BeginRebuild method.

type CloudServicesClientBeginReimageOptions

type CloudServicesClientBeginReimageOptions struct {
	// List of cloud service role instance names.
	Parameters *RoleInstances

	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginReimageOptions contains the optional parameters for the CloudServicesClient.BeginReimage method.

type CloudServicesClientBeginRestartOptions

type CloudServicesClientBeginRestartOptions struct {
	// List of cloud service role instance names.
	Parameters *RoleInstances

	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginRestartOptions contains the optional parameters for the CloudServicesClient.BeginRestart method.

type CloudServicesClientBeginStartOptions

type CloudServicesClientBeginStartOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginStartOptions contains the optional parameters for the CloudServicesClient.BeginStart method.

type CloudServicesClientBeginUpdateOptions

type CloudServicesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesClientBeginUpdateOptions contains the optional parameters for the CloudServicesClient.BeginUpdate method.

type CloudServicesClientCreateOrUpdateResponse

type CloudServicesClientCreateOrUpdateResponse struct {
	// Describes the cloud service.
	CloudService
}

CloudServicesClientCreateOrUpdateResponse contains the response from method CloudServicesClient.BeginCreateOrUpdate.

type CloudServicesClientDeleteInstancesResponse

type CloudServicesClientDeleteInstancesResponse struct {
}

CloudServicesClientDeleteInstancesResponse contains the response from method CloudServicesClient.BeginDeleteInstances.

type CloudServicesClientDeleteResponse

type CloudServicesClientDeleteResponse struct {
}

CloudServicesClientDeleteResponse contains the response from method CloudServicesClient.BeginDelete.

type CloudServicesClientGetInstanceViewOptions

type CloudServicesClientGetInstanceViewOptions struct {
}

CloudServicesClientGetInstanceViewOptions contains the optional parameters for the CloudServicesClient.GetInstanceView method.

type CloudServicesClientGetInstanceViewResponse

type CloudServicesClientGetInstanceViewResponse struct {
	// InstanceView of CloudService as a whole
	CloudServiceInstanceView
}

CloudServicesClientGetInstanceViewResponse contains the response from method CloudServicesClient.GetInstanceView.

type CloudServicesClientGetOptions

type CloudServicesClientGetOptions struct {
}

CloudServicesClientGetOptions contains the optional parameters for the CloudServicesClient.Get method.

type CloudServicesClientGetResponse

type CloudServicesClientGetResponse struct {
	// Describes the cloud service.
	CloudService
}

CloudServicesClientGetResponse contains the response from method CloudServicesClient.Get.

type CloudServicesClientListAllOptions

type CloudServicesClientListAllOptions struct {
}

CloudServicesClientListAllOptions contains the optional parameters for the CloudServicesClient.NewListAllPager method.

type CloudServicesClientListAllResponse

type CloudServicesClientListAllResponse struct {
	// The list operation result.
	CloudServiceListResult
}

CloudServicesClientListAllResponse contains the response from method CloudServicesClient.NewListAllPager.

type CloudServicesClientListOptions

type CloudServicesClientListOptions struct {
}

CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.NewListPager method.

type CloudServicesClientListResponse

type CloudServicesClientListResponse struct {
	// The list operation result.
	CloudServiceListResult
}

CloudServicesClientListResponse contains the response from method CloudServicesClient.NewListPager.

type CloudServicesClientPowerOffResponse

type CloudServicesClientPowerOffResponse struct {
}

CloudServicesClientPowerOffResponse contains the response from method CloudServicesClient.BeginPowerOff.

type CloudServicesClientRebuildResponse

type CloudServicesClientRebuildResponse struct {
}

CloudServicesClientRebuildResponse contains the response from method CloudServicesClient.BeginRebuild.

type CloudServicesClientReimageResponse

type CloudServicesClientReimageResponse struct {
}

CloudServicesClientReimageResponse contains the response from method CloudServicesClient.BeginReimage.

type CloudServicesClientRestartResponse

type CloudServicesClientRestartResponse struct {
}

CloudServicesClientRestartResponse contains the response from method CloudServicesClient.BeginRestart.

type CloudServicesClientStartResponse

type CloudServicesClientStartResponse struct {
}

CloudServicesClientStartResponse contains the response from method CloudServicesClient.BeginStart.

type CloudServicesClientUpdateResponse

type CloudServicesClientUpdateResponse struct {
	// Describes the cloud service.
	CloudService
}

CloudServicesClientUpdateResponse contains the response from method CloudServicesClient.BeginUpdate.

type CloudServicesUpdateDomainClient

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

CloudServicesUpdateDomainClient contains the methods for the CloudServicesUpdateDomain group. Don't use this type directly, use NewCloudServicesUpdateDomainClient() instead.

func NewCloudServicesUpdateDomainClient

func NewCloudServicesUpdateDomainClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServicesUpdateDomainClient, error)

NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CloudServicesUpdateDomainClient) BeginWalkUpdateDomain

BeginWalkUpdateDomain - Updates the role instances in the specified update domain. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • updateDomain - Specifies an integer value that identifies the update domain. Update domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on.
  • parameters - The update domain object.
  • options - CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.BeginWalkUpdateDomain method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Update.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCloudServicesUpdateDomainClient().BeginWalkUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, armcompute.UpdateDomain{}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*CloudServicesUpdateDomainClient) GetUpdateDomain

GetUpdateDomain - Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page of update domains. Do this till nextLink is null to fetch all the update domains. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • updateDomain - Specifies an integer value that identifies the update domain. Update domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on.
  • options - CloudServicesUpdateDomainClientGetUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.GetUpdateDomain method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCloudServicesUpdateDomainClient().GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, 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.UpdateDomain = armcompute.UpdateDomain{
	// 	Name: to.Ptr("1"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"),
	// }
}

func (*CloudServicesUpdateDomainClient) NewListUpdateDomainsPager

NewListUpdateDomainsPager - Gets a list of all update domains in a cloud service.

Generated from API version 2024-11-04

  • resourceGroupName - Name of the resource group.
  • cloudServiceName - Name of the cloud service.
  • options - CloudServicesUpdateDomainClientListUpdateDomainsOptions contains the optional parameters for the CloudServicesUpdateDomainClient.NewListUpdateDomainsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCloudServicesUpdateDomainClient().NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", 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.UpdateDomainListResult = armcompute.UpdateDomainListResult{
		// 	Value: []*armcompute.UpdateDomain{
		// 		{
		// 			Name: to.Ptr("0"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/0"),
		// 		},
		// 		{
		// 			Name: to.Ptr("1"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"),
		// 	}},
		// }
	}
}

type CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions

type CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.BeginWalkUpdateDomain method.

type CloudServicesUpdateDomainClientGetUpdateDomainOptions

type CloudServicesUpdateDomainClientGetUpdateDomainOptions struct {
}

CloudServicesUpdateDomainClientGetUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.GetUpdateDomain method.

type CloudServicesUpdateDomainClientGetUpdateDomainResponse

type CloudServicesUpdateDomainClientGetUpdateDomainResponse struct {
	// Defines an update domain for the cloud service.
	UpdateDomain
}

CloudServicesUpdateDomainClientGetUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.GetUpdateDomain.

type CloudServicesUpdateDomainClientListUpdateDomainsOptions

type CloudServicesUpdateDomainClientListUpdateDomainsOptions struct {
}

CloudServicesUpdateDomainClientListUpdateDomainsOptions contains the optional parameters for the CloudServicesUpdateDomainClient.NewListUpdateDomainsPager method.

type CloudServicesUpdateDomainClientListUpdateDomainsResponse

type CloudServicesUpdateDomainClientListUpdateDomainsResponse struct {
	// The list operation result.
	UpdateDomainListResult
}

CloudServicesUpdateDomainClientListUpdateDomainsResponse contains the response from method CloudServicesUpdateDomainClient.NewListUpdateDomainsPager.

type CloudServicesUpdateDomainClientWalkUpdateDomainResponse

type CloudServicesUpdateDomainClientWalkUpdateDomainResponse struct {
}

CloudServicesUpdateDomainClientWalkUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.BeginWalkUpdateDomain.

type CommunityGalleriesClient

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

CommunityGalleriesClient contains the methods for the CommunityGalleries group. Don't use this type directly, use NewCommunityGalleriesClient() instead.

func NewCommunityGalleriesClient

func NewCommunityGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleriesClient, error)

NewCommunityGalleriesClient creates a new instance of CommunityGalleriesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CommunityGalleriesClient) Get

Get - Get a community gallery by gallery public name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • location - The name of Azure region.
  • publicGalleryName - The public name of the community gallery.
  • options - CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCommunityGalleriesClient().Get(ctx, "myLocation", "publicGalleryName", 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.CommunityGallery = armcompute.CommunityGallery{
	// 	Name: to.Ptr("publicGalleryName"),
	// 	Type: to.Ptr("Microsoft.Compute/locations/communityGallery"),
	// 	Identifier: &armcompute.CommunityGalleryIdentifier{
	// 		UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName"),
	// 	},
	// 	Location: to.Ptr("myLocation"),
	// 	Properties: &armcompute.CommunityGalleryProperties{
	// 		ArtifactTags: map[string]*string{
	// 			"ShareTag-CommunityGallery": to.Ptr("CommunityGallery"),
	// 		},
	// 		CommunityMetadata: &armcompute.CommunityGalleryMetadata{
	// 			Eula: to.Ptr("https://test-uri.com"),
	// 			PrivacyStatementURI: to.Ptr("https://test-uri.com"),
	// 			PublicNames: []*string{
	// 				to.Ptr("prefix-xxxxx")},
	// 				PublisherContact: to.Ptr("sameple@email.com"),
	// 				PublisherURI: to.Ptr("https://test-uri.com"),
	// 			},
	// 			Disclaimer: to.Ptr("https://test-uri.com"),
	// 		},
	// 	}
}

type CommunityGalleriesClientGetOptions

type CommunityGalleriesClientGetOptions struct {
}

CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method.

type CommunityGalleriesClientGetResponse

type CommunityGalleriesClientGetResponse struct {
	// Specifies information about the Community Gallery that you want to create or update.
	CommunityGallery
}

CommunityGalleriesClientGetResponse contains the response from method CommunityGalleriesClient.Get.

type CommunityGallery

type CommunityGallery struct {
	// The identifier information of community gallery.
	Identifier *CommunityGalleryIdentifier

	// Describes the properties of a community gallery.
	Properties *CommunityGalleryProperties

	// READ-ONLY; Resource location
	Location *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

CommunityGallery - Specifies information about the Community Gallery that you want to create or update.

func (CommunityGallery) MarshalJSON

func (c CommunityGallery) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGallery.

func (*CommunityGallery) UnmarshalJSON

func (c *CommunityGallery) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGallery.

type CommunityGalleryIdentifier

type CommunityGalleryIdentifier struct {
	// The unique id of this community gallery.
	UniqueID *string
}

CommunityGalleryIdentifier - The identifier information of community gallery.

func (CommunityGalleryIdentifier) MarshalJSON

func (c CommunityGalleryIdentifier) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryIdentifier.

func (*CommunityGalleryIdentifier) UnmarshalJSON

func (c *CommunityGalleryIdentifier) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryIdentifier.

type CommunityGalleryImage

type CommunityGalleryImage struct {
	// The identifier information of community gallery.
	Identifier *CommunityGalleryIdentifier

	// Describes the properties of a gallery image definition.
	Properties *CommunityGalleryImageProperties

	// READ-ONLY; Resource location
	Location *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

CommunityGalleryImage - Specifies information about the gallery image definition that you want to create or update.

func (CommunityGalleryImage) MarshalJSON

func (c CommunityGalleryImage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImage.

func (*CommunityGalleryImage) UnmarshalJSON

func (c *CommunityGalleryImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImage.

type CommunityGalleryImageIdentifier

type CommunityGalleryImageIdentifier struct {
	// The name of the gallery image definition offer.
	Offer *string

	// The name of the gallery image definition publisher.
	Publisher *string

	// The name of the gallery image definition SKU.
	SKU *string
}

CommunityGalleryImageIdentifier - This is the community gallery image definition identifier.

func (CommunityGalleryImageIdentifier) MarshalJSON

func (c CommunityGalleryImageIdentifier) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageIdentifier.

func (*CommunityGalleryImageIdentifier) UnmarshalJSON

func (c *CommunityGalleryImageIdentifier) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageIdentifier.

type CommunityGalleryImageList

type CommunityGalleryImageList struct {
	// REQUIRED; A list of community gallery images.
	Value []*CommunityGalleryImage

	// The link to the next page of items
	NextLink *string
}

CommunityGalleryImageList - The List Community Gallery Images operation response.

func (CommunityGalleryImageList) MarshalJSON

func (c CommunityGalleryImageList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageList.

func (*CommunityGalleryImageList) UnmarshalJSON

func (c *CommunityGalleryImageList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageList.

type CommunityGalleryImageProperties

type CommunityGalleryImageProperties struct {
	// REQUIRED; This is the community gallery image definition identifier.
	Identifier *CommunityGalleryImageIdentifier

	// REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized'
	// or 'Specialized'.
	OSState *OperatingSystemStateTypes

	// REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a
	// managed image. Possible values are: Windows, Linux.
	OSType *OperatingSystemTypes

	// The architecture of the image. Applicable to OS disks only.
	Architecture *Architecture

	// The artifact tags of a community gallery resource.
	ArtifactTags map[string]*string

	// Describes the disallowed disk types.
	Disallowed *Disallowed

	// The disclaimer for a community gallery resource.
	Disclaimer *string

	// The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// The end-user license agreement for the current community gallery image.
	Eula *string

	// A list of gallery image features.
	Features []*GalleryImageFeature

	// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
	HyperVGeneration *HyperVGeneration

	// Privacy statement URI for the current community gallery image.
	PrivacyStatementURI *string

	// Describes the gallery image definition purchase plan. This is used by marketplace images.
	PurchasePlan *ImagePurchasePlan

	// The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.
	Recommended *RecommendedMachineConfiguration
}

CommunityGalleryImageProperties - Describes the properties of a gallery image definition.

func (CommunityGalleryImageProperties) MarshalJSON

func (c CommunityGalleryImageProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageProperties.

func (*CommunityGalleryImageProperties) UnmarshalJSON

func (c *CommunityGalleryImageProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageProperties.

type CommunityGalleryImageVersion

type CommunityGalleryImageVersion struct {
	// The identifier information of community gallery.
	Identifier *CommunityGalleryIdentifier

	// Describes the properties of a gallery image version.
	Properties *CommunityGalleryImageVersionProperties

	// READ-ONLY; Resource location
	Location *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

CommunityGalleryImageVersion - Specifies information about the gallery image version that you want to create or update.

func (CommunityGalleryImageVersion) MarshalJSON

func (c CommunityGalleryImageVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersion.

func (*CommunityGalleryImageVersion) UnmarshalJSON

func (c *CommunityGalleryImageVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersion.

type CommunityGalleryImageVersionList

type CommunityGalleryImageVersionList struct {
	// REQUIRED; A list of community gallery image versions.
	Value []*CommunityGalleryImageVersion

	// The URI to fetch the next page of community gallery image versions. Call ListNext() with this to fetch the next page of
	// community gallery image versions.
	NextLink *string
}

CommunityGalleryImageVersionList - The List Community Gallery Image versions operation response.

func (CommunityGalleryImageVersionList) MarshalJSON

func (c CommunityGalleryImageVersionList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionList.

func (*CommunityGalleryImageVersionList) UnmarshalJSON

func (c *CommunityGalleryImageVersionList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersionList.

type CommunityGalleryImageVersionProperties

type CommunityGalleryImageVersionProperties struct {
	// The artifact tags of a community gallery resource.
	ArtifactTags map[string]*string

	// The disclaimer for a community gallery resource.
	Disclaimer *string

	// The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This
	// property is updatable.
	EndOfLifeDate *time.Time

	// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.
	ExcludeFromLatest *bool

	// The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This
	// property is updatable.
	PublishedDate *time.Time

	// Describes the storage profile of the image version.
	StorageProfile *SharedGalleryImageVersionStorageProfile
}

CommunityGalleryImageVersionProperties - Describes the properties of a gallery image version.

func (CommunityGalleryImageVersionProperties) MarshalJSON

func (c CommunityGalleryImageVersionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionProperties.

func (*CommunityGalleryImageVersionProperties) UnmarshalJSON

func (c *CommunityGalleryImageVersionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersionProperties.

type CommunityGalleryImageVersionsClient

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

CommunityGalleryImageVersionsClient contains the methods for the CommunityGalleryImageVersions group. Don't use this type directly, use NewCommunityGalleryImageVersionsClient() instead.

func NewCommunityGalleryImageVersionsClient

func NewCommunityGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleryImageVersionsClient, error)

NewCommunityGalleryImageVersionsClient creates a new instance of CommunityGalleryImageVersionsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CommunityGalleryImageVersionsClient) Get

func (client *CommunityGalleryImageVersionsClient) Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *CommunityGalleryImageVersionsClientGetOptions) (CommunityGalleryImageVersionsClientGetResponse, error)

Get - Get a community gallery image version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • location - The name of Azure region.
  • publicGalleryName - The public name of the community gallery.
  • galleryImageName - The name of the community gallery image definition.
  • galleryImageVersionName - The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: ..
  • options - CommunityGalleryImageVersionsClientGetOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCommunityGalleryImageVersionsClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", 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.CommunityGalleryImageVersion = armcompute.CommunityGalleryImageVersion{
	// 	Name: to.Ptr("myGalleryImageVersionName"),
	// 	Type: to.Ptr("Microsoft.Compute/locations/communityGalleryImageVersion"),
	// 	Identifier: &armcompute.CommunityGalleryIdentifier{
	// 		UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"),
	// 	},
	// 	Location: to.Ptr("myLocation"),
	// 	Properties: &armcompute.CommunityGalleryImageVersionProperties{
	// 		ArtifactTags: map[string]*string{
	// 			"ShareTag-CommunityGallery": to.Ptr("CommunityGallery"),
	// 		},
	// 		Disclaimer: to.Ptr("https://test-uri.com"),
	// 		EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()),
	// 		ExcludeFromLatest: to.Ptr(false),
	// 		PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()),
	// 		StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{
	// 			OSDiskImage: &armcompute.SharedGalleryOSDiskImage{
	// 				DiskSizeGB: to.Ptr[int32](29),
	// 				HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone),
	// 			},
	// 		},
	// 	},
	// }
}

func (*CommunityGalleryImageVersionsClient) NewListPager

NewListPager - List community gallery image versions inside an image.

Generated from API version 2025-03-03

  • location - The name of Azure region.
  • publicGalleryName - The public name of the community gallery.
  • galleryImageName - The name of the community gallery image definition.
  • options - CommunityGalleryImageVersionsClientListOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCommunityGalleryImageVersionsClient().NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", 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.CommunityGalleryImageVersionList = armcompute.CommunityGalleryImageVersionList{
		// 	Value: []*armcompute.CommunityGalleryImageVersion{
		// 		{
		// 			Name: to.Ptr("myGalleryImageVersionName"),
		// 			Identifier: &armcompute.CommunityGalleryIdentifier{
		// 				UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"),
		// 			},
		// 			Location: to.Ptr("myLocation"),
		// 			Properties: &armcompute.CommunityGalleryImageVersionProperties{
		// 				ArtifactTags: map[string]*string{
		// 					"ShareTag-CommunityGallery": to.Ptr("CommunityGallery"),
		// 				},
		// 				Disclaimer: to.Ptr("https://test-uri.com"),
		// 				EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()),
		// 				ExcludeFromLatest: to.Ptr(false),
		// 				PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()),
		// 				StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{
		// 					OSDiskImage: &armcompute.SharedGalleryOSDiskImage{
		// 						DiskSizeGB: to.Ptr[int32](29),
		// 						HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone),
		// 					},
		// 				},
		// 			},
		// 	}},
		// }
	}
}

type CommunityGalleryImageVersionsClientGetOptions

type CommunityGalleryImageVersionsClientGetOptions struct {
}

CommunityGalleryImageVersionsClientGetOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.Get method.

type CommunityGalleryImageVersionsClientGetResponse

type CommunityGalleryImageVersionsClientGetResponse struct {
	// Specifies information about the gallery image version that you want to create or update.
	CommunityGalleryImageVersion
}

CommunityGalleryImageVersionsClientGetResponse contains the response from method CommunityGalleryImageVersionsClient.Get.

type CommunityGalleryImageVersionsClientListOptions

type CommunityGalleryImageVersionsClientListOptions struct {
}

CommunityGalleryImageVersionsClientListOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.NewListPager method.

type CommunityGalleryImageVersionsClientListResponse

type CommunityGalleryImageVersionsClientListResponse struct {
	// The List Community Gallery Image versions operation response.
	CommunityGalleryImageVersionList
}

CommunityGalleryImageVersionsClientListResponse contains the response from method CommunityGalleryImageVersionsClient.NewListPager.

type CommunityGalleryImagesClient

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

CommunityGalleryImagesClient contains the methods for the CommunityGalleryImages group. Don't use this type directly, use NewCommunityGalleryImagesClient() instead.

func NewCommunityGalleryImagesClient

func NewCommunityGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleryImagesClient, error)

NewCommunityGalleryImagesClient creates a new instance of CommunityGalleryImagesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*CommunityGalleryImagesClient) Get

Get - Get a community gallery image. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • location - The name of Azure region.
  • publicGalleryName - The public name of the community gallery.
  • galleryImageName - The name of the community gallery image definition.
  • options - CommunityGalleryImagesClientGetOptions contains the optional parameters for the CommunityGalleryImagesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCommunityGalleryImagesClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", 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.CommunityGalleryImage = armcompute.CommunityGalleryImage{
	// 	Name: to.Ptr("myGalleryImageName"),
	// 	Type: to.Ptr("Microsoft.Compute/locations/communityGalleryImage"),
	// 	Identifier: &armcompute.CommunityGalleryIdentifier{
	// 		UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"),
	// 	},
	// 	Location: to.Ptr("myLocation"),
	// 	Properties: &armcompute.CommunityGalleryImageProperties{
	// 		ArtifactTags: map[string]*string{
	// 			"ShareTag-CommunityGallery": to.Ptr("CommunityGallery"),
	// 		},
	// 		Disclaimer: to.Ptr("https://test-uri.com"),
	// 		Eula: to.Ptr("https://test-uri.com"),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		Identifier: &armcompute.CommunityGalleryImageIdentifier{
	// 			Offer: to.Ptr("myOfferName"),
	// 			Publisher: to.Ptr("myPublisherName"),
	// 			SKU: to.Ptr("mySkuName"),
	// 		},
	// 		OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		PrivacyStatementURI: to.Ptr("https://test-uri.com"),
	// 	},
	// }
}

func (*CommunityGalleryImagesClient) NewListPager

NewListPager - List community gallery images inside a gallery.

Generated from API version 2025-03-03

  • location - The name of Azure region.
  • publicGalleryName - The public name of the community gallery.
  • options - CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCommunityGalleryImagesClient().NewListPager("myLocation", "publicGalleryName", 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.CommunityGalleryImageList = armcompute.CommunityGalleryImageList{
		// 	Value: []*armcompute.CommunityGalleryImage{
		// 		{
		// 			Name: to.Ptr("myGalleryImageName"),
		// 			Identifier: &armcompute.CommunityGalleryIdentifier{
		// 				UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"),
		// 			},
		// 			Location: to.Ptr("myLocation"),
		// 			Properties: &armcompute.CommunityGalleryImageProperties{
		// 				ArtifactTags: map[string]*string{
		// 					"ShareTag-CommunityGallery": to.Ptr("CommunityGallery"),
		// 				},
		// 				Disclaimer: to.Ptr("https://test-uri.com"),
		// 				HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
		// 				Identifier: &armcompute.CommunityGalleryImageIdentifier{
		// 					Offer: to.Ptr("myOfferName"),
		// 					Publisher: to.Ptr("myPublisherName"),
		// 					SKU: to.Ptr("mySkuName"),
		// 				},
		// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 			},
		// 	}},
		// }
	}
}

type CommunityGalleryImagesClientGetOptions

type CommunityGalleryImagesClientGetOptions struct {
}

CommunityGalleryImagesClientGetOptions contains the optional parameters for the CommunityGalleryImagesClient.Get method.

type CommunityGalleryImagesClientGetResponse

type CommunityGalleryImagesClientGetResponse struct {
	// Specifies information about the gallery image definition that you want to create or update.
	CommunityGalleryImage
}

CommunityGalleryImagesClientGetResponse contains the response from method CommunityGalleryImagesClient.Get.

type CommunityGalleryImagesClientListOptions

type CommunityGalleryImagesClientListOptions struct {
}

CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.NewListPager method.

type CommunityGalleryImagesClientListResponse

type CommunityGalleryImagesClientListResponse struct {
	// The List Community Gallery Images operation response.
	CommunityGalleryImageList
}

CommunityGalleryImagesClientListResponse contains the response from method CommunityGalleryImagesClient.NewListPager.

type CommunityGalleryInfo

type CommunityGalleryInfo struct {
	// End-user license agreement for community gallery image.
	Eula *string

	// The prefix of the gallery name that will be displayed publicly. Visible to all users.
	PublicNamePrefix *string

	// Community gallery publisher support email. The email address of the publisher. Visible to all users.
	PublisherContact *string

	// The link to the publisher website. Visible to all users.
	PublisherURI *string

	// READ-ONLY; Contains info about whether community gallery sharing is enabled.
	CommunityGalleryEnabled *bool

	// READ-ONLY; Community gallery public name list.
	PublicNames []*string
}

CommunityGalleryInfo - Information of community gallery if current gallery is shared to community

func (CommunityGalleryInfo) MarshalJSON

func (c CommunityGalleryInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryInfo.

func (*CommunityGalleryInfo) UnmarshalJSON

func (c *CommunityGalleryInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryInfo.

type CommunityGalleryMetadata

type CommunityGalleryMetadata struct {
	// REQUIRED; A list of public names the gallery has.
	PublicNames []*string

	// REQUIRED; The publisher email id of this community gallery.
	PublisherContact *string

	// The end-user license agreement for this community gallery.
	Eula *string

	// The link for the privacy statement of this community gallery from the gallery publisher.
	PrivacyStatementURI *string

	// The publisher URI of this community gallery.
	PublisherURI *string
}

CommunityGalleryMetadata - The metadata of community gallery.

func (CommunityGalleryMetadata) MarshalJSON

func (c CommunityGalleryMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryMetadata.

func (*CommunityGalleryMetadata) UnmarshalJSON

func (c *CommunityGalleryMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryMetadata.

type CommunityGalleryProperties

type CommunityGalleryProperties struct {
	// The artifact tags of a community gallery resource.
	ArtifactTags map[string]*string

	// The metadata of community gallery.
	CommunityMetadata *CommunityGalleryMetadata

	// The disclaimer for a community gallery resource.
	Disclaimer *string
}

CommunityGalleryProperties - Describes the properties of a community gallery.

func (CommunityGalleryProperties) MarshalJSON

func (c CommunityGalleryProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CommunityGalleryProperties.

func (*CommunityGalleryProperties) UnmarshalJSON

func (c *CommunityGalleryProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryProperties.

type ConfidentialVMEncryptionType

type ConfidentialVMEncryptionType string

ConfidentialVMEncryptionType - confidential VM encryption types

const (
	ConfidentialVMEncryptionTypeEncryptedVMGuestStateOnlyWithPmk ConfidentialVMEncryptionType = "EncryptedVMGuestStateOnlyWithPmk"
	ConfidentialVMEncryptionTypeEncryptedWithCmk                 ConfidentialVMEncryptionType = "EncryptedWithCmk"
	ConfidentialVMEncryptionTypeEncryptedWithPmk                 ConfidentialVMEncryptionType = "EncryptedWithPmk"
	ConfidentialVMEncryptionTypeNonPersistedTPM                  ConfidentialVMEncryptionType = "NonPersistedTPM"
)

func PossibleConfidentialVMEncryptionTypeValues

func PossibleConfidentialVMEncryptionTypeValues() []ConfidentialVMEncryptionType

PossibleConfidentialVMEncryptionTypeValues returns the possible values for the ConfidentialVMEncryptionType const type.

type ConsistencyModeTypes

type ConsistencyModeTypes string

ConsistencyModeTypes - ConsistencyMode of the RestorePoint. Can be specified in the input while creating a restore point. For now, only CrashConsistent is accepted as a valid input. Please refer to https://aka.ms/RestorePoints for more details.

const (
	ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent"
	ConsistencyModeTypesCrashConsistent       ConsistencyModeTypes = "CrashConsistent"
	ConsistencyModeTypesFileSystemConsistent  ConsistencyModeTypes = "FileSystemConsistent"
)

func PossibleConsistencyModeTypesValues

func PossibleConsistencyModeTypesValues() []ConsistencyModeTypes

PossibleConsistencyModeTypesValues returns the possible values for the ConsistencyModeTypes const type.

type ConvertToVirtualMachineScaleSetInput

type ConvertToVirtualMachineScaleSetInput struct {
	// Specifies information about the Virtual Machine Scale Set that the Availability Set should be converted to.
	VirtualMachineScaleSetName *string
}

ConvertToVirtualMachineScaleSetInput - Describes the Virtual Machine Scale Set to convert from Availability Set.

func (ConvertToVirtualMachineScaleSetInput) MarshalJSON

func (c ConvertToVirtualMachineScaleSetInput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ConvertToVirtualMachineScaleSetInput.

func (*ConvertToVirtualMachineScaleSetInput) UnmarshalJSON

func (c *ConvertToVirtualMachineScaleSetInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ConvertToVirtualMachineScaleSetInput.

type CopyCompletionError

type CopyCompletionError struct {
	// REQUIRED; Indicates the error code if the background copy of a resource created via the CopyStart operation fails.
	ErrorCode *CopyCompletionErrorReason

	// REQUIRED; Indicates the error message if the background copy of a resource created via the CopyStart operation fails.
	ErrorMessage *string
}

CopyCompletionError - Indicates the error details if the background copy of a resource created via the CopyStart operation fails.

func (CopyCompletionError) MarshalJSON

func (c CopyCompletionError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CopyCompletionError.

func (*CopyCompletionError) UnmarshalJSON

func (c *CopyCompletionError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CopyCompletionError.

type CopyCompletionErrorReason

type CopyCompletionErrorReason string

CopyCompletionErrorReason - Indicates the error code if the background copy of a resource created via the CopyStart operation fails.

const (
	// CopyCompletionErrorReasonCopySourceNotFound - Indicates that the source snapshot was deleted while the background copy
	// of the resource created via CopyStart operation was in progress.
	CopyCompletionErrorReasonCopySourceNotFound CopyCompletionErrorReason = "CopySourceNotFound"
)

func PossibleCopyCompletionErrorReasonValues

func PossibleCopyCompletionErrorReasonValues() []CopyCompletionErrorReason

PossibleCopyCompletionErrorReasonValues returns the possible values for the CopyCompletionErrorReason const type.

type CreatedByType

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

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type CreationData

type CreationData struct {
	// REQUIRED; This enumerates the possible sources of a disk's creation.
	CreateOption *DiskCreateOption

	// Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san volume snapshot.
	ElasticSanResourceID *string

	// Required if creating from a Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference
	// will be the ARM id of the shared galley image version from which to create a
	// disk.
	GalleryImageReference *ImageDiskReference

	// Disk source information for PIR or user images.
	ImageReference *ImageDiskReference

	// For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained
	// for instant access to enable faster restore.
	InstantAccessDurationMinutes *int64

	// Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.
	LogicalSectorSize *int32

	// Set this flag to true to get a boost on the performance target of the disk deployed, see here on the respective performance
	// target. This flag can only be set on disk creation time and cannot be
	// disabled after enabled.
	PerformancePlus *bool

	// If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.
	ProvisionedBandwidthCopySpeed *ProvisionedBandwidthCopyOption

	// If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.
	SecurityDataURI *string

	// If createOption is ImportSecure, this is the URI of a blob to be imported into VM metadata for Confidential VM.
	SecurityMetadataURI *string

	// If createOption is Copy, this is the ARM id of the source snapshot or disk.
	SourceResourceID *string

	// If createOption is Import, this is the URI of a blob to be imported into a managed disk.
	SourceURI *string

	// Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to
	// import as a disk.
	StorageAccountID *string

	// If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be
	// between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520
	// bytes (32 TiB + 512 bytes for the VHD footer).
	UploadSizeBytes *int64

	// READ-ONLY; If this field is set, this is the unique id identifying the source of this resource.
	SourceUniqueID *string
}

CreationData - Data used when creating a disk.

func (CreationData) MarshalJSON

func (c CreationData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreationData.

func (*CreationData) UnmarshalJSON

func (c *CreationData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreationData.

type DataAccessAuthMode

type DataAccessAuthMode string

DataAccessAuthMode - Additional authentication requirements when exporting or uploading to a disk or snapshot.

const (
	// DataAccessAuthModeAzureActiveDirectory - When export/upload URL is used, the system checks if the user has an identity
	// in Azure Active Directory and has necessary permissions to export/upload the data. Please refer to aka.ms/DisksAzureADAuth.
	DataAccessAuthModeAzureActiveDirectory DataAccessAuthMode = "AzureActiveDirectory"
	// DataAccessAuthModeNone - No additional authentication would be performed when accessing export/upload URL.
	DataAccessAuthModeNone DataAccessAuthMode = "None"
)

func PossibleDataAccessAuthModeValues

func PossibleDataAccessAuthModeValues() []DataAccessAuthMode

PossibleDataAccessAuthModeValues returns the possible values for the DataAccessAuthMode const type.

type DataDisk

type DataDisk struct {
	// REQUIRED; Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when
	// you are using a specialized disk to create the virtual machine. FromImage: This value is
	// used when you are using an image to create the virtual machine data disk. If you are using a platform image, you should
	// also use the imageReference element described above. If you are using a
	// marketplace image, you should also use the plan element previously described. Empty: This value is used when creating an
	// empty data disk. Copy: This value is used to create a data disk from a snapshot
	// or another disk. Restore: This value is used to create a data disk from a disk restore point.
	CreateOption *DiskCreateOptionTypes

	// REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and
	// therefore must be unique for each data disk attached to a VM.
	Lun *int32

	// Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for
	// Standard storage. ReadOnly for Premium storage.
	Caching *CachingTypes

	// Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value
	// is used, the data disk is deleted when VM is deleted. Detach. If this value is
	// used, the data disk is retained after VM is deleted. The default value is set to Detach.
	DeleteOption *DiskDeleteOptionTypes

	// Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the
	// virtual machine. Supported values: ForceDetach. detachOption: ForceDetach is
	// applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected
	// failure from the virtual machine and the disk is still not released then
	// use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed
	// when using this detach behavior. This feature is still in preview. To
	// force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.
	DetachOption *DiskDetachOptionTypes

	// Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS.
	DiskIOPSReadWrite *int64

	// Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS.
	DiskMBpsReadWrite *int64

	// Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a
	// virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3
	// for the disk and the value cannot be larger than 1023.
	DiskSizeGB *int32

	// The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine.
	// If SourceImage is provided, the destination virtual hard drive must not
	// exist.
	Image *VirtualHardDisk

	// The managed disk parameters.
	ManagedDisk *ManagedDiskParameters

	// The disk name.
	Name *string

	// The source resource identifier. It can be a snapshot, or disk restore point from which to create a disk.
	SourceResource *APIEntityReference

	// Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset
	ToBeDetached *bool

	// The virtual hard disk.
	Vhd *VirtualHardDisk

	// Specifies whether writeAccelerator should be enabled or disabled on the disk.
	WriteAcceleratorEnabled *bool
}

DataDisk - Describes a data disk.

func (DataDisk) MarshalJSON

func (d DataDisk) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DataDisk.

func (*DataDisk) UnmarshalJSON

func (d *DataDisk) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DataDisk.

type DataDiskImage

type DataDiskImage struct {
	// READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM
	// and therefore must be unique for each data disk attached to a VM.
	Lun *int32
}

DataDiskImage - Contains the data disk images information.

func (DataDiskImage) MarshalJSON

func (d DataDiskImage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DataDiskImage.

func (*DataDiskImage) UnmarshalJSON

func (d *DataDiskImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DataDiskImage.

type DataDiskImageEncryption

type DataDiskImageEncryption struct {
	// REQUIRED; This property specifies the logical unit number of the data disk. This value is used to identify data disks within
	// the Virtual Machine and therefore must be unique for each data disk attached to the
	// Virtual Machine.
	Lun *int32

	// A relative URI containing the resource ID of the disk encryption set.
	DiskEncryptionSetID *string
}

DataDiskImageEncryption - Contains encryption settings for a data disk image.

func (DataDiskImageEncryption) MarshalJSON

func (d DataDiskImageEncryption) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DataDiskImageEncryption.

func (*DataDiskImageEncryption) UnmarshalJSON

func (d *DataDiskImageEncryption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DataDiskImageEncryption.

type DataDisksToAttach

type DataDisksToAttach struct {
	// REQUIRED; ID of the managed data disk.
	DiskID *string

	// Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for
	// Standard storage. ReadOnly for Premium storage.
	Caching *CachingTypes

	// Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value
	// is used, the data disk is deleted when VM is deleted. Detach. If this value is
	// used, the data disk is retained after VM is deleted. The default value is set to Detach.
	DeleteOption *DiskDeleteOptionTypes

	// Specifies the customer managed disk encryption set resource id for the managed disk.
	DiskEncryptionSet *DiskEncryptionSetParameters

	// The logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be
	// unique for each data disk attached to a VM. If not specified, lun would be auto
	// assigned.
	Lun *int32

	// Specifies whether writeAccelerator should be enabled or disabled on the disk.
	WriteAcceleratorEnabled *bool
}

DataDisksToAttach - Describes the data disk to be attached.

func (DataDisksToAttach) MarshalJSON

func (d DataDisksToAttach) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DataDisksToAttach.

func (*DataDisksToAttach) UnmarshalJSON

func (d *DataDisksToAttach) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DataDisksToAttach.

type DataDisksToDetach

type DataDisksToDetach struct {
	// REQUIRED; ID of the managed data disk.
	DiskID *string

	// Supported options available for Detach of a disk from a VM. Refer to DetachOption object reference for more details.
	DetachOption *DiskDetachOptionTypes
}

DataDisksToDetach - Describes the data disk to be detached.

func (DataDisksToDetach) MarshalJSON

func (d DataDisksToDetach) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DataDisksToDetach.

func (*DataDisksToDetach) UnmarshalJSON

func (d *DataDisksToDetach) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DataDisksToDetach.

type DedicatedHost

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

	// REQUIRED; SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute
	// SKUs for a list of possible values.
	SKU *SKU

	// Properties of the dedicated host.
	Properties *DedicatedHostProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

DedicatedHost - Specifies information about the Dedicated host.

func (DedicatedHost) MarshalJSON

func (d DedicatedHost) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHost.

func (*DedicatedHost) UnmarshalJSON

func (d *DedicatedHost) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHost.

type DedicatedHostAllocatableVM

type DedicatedHostAllocatableVM struct {
	// Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity.
	Count *float64

	// VM size in terms of which the unutilized capacity is represented.
	VMSize *string
}

DedicatedHostAllocatableVM - Represents the dedicated host unutilized capacity in terms of a specific VM size.

func (DedicatedHostAllocatableVM) MarshalJSON

func (d DedicatedHostAllocatableVM) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostAllocatableVM.

func (*DedicatedHostAllocatableVM) UnmarshalJSON

func (d *DedicatedHostAllocatableVM) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostAllocatableVM.

type DedicatedHostAvailableCapacity

type DedicatedHostAvailableCapacity struct {
	// The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the
	// dedicated host.
	AllocatableVMs []*DedicatedHostAllocatableVM
}

DedicatedHostAvailableCapacity - Dedicated host unutilized capacity.

func (DedicatedHostAvailableCapacity) MarshalJSON

func (d DedicatedHostAvailableCapacity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostAvailableCapacity.

func (*DedicatedHostAvailableCapacity) UnmarshalJSON

func (d *DedicatedHostAvailableCapacity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostAvailableCapacity.

type DedicatedHostGroup

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

	// Dedicated Host Group Properties.
	Properties *DedicatedHostGroupProperties

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

	// The availability zones.
	Zones []*string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

DedicatedHostGroup - Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group.

func (DedicatedHostGroup) MarshalJSON

func (d DedicatedHostGroup) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroup.

func (*DedicatedHostGroup) UnmarshalJSON

func (d *DedicatedHostGroup) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroup.

type DedicatedHostGroupInstanceView

type DedicatedHostGroupInstanceView struct {
	// List of instance view of the dedicated hosts under the dedicated host group.
	Hosts []*DedicatedHostInstanceViewWithName
}

func (DedicatedHostGroupInstanceView) MarshalJSON

func (d DedicatedHostGroupInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupInstanceView.

func (*DedicatedHostGroupInstanceView) UnmarshalJSON

func (d *DedicatedHostGroupInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupInstanceView.

type DedicatedHostGroupListResult

type DedicatedHostGroupListResult struct {
	// REQUIRED; The list of dedicated host groups.
	Value []*DedicatedHostGroup

	// The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI to fetch the next page of Dedicated
	// Host Groups.
	NextLink *string
}

DedicatedHostGroupListResult - The List Dedicated Host Group with resource group response.

func (DedicatedHostGroupListResult) MarshalJSON

func (d DedicatedHostGroupListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupListResult.

func (*DedicatedHostGroupListResult) UnmarshalJSON

func (d *DedicatedHostGroupListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupListResult.

type DedicatedHostGroupProperties

type DedicatedHostGroupProperties struct {
	// REQUIRED; Number of fault domains that the host group can span.
	PlatformFaultDomainCount *int32

	// Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01.
	AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities

	// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group.
	// Automatic placement means resources are allocated on dedicated hosts, that are
	// chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version:
	// 2020-06-01.
	SupportAutomaticPlacement *bool

	// READ-ONLY; A list of references to all dedicated hosts in the dedicated host group.
	Hosts []*SubResourceReadOnly

	// READ-ONLY; The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the
	// dedicated host group.
	InstanceView *DedicatedHostGroupInstanceView
}

DedicatedHostGroupProperties - Dedicated Host Group Properties.

func (DedicatedHostGroupProperties) MarshalJSON

func (d DedicatedHostGroupProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupProperties.

func (*DedicatedHostGroupProperties) UnmarshalJSON

func (d *DedicatedHostGroupProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupProperties.

type DedicatedHostGroupPropertiesAdditionalCapabilities

type DedicatedHostGroupPropertiesAdditionalCapabilities struct {
	// The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated
	// Host Group. For the Virtual Machines to be UltraSSD Enabled,
	// UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided.
	// Please refer to
	// https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. Note:
	// The ultraSSDEnabled setting can only be enabled for Host Groups that are
	// created as zonal. Minimum api-version: 2022-03-01.
	UltraSSDEnabled *bool
}

DedicatedHostGroupPropertiesAdditionalCapabilities - Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01.

func (DedicatedHostGroupPropertiesAdditionalCapabilities) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupPropertiesAdditionalCapabilities.

func (*DedicatedHostGroupPropertiesAdditionalCapabilities) UnmarshalJSON

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupPropertiesAdditionalCapabilities.

type DedicatedHostGroupUpdate

type DedicatedHostGroupUpdate struct {
	// Dedicated Host Group Properties.
	Properties *DedicatedHostGroupProperties

	// Resource tags
	Tags map[string]*string

	// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation.
	// If not provided, the group supports all zones in the region. If provided,
	// enforces each host in the group to be in the same zone.
	Zones []*string
}

DedicatedHostGroupUpdate - Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated.

func (DedicatedHostGroupUpdate) MarshalJSON

func (d DedicatedHostGroupUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupUpdate.

func (*DedicatedHostGroupUpdate) UnmarshalJSON

func (d *DedicatedHostGroupUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupUpdate.

type DedicatedHostGroupsClient

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

DedicatedHostGroupsClient contains the methods for the DedicatedHostGroups group. Don't use this type directly, use NewDedicatedHostGroupsClient() instead.

func NewDedicatedHostGroupsClient

func NewDedicatedHostGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedHostGroupsClient, error)

NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DedicatedHostGroupsClient) CreateOrUpdate

CreateOrUpdate - Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see Dedicated Host Documentation [https://go.microsoft.com/fwlink/?linkid=2082596] If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • parameters - Parameters supplied to the Create Dedicated Host Group.
  • options - DedicatedHostGroupsClientCreateOrUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.CreateOrUpdate method.
Example (CreateOrUpdateADedicatedHostGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("finance"),
		},
		Properties: &armcompute.DedicatedHostGroupProperties{
			PlatformFaultDomainCount:  to.Ptr[int32](3),
			SupportAutomaticPlacement: to.Ptr(true),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Name: to.Ptr("myDedicatedHostGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("finance"),
	// 		"owner": to.Ptr("myCompany"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostGroupProperties{
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		SupportAutomaticPlacement: to.Ptr(true),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (CreateOrUpdateADedicatedHostGroupWithUltraSsdSupport)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("finance"),
		},
		Properties: &armcompute.DedicatedHostGroupProperties{
			AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{
				UltraSSDEnabled: to.Ptr(true),
			},
			PlatformFaultDomainCount:  to.Ptr[int32](3),
			SupportAutomaticPlacement: to.Ptr(true),
		},
		Zones: []*string{
			to.Ptr("1")},
	}, 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Name: to.Ptr("myDedicatedHostGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("finance"),
	// 		"owner": to.Ptr("myCompany"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostGroupProperties{
	// 		AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{
	// 			UltraSSDEnabled: to.Ptr(true),
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		SupportAutomaticPlacement: to.Ptr(true),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}

func (*DedicatedHostGroupsClient) Delete

Delete - Delete a dedicated host group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • options - DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete method.
Example (DedicatedHostGroupDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

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

func (*DedicatedHostGroupsClient) Get

Get - Retrieves information about a dedicated host group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • options - DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method.
Example (CreateADedicatedHostGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Name: to.Ptr("myDedicatedHostGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"{tagName}": to.Ptr("{tagValue}"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostGroupProperties{
	// 		Hosts: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost1"),
	// 			},
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost2"),
	// 		}},
	// 		InstanceView: &armcompute.DedicatedHostGroupInstanceView{
	// 			Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
	// 				{
	// 					AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"),
	// 					AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 						AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 							{
	// 								Count: to.Ptr[float64](10),
	// 								VMSize: to.Ptr("Standard_A1"),
	// 						}},
	// 					},
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 						},
	// 						{
	// 							Code: to.Ptr("HealthState/available"),
	// 							DisplayStatus: to.Ptr("Host available"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					Name: to.Ptr("myHost1"),
	// 				},
	// 				{
	// 					AssetID: to.Ptr("f293d4ac-5eea-4be2-b0c0-0fcaa09aebf8"),
	// 					AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 						AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 							{
	// 								Count: to.Ptr[float64](10),
	// 								VMSize: to.Ptr("Standard_A1"),
	// 						}},
	// 					},
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 						},
	// 						{
	// 							Code: to.Ptr("HealthState/available"),
	// 							DisplayStatus: to.Ptr("Host available"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					Name: to.Ptr("myHost2"),
	// 			}},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		SupportAutomaticPlacement: to.Ptr(true),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("3")},
	// 	}
}
Example (CreateAnUltraSsdEnabledDedicatedHostGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Name: to.Ptr("myDedicatedHostGroup"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"{tagName}": to.Ptr("{tagValue}"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostGroupProperties{
	// 		AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{
	// 			UltraSSDEnabled: to.Ptr(true),
	// 		},
	// 		Hosts: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost"),
	// 		}},
	// 		InstanceView: &armcompute.DedicatedHostGroupInstanceView{
	// 			Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
	// 				{
	// 					AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"),
	// 					AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 						AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 							{
	// 								Count: to.Ptr[float64](10),
	// 								VMSize: to.Ptr("Standard_A1"),
	// 						}},
	// 					},
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("ProvisioningState/succeeded"),
	// 							DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 						},
	// 						{
	// 							Code: to.Ptr("HealthState/available"),
	// 							DisplayStatus: to.Ptr("Host available"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					}},
	// 					Name: to.Ptr("myHost"),
	// 			}},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		SupportAutomaticPlacement: to.Ptr(true),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("3")},
	// 	}
}

func (*DedicatedHostGroupsClient) NewListByResourceGroupPager

NewListByResourceGroupPager - Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response to get the next page of dedicated host groups.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListByResourceGroupPager method.
Example (DedicatedHostGroupListByResourceGroupMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", 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.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
		// 	Value: []*armcompute.DedicatedHostGroup{
		// 		{
		// 			Name: to.Ptr("myDedicatedHostGroup"),
		// 			Type: to.Ptr("aaaa"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 			},
		// 			Properties: &armcompute.DedicatedHostGroupProperties{
		// 				Hosts: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("aaaa"),
		// 				}},
		// 				InstanceView: &armcompute.DedicatedHostGroupInstanceView{
		// 					Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
		// 						{
		// 							AssetID: to.Ptr("aaaa"),
		// 							AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
		// 								AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
		// 									{
		// 										Count: to.Ptr[float64](26),
		// 										VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
		// 								}},
		// 							},
		// 							Statuses: []*armcompute.InstanceViewStatus{
		// 								{
		// 									Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
		// 									DisplayStatus: to.Ptr("aaaaaa"),
		// 									Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 									Message: to.Ptr("a"),
		// 									Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
		// 							}},
		// 							Name: to.Ptr("aaaaaaaaaaaaaaaaaa"),
		// 					}},
		// 				},
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				SupportAutomaticPlacement: to.Ptr(true),
		// 			},
		// 			Zones: []*string{
		// 				to.Ptr("1")},
		// 		}},
		// 	}
	}
}
Example (DedicatedHostGroupListByResourceGroupMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", 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.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
		// 	Value: []*armcompute.DedicatedHostGroup{
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
		// 			Location: to.Ptr("westus"),
		// 	}},
		// }
	}
}

func (*DedicatedHostGroupsClient) NewListBySubscriptionPager

NewListBySubscriptionPager - Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.

Generated from API version 2025-04-01

  • options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager method.
Example (DedicatedHostGroupListBySubscriptionMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostGroupsClient().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.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
		// 	Value: []*armcompute.DedicatedHostGroup{
		// 		{
		// 			Name: to.Ptr("myDedicatedHostGroup"),
		// 			Type: to.Ptr("aaaa"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 			},
		// 			Properties: &armcompute.DedicatedHostGroupProperties{
		// 				Hosts: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("aaaa"),
		// 				}},
		// 				InstanceView: &armcompute.DedicatedHostGroupInstanceView{
		// 					Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
		// 						{
		// 							AssetID: to.Ptr("aaaa"),
		// 							AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
		// 								AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
		// 									{
		// 										Count: to.Ptr[float64](26),
		// 										VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
		// 								}},
		// 							},
		// 							Statuses: []*armcompute.InstanceViewStatus{
		// 								{
		// 									Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
		// 									DisplayStatus: to.Ptr("aaaaaa"),
		// 									Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 									Message: to.Ptr("a"),
		// 									Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
		// 							}},
		// 							Name: to.Ptr("aaaaaaaaaaaaaaaaaa"),
		// 					}},
		// 				},
		// 				PlatformFaultDomainCount: to.Ptr[int32](3),
		// 				SupportAutomaticPlacement: to.Ptr(true),
		// 			},
		// 			Zones: []*string{
		// 				to.Ptr("1")},
		// 		}},
		// 	}
	}
}
Example (DedicatedHostGroupListBySubscriptionMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostGroupsClient().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.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
		// 	Value: []*armcompute.DedicatedHostGroup{
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
		// 			Location: to.Ptr("westus"),
		// 	}},
		// }
	}
}

func (*DedicatedHostGroupsClient) Update

Update - Update an dedicated host group. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • parameters - Parameters supplied to the Update Dedicated Host Group operation.
  • options - DedicatedHostGroupsClientUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.Update method.
Example (DedicatedHostGroupUpdateMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaa", armcompute.DedicatedHostGroupUpdate{
		Tags: map[string]*string{
			"key9921": to.Ptr("aaaaaaaaaa"),
		},
		Properties: &armcompute.DedicatedHostGroupProperties{
			InstanceView: &armcompute.DedicatedHostGroupInstanceView{
				Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
					{
						AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
							AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
								{
									Count:  to.Ptr[float64](26),
									VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
								}},
						},
						Statuses: []*armcompute.InstanceViewStatus{
							{
								Code:          to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
								DisplayStatus: to.Ptr("aaaaaa"),
								Level:         to.Ptr(armcompute.StatusLevelTypesInfo),
								Message:       to.Ptr("a"),
								Time:          to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
							}},
					}},
			},
			PlatformFaultDomainCount:  to.Ptr[int32](3),
			SupportAutomaticPlacement: to.Ptr(true),
		},
		Zones: []*string{
			to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")},
	}, 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Name: to.Ptr("myDedicatedHostGroup"),
	// 	Type: to.Ptr("aaaa"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armcompute.DedicatedHostGroupProperties{
	// 		Hosts: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 		InstanceView: &armcompute.DedicatedHostGroupInstanceView{
	// 			Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
	// 				{
	// 					AssetID: to.Ptr("aaaa"),
	// 					AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 						AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 							{
	// 								Count: to.Ptr[float64](26),
	// 								VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
	// 						}},
	// 					},
	// 					Statuses: []*armcompute.InstanceViewStatus{
	// 						{
	// 							Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 							DisplayStatus: to.Ptr("aaaaaa"),
	// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 							Message: to.Ptr("a"),
	// 							Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 					}},
	// 					Name: to.Ptr("aaaaaaaaaaaaaaaaaa"),
	// 			}},
	// 		},
	// 		PlatformFaultDomainCount: to.Ptr[int32](3),
	// 		SupportAutomaticPlacement: to.Ptr(true),
	// 	},
	// 	Zones: []*string{
	// 		to.Ptr("1")},
	// 	}
}
Example (DedicatedHostGroupUpdateMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, 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.DedicatedHostGroup = armcompute.DedicatedHostGroup{
	// 	Location: to.Ptr("westus"),
	// }
}

type DedicatedHostGroupsClientCreateOrUpdateOptions

type DedicatedHostGroupsClientCreateOrUpdateOptions struct {
}

DedicatedHostGroupsClientCreateOrUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.CreateOrUpdate method.

type DedicatedHostGroupsClientCreateOrUpdateResponse

type DedicatedHostGroupsClientCreateOrUpdateResponse struct {
	// Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated
	// host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another
	// dedicated host group.
	DedicatedHostGroup
}

DedicatedHostGroupsClientCreateOrUpdateResponse contains the response from method DedicatedHostGroupsClient.CreateOrUpdate.

type DedicatedHostGroupsClientDeleteOptions

type DedicatedHostGroupsClientDeleteOptions struct {
}

DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete method.

type DedicatedHostGroupsClientDeleteResponse

type DedicatedHostGroupsClientDeleteResponse struct {
}

DedicatedHostGroupsClientDeleteResponse contains the response from method DedicatedHostGroupsClient.Delete.

type DedicatedHostGroupsClientGetOptions

type DedicatedHostGroupsClientGetOptions struct {
	// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated
	// hosts under the dedicated host group. 'UserData' is not supported for
	// dedicated host group.
	Expand *InstanceViewTypes
}

DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method.

type DedicatedHostGroupsClientGetResponse

type DedicatedHostGroupsClientGetResponse struct {
	// Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated
	// host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another
	// dedicated host group.
	DedicatedHostGroup
}

DedicatedHostGroupsClientGetResponse contains the response from method DedicatedHostGroupsClient.Get.

type DedicatedHostGroupsClientListByResourceGroupOptions

type DedicatedHostGroupsClientListByResourceGroupOptions struct {
}

DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListByResourceGroupPager method.

type DedicatedHostGroupsClientListByResourceGroupResponse

type DedicatedHostGroupsClientListByResourceGroupResponse struct {
	// The List Dedicated Host Group with resource group response.
	DedicatedHostGroupListResult
}

DedicatedHostGroupsClientListByResourceGroupResponse contains the response from method DedicatedHostGroupsClient.NewListByResourceGroupPager.

type DedicatedHostGroupsClientListBySubscriptionOptions

type DedicatedHostGroupsClientListBySubscriptionOptions struct {
}

DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager method.

type DedicatedHostGroupsClientListBySubscriptionResponse

type DedicatedHostGroupsClientListBySubscriptionResponse struct {
	// The List Dedicated Host Group with resource group response.
	DedicatedHostGroupListResult
}

DedicatedHostGroupsClientListBySubscriptionResponse contains the response from method DedicatedHostGroupsClient.NewListBySubscriptionPager.

type DedicatedHostGroupsClientUpdateOptions

type DedicatedHostGroupsClientUpdateOptions struct {
}

DedicatedHostGroupsClientUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.Update method.

type DedicatedHostGroupsClientUpdateResponse

type DedicatedHostGroupsClientUpdateResponse struct {
	// Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated
	// host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another
	// dedicated host group.
	DedicatedHostGroup
}

DedicatedHostGroupsClientUpdateResponse contains the response from method DedicatedHostGroupsClient.Update.

type DedicatedHostInstanceView

type DedicatedHostInstanceView struct {
	// Unutilized capacity of the dedicated host.
	AvailableCapacity *DedicatedHostAvailableCapacity

	// The resource status information.
	Statuses []*InstanceViewStatus

	// READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides.
	AssetID *string
}

DedicatedHostInstanceView - The instance view of a dedicated host.

func (DedicatedHostInstanceView) MarshalJSON

func (d DedicatedHostInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostInstanceView.

func (*DedicatedHostInstanceView) UnmarshalJSON

func (d *DedicatedHostInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostInstanceView.

type DedicatedHostInstanceViewWithName

type DedicatedHostInstanceViewWithName struct {
	// Unutilized capacity of the dedicated host.
	AvailableCapacity *DedicatedHostAvailableCapacity

	// The resource status information.
	Statuses []*InstanceViewStatus

	// READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides.
	AssetID *string

	// READ-ONLY; The name of the dedicated host.
	Name *string
}

DedicatedHostInstanceViewWithName - The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group.

func (DedicatedHostInstanceViewWithName) MarshalJSON

func (d DedicatedHostInstanceViewWithName) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostInstanceViewWithName.

func (*DedicatedHostInstanceViewWithName) UnmarshalJSON

func (d *DedicatedHostInstanceViewWithName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostInstanceViewWithName.

type DedicatedHostLicenseTypes

type DedicatedHostLicenseTypes string

DedicatedHostLicenseTypes - Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: None, WindowsServerHybrid, WindowsServerPerpetual. The default value is: None.

const (
	DedicatedHostLicenseTypesNone                   DedicatedHostLicenseTypes = "None"
	DedicatedHostLicenseTypesWindowsServerHybrid    DedicatedHostLicenseTypes = "Windows_Server_Hybrid"
	DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual"
)

func PossibleDedicatedHostLicenseTypesValues

func PossibleDedicatedHostLicenseTypesValues() []DedicatedHostLicenseTypes

PossibleDedicatedHostLicenseTypesValues returns the possible values for the DedicatedHostLicenseTypes const type.

type DedicatedHostListResult

type DedicatedHostListResult struct {
	// REQUIRED; The list of dedicated hosts.
	Value []*DedicatedHost

	// The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to fetch the next page of dedicated hosts.
	NextLink *string
}

DedicatedHostListResult - The list dedicated host operation response.

func (DedicatedHostListResult) MarshalJSON

func (d DedicatedHostListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostListResult.

func (*DedicatedHostListResult) UnmarshalJSON

func (d *DedicatedHostListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostListResult.

type DedicatedHostProperties

type DedicatedHostProperties struct {
	// Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true'
	// when not provided.
	AutoReplaceOnFailure *bool

	// Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are:
	// None, WindowsServerHybrid, WindowsServerPerpetual. The default value is: None.
	LicenseType *DedicatedHostLicenseTypes

	// Fault domain of the dedicated host within a dedicated host group.
	PlatformFaultDomain *int32

	// READ-ONLY; A unique id generated and assigned to the dedicated host by the platform. Does not change throughout the lifetime
	// of the host.
	HostID *string

	// READ-ONLY; The dedicated host instance view.
	InstanceView *DedicatedHostInstanceView

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *string

	// READ-ONLY; The date when the host was first provisioned.
	ProvisioningTime *time.Time

	// READ-ONLY; Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01.
	TimeCreated *time.Time

	// READ-ONLY; A list of references to all virtual machines in the Dedicated Host.
	VirtualMachines []*SubResourceReadOnly
}

DedicatedHostProperties - Properties of the dedicated host.

func (DedicatedHostProperties) MarshalJSON

func (d DedicatedHostProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostProperties.

func (*DedicatedHostProperties) UnmarshalJSON

func (d *DedicatedHostProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostProperties.

type DedicatedHostSizeListResult

type DedicatedHostSizeListResult struct {
	// The link to the next page of items.
	NextLink *string

	// The list of dedicated host sizes.
	Value []*string
}

DedicatedHostSizeListResult - The List Dedicated Host sizes operation response.

func (DedicatedHostSizeListResult) MarshalJSON

func (d DedicatedHostSizeListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostSizeListResult.

func (*DedicatedHostSizeListResult) UnmarshalJSON

func (d *DedicatedHostSizeListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostSizeListResult.

type DedicatedHostUpdate

type DedicatedHostUpdate struct {
	// Properties of the dedicated host.
	Properties *DedicatedHostProperties

	// List all available dedicated host sizes for resizing [https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes].
	// Resizing can be only used to scale up DedicatedHost. Only name is
	// required to be set.
	SKU *SKU

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

DedicatedHostUpdate - Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated.

func (DedicatedHostUpdate) MarshalJSON

func (d DedicatedHostUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DedicatedHostUpdate.

func (*DedicatedHostUpdate) UnmarshalJSON

func (d *DedicatedHostUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostUpdate.

type DedicatedHostsClient

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

DedicatedHostsClient contains the methods for the DedicatedHosts group. Don't use this type directly, use NewDedicatedHostsClient() instead.

func NewDedicatedHostsClient

func NewDedicatedHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedHostsClient, error)

NewDedicatedHostsClient creates a new instance of DedicatedHostsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DedicatedHostsClient) BeginCreateOrUpdate

func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DedicatedHostsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a dedicated host . If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • parameters - Parameters supplied to the Create Dedicated Host.
  • options - DedicatedHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", "myDedicatedHost", armcompute.DedicatedHost{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"department": to.Ptr("HR"),
		},
		Properties: &armcompute.DedicatedHostProperties{
			PlatformFaultDomain: to.Ptr[int32](1),
		},
		SKU: &armcompute.SKU{
			Name: to.Ptr("DSv3-Type1"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DedicatedHost = armcompute.DedicatedHost{
	// 	Name: to.Ptr("myDedicatedHost"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostProperties{
	// 		AutoReplaceOnFailure: to.Ptr(false),
	// 		HostID: to.Ptr("{GUID}"),
	// 		LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
	// 		PlatformFaultDomain: to.Ptr[int32](1),
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("DSv3-Type1"),
	// 	},
	// }
}

func (*DedicatedHostsClient) BeginDelete

func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*runtime.Poller[DedicatedHostsClientDeleteResponse], error)

BeginDelete - Delete a dedicated host. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • options - DedicatedHostsClientBeginDeleteOptions contains the optional parameters for the DedicatedHostsClient.BeginDelete method.
Example (DedicatedHostDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginDelete(ctx, "rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Example (DedicatedHostDeleteMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DedicatedHostsClient) BeginRedeploy

func (client *DedicatedHostsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRedeployOptions) (*runtime.Poller[DedicatedHostsClientRedeployResponse], error)

BeginRedeploy - Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • options - DedicatedHostsClientBeginRedeployOptions contains the optional parameters for the DedicatedHostsClient.BeginRedeploy method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Redeploy.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginRedeploy(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DedicatedHostsClient) BeginRestart

func (client *DedicatedHostsClient) BeginRestart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*runtime.Poller[DedicatedHostsClientRestartResponse], error)

BeginRestart - Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more details. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • options - DedicatedHostsClientBeginRestartOptions contains the optional parameters for the DedicatedHostsClient.BeginRestart method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginRestart(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DedicatedHostsClient) BeginUpdate

func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*runtime.Poller[DedicatedHostsClientUpdateResponse], error)

BeginUpdate - Update a dedicated host . If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • parameters - Parameters supplied to the Update Dedicated Host operation.
  • options - DedicatedHostsClientBeginUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginUpdate method.
Example (DedicatedHostUpdateMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{
		Tags: map[string]*string{
			"key8813": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
		},
		Properties: &armcompute.DedicatedHostProperties{
			AutoReplaceOnFailure: to.Ptr(true),
			InstanceView: &armcompute.DedicatedHostInstanceView{
				AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
					AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
						{
							Count:  to.Ptr[float64](26),
							VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
						}},
				},
				Statuses: []*armcompute.InstanceViewStatus{
					{
						Code:          to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
						DisplayStatus: to.Ptr("aaaaaa"),
						Level:         to.Ptr(armcompute.StatusLevelTypesInfo),
						Message:       to.Ptr("a"),
						Time:          to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
					}},
			},
			LicenseType:         to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
			PlatformFaultDomain: to.Ptr[int32](1),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DedicatedHost = armcompute.DedicatedHost{
	// 	Name: to.Ptr("myDedicatedHost"),
	// 	Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armcompute.DedicatedHostProperties{
	// 		AutoReplaceOnFailure: to.Ptr(true),
	// 		HostID: to.Ptr("{GUID}"),
	// 		InstanceView: &armcompute.DedicatedHostInstanceView{
	// 			AssetID: to.Ptr("aaaaaaaaaaaaaaaa"),
	// 			AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 				AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 					{
	// 						Count: to.Ptr[float64](26),
	// 						VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
	// 				}},
	// 			},
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
	// 					DisplayStatus: to.Ptr("aaaaaa"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 					Message: to.Ptr("a"),
	// 					Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
	// 			}},
	// 		},
	// 		LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
	// 		PlatformFaultDomain: to.Ptr[int32](1),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()),
	// 		VirtualMachines: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("DSv3-Type1"),
	// 		Capacity: to.Ptr[int64](7),
	// 		Tier: to.Ptr("aaa"),
	// 	},
	// }
}
Example (DedicatedHostUpdateMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DedicatedHost = armcompute.DedicatedHost{
	// 	Location: to.Ptr("westus"),
	// 	SKU: &armcompute.SKU{
	// 	},
	// }
}
Example (DedicatedHostUpdateResize)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_Resize.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{
		SKU: &armcompute.SKU{
			Name: to.Ptr("DSv3-Type1"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DedicatedHost = armcompute.DedicatedHost{
	// 	Name: to.Ptr("myDedicatedHost"),
	// 	Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armcompute.DedicatedHostProperties{
	// 		AutoReplaceOnFailure: to.Ptr(true),
	// 		HostID: to.Ptr("{GUID}"),
	// 		LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
	// 		PlatformFaultDomain: to.Ptr[int32](1),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()),
	// 		VirtualMachines: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("aaaa"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("DSv3-Type1"),
	// 		Capacity: to.Ptr[int64](7),
	// 		Tier: to.Ptr("aaa"),
	// 	},
	// }
}

func (*DedicatedHostsClient) Get

func (client *DedicatedHostsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientGetOptions) (DedicatedHostsClientGetResponse, error)

Get - Retrieves information about a dedicated host. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • options - DedicatedHostsClientGetOptions contains the optional parameters for the DedicatedHostsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Get.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDedicatedHostsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesInstanceView)})
	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.DedicatedHost = armcompute.DedicatedHost{
	// 	Name: to.Ptr("myHost"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myHost"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.DedicatedHostProperties{
	// 		AutoReplaceOnFailure: to.Ptr(true),
	// 		HostID: to.Ptr("{GUID}"),
	// 		InstanceView: &armcompute.DedicatedHostInstanceView{
	// 			AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"),
	// 			AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
	// 				AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
	// 					{
	// 						Count: to.Ptr[float64](10),
	// 						VMSize: to.Ptr("Standard_A1"),
	// 				}},
	// 			},
	// 			Statuses: []*armcompute.InstanceViewStatus{
	// 				{
	// 					Code: to.Ptr("ProvisioningState/succeeded"),
	// 					DisplayStatus: to.Ptr("Provisioning succeeded"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 				},
	// 				{
	// 					Code: to.Ptr("HealthState/available"),
	// 					DisplayStatus: to.Ptr("Host available"),
	// 					Level: to.Ptr(armcompute.StatusLevelTypesInfo),
	// 			}},
	// 		},
	// 		PlatformFaultDomain: to.Ptr[int32](1),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.313Z"); return t}()),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.313Z"); return t}()),
	// 		VirtualMachines: []*armcompute.SubResourceReadOnly{
	// 			{
	// 				ID: to.Ptr("/subscriptions/subId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/vm1"),
	// 		}},
	// 	},
	// 	SKU: &armcompute.SKU{
	// 		Name: to.Ptr("DSv3-Type1"),
	// 	},
	// }
}

func (*DedicatedHostsClient) NewListAvailableSizesPager

func (client *DedicatedHostsClient) NewListAvailableSizesPager(resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientListAvailableSizesOptions) *runtime.Pager[DedicatedHostsClientListAvailableSizesResponse]

NewListAvailableSizesPager - Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated host.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • hostName - The name of the dedicated host.
  • options - DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostsClient().NewListAvailableSizesPager("myResourceGroup", "myDedicatedHostGroup", "myHost", 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.DedicatedHostSizeListResult = armcompute.DedicatedHostSizeListResult{
		// 	Value: []*string{
		// 		to.Ptr("Dsv3-Type1"),
		// 		to.Ptr("Esv3-Type1")},
		// 	}
	}
}

func (*DedicatedHostsClient) NewListByHostGroupPager

func (client *DedicatedHostsClient) NewListByHostGroupPager(resourceGroupName string, hostGroupName string, options *DedicatedHostsClientListByHostGroupOptions) *runtime.Pager[DedicatedHostsClientListByHostGroupResponse]

NewListByHostGroupPager - Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response to get the next page of dedicated hosts.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • hostGroupName - The name of the dedicated host group.
  • options - DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.NewListByHostGroupPager method.
Example (DedicatedHostListByHostGroupMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 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.DedicatedHostListResult = armcompute.DedicatedHostListResult{
		// 	Value: []*armcompute.DedicatedHost{
		// 		{
		// 			Name: to.Ptr("myDedicatedHost"),
		// 			Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 			},
		// 			Properties: &armcompute.DedicatedHostProperties{
		// 				AutoReplaceOnFailure: to.Ptr(true),
		// 				HostID: to.Ptr("{GUID}"),
		// 				InstanceView: &armcompute.DedicatedHostInstanceView{
		// 					AssetID: to.Ptr("aaaaaaaaaaaaaaaa"),
		// 					AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
		// 						AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
		// 							{
		// 								Count: to.Ptr[float64](26),
		// 								VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
		// 						}},
		// 					},
		// 					Statuses: []*armcompute.InstanceViewStatus{
		// 						{
		// 							Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
		// 							DisplayStatus: to.Ptr("aaaaaa"),
		// 							Level: to.Ptr(armcompute.StatusLevelTypesInfo),
		// 							Message: to.Ptr("a"),
		// 							Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
		// 					}},
		// 				},
		// 				LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
		// 				PlatformFaultDomain: to.Ptr[int32](1),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()),
		// 				VirtualMachines: []*armcompute.SubResourceReadOnly{
		// 					{
		// 						ID: to.Ptr("aaaa"),
		// 				}},
		// 			},
		// 			SKU: &armcompute.SKU{
		// 				Name: to.Ptr("DSv3-Type1"),
		// 				Capacity: to.Ptr[int64](7),
		// 				Tier: to.Ptr("aaa"),
		// 			},
		// 	}},
		// }
	}
}
Example (DedicatedHostListByHostGroupMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaa", 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.DedicatedHostListResult = armcompute.DedicatedHostListResult{
		// 	Value: []*armcompute.DedicatedHost{
		// 		{
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myHost"),
		// 			Location: to.Ptr("westus"),
		// 			SKU: &armcompute.SKU{
		// 			},
		// 	}},
		// }
	}
}

type DedicatedHostsClientBeginCreateOrUpdateOptions

type DedicatedHostsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DedicatedHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginCreateOrUpdate method.

type DedicatedHostsClientBeginDeleteOptions

type DedicatedHostsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DedicatedHostsClientBeginDeleteOptions contains the optional parameters for the DedicatedHostsClient.BeginDelete method.

type DedicatedHostsClientBeginRedeployOptions

type DedicatedHostsClientBeginRedeployOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DedicatedHostsClientBeginRedeployOptions contains the optional parameters for the DedicatedHostsClient.BeginRedeploy method.

type DedicatedHostsClientBeginRestartOptions

type DedicatedHostsClientBeginRestartOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DedicatedHostsClientBeginRestartOptions contains the optional parameters for the DedicatedHostsClient.BeginRestart method.

type DedicatedHostsClientBeginUpdateOptions

type DedicatedHostsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DedicatedHostsClientBeginUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginUpdate method.

type DedicatedHostsClientCreateOrUpdateResponse

type DedicatedHostsClientCreateOrUpdateResponse struct {
	// Specifies information about the Dedicated host.
	DedicatedHost
}

DedicatedHostsClientCreateOrUpdateResponse contains the response from method DedicatedHostsClient.BeginCreateOrUpdate.

type DedicatedHostsClientDeleteResponse

type DedicatedHostsClientDeleteResponse struct {
}

DedicatedHostsClientDeleteResponse contains the response from method DedicatedHostsClient.BeginDelete.

type DedicatedHostsClientGetOptions

type DedicatedHostsClientGetOptions struct {
	// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated
	// host. 'UserData' is not supported for dedicated host.
	Expand *InstanceViewTypes
}

DedicatedHostsClientGetOptions contains the optional parameters for the DedicatedHostsClient.Get method.

type DedicatedHostsClientGetResponse

type DedicatedHostsClientGetResponse struct {
	// Specifies information about the Dedicated host.
	DedicatedHost
}

DedicatedHostsClientGetResponse contains the response from method DedicatedHostsClient.Get.

type DedicatedHostsClientListAvailableSizesOptions

type DedicatedHostsClientListAvailableSizesOptions struct {
}

DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager method.

type DedicatedHostsClientListAvailableSizesResponse

type DedicatedHostsClientListAvailableSizesResponse struct {
	// The List Dedicated Host sizes operation response.
	DedicatedHostSizeListResult
}

DedicatedHostsClientListAvailableSizesResponse contains the response from method DedicatedHostsClient.NewListAvailableSizesPager.

type DedicatedHostsClientListByHostGroupOptions

type DedicatedHostsClientListByHostGroupOptions struct {
}

DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.NewListByHostGroupPager method.

type DedicatedHostsClientListByHostGroupResponse

type DedicatedHostsClientListByHostGroupResponse struct {
	// The list dedicated host operation response.
	DedicatedHostListResult
}

DedicatedHostsClientListByHostGroupResponse contains the response from method DedicatedHostsClient.NewListByHostGroupPager.

type DedicatedHostsClientRedeployResponse

type DedicatedHostsClientRedeployResponse struct {
}

DedicatedHostsClientRedeployResponse contains the response from method DedicatedHostsClient.BeginRedeploy.

type DedicatedHostsClientRestartResponse

type DedicatedHostsClientRestartResponse struct {
}

DedicatedHostsClientRestartResponse contains the response from method DedicatedHostsClient.BeginRestart.

type DedicatedHostsClientUpdateResponse

type DedicatedHostsClientUpdateResponse struct {
	// Specifies information about the Dedicated host.
	DedicatedHost
}

DedicatedHostsClientUpdateResponse contains the response from method DedicatedHostsClient.BeginUpdate.

type DefaultVirtualMachineScaleSetInfo

type DefaultVirtualMachineScaleSetInfo struct {
	// READ-ONLY; Indicates if the the maximum capacity of the default migrated Virtual Machine Scale Set after its migration
	// will be constrained to a limited number of VMs.
	ConstrainedMaximumCapacity *bool

	// READ-ONLY; The default Virtual Machine ScaleSet Uri that the Availability Set will be moved to upon triggering a seamless
	// migration via the ConvertToVirtualMachineScaleSet API.
	DefaultVirtualMachineScaleSet *SubResource
}

DefaultVirtualMachineScaleSetInfo - Indicates the target Virtual Machine ScaleSet properties upon triggering a seamless migration without downtime of the VMs via the ConvertToVirtualMachineScaleSet API.

func (DefaultVirtualMachineScaleSetInfo) MarshalJSON

func (d DefaultVirtualMachineScaleSetInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DefaultVirtualMachineScaleSetInfo.

func (*DefaultVirtualMachineScaleSetInfo) UnmarshalJSON

func (d *DefaultVirtualMachineScaleSetInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DefaultVirtualMachineScaleSetInfo.

type DeleteOptions

type DeleteOptions string

DeleteOptions - Specify what happens to the network interface when the VM is deleted

const (
	DeleteOptionsDelete DeleteOptions = "Delete"
	DeleteOptionsDetach DeleteOptions = "Detach"
)

func PossibleDeleteOptionsValues

func PossibleDeleteOptionsValues() []DeleteOptions

PossibleDeleteOptionsValues returns the possible values for the DeleteOptions const type.

type DiagnosticsProfile

type DiagnosticsProfile struct {
	// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. NOTE:
	// If storageUri is being specified then ensure that the storage account is in
	// the same region and subscription as the VM. You can easily view the output of your console log. Azure also enables you
	// to see a screenshot of the VM from the hypervisor.
	BootDiagnostics *BootDiagnostics
}

DiagnosticsProfile - Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15.

func (DiagnosticsProfile) MarshalJSON

func (d DiagnosticsProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiagnosticsProfile.

func (*DiagnosticsProfile) UnmarshalJSON

func (d *DiagnosticsProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsProfile.

type DiffDiskOptions

type DiffDiskOptions string

DiffDiskOptions - Specifies the ephemeral disk option for operating system disk.

const (
	DiffDiskOptionsLocal DiffDiskOptions = "Local"
)

func PossibleDiffDiskOptionsValues

func PossibleDiffDiskOptionsValues() []DiffDiskOptions

PossibleDiffDiskOptionsValues returns the possible values for the DiffDiskOptions const type.

type DiffDiskPlacement

type DiffDiskPlacement string

DiffDiskPlacement - Specifies the ephemeral disk placement for operating system disk. This property can be used by user in the request to choose the location i.e, cache disk, resource disk or nvme disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS disk size requirements for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Minimum api-version for NvmeDisk: 2024-03-01.

const (
	DiffDiskPlacementCacheDisk    DiffDiskPlacement = "CacheDisk"
	DiffDiskPlacementNvmeDisk     DiffDiskPlacement = "NvmeDisk"
	DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk"
)

func PossibleDiffDiskPlacementValues

func PossibleDiffDiskPlacementValues() []DiffDiskPlacement

PossibleDiffDiskPlacementValues returns the possible values for the DiffDiskPlacement const type.

type DiffDiskSettings

type DiffDiskSettings struct {
	// Specifies the ephemeral disk settings for operating system disk.
	Option *DiffDiskOptions

	// Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk, NvmeDisk.
	// The defaulting behavior is: CacheDisk if one is configured for the VM size
	// otherwise ResourceDisk or NvmeDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes
	// and Linux VM at
	// https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Minimum api-version
	// for NvmeDisk: 2024-03-01.
	Placement *DiffDiskPlacement
}

DiffDiskSettings - Describes the parameters of ephemeral disk settings that can be specified for operating system disk. Note: The ephemeral disk settings can only be specified for managed disk.

func (DiffDiskSettings) MarshalJSON

func (d DiffDiskSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiffDiskSettings.

func (*DiffDiskSettings) UnmarshalJSON

func (d *DiffDiskSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiffDiskSettings.

type Disallowed

type Disallowed struct {
	// A list of disk types.
	DiskTypes []*string
}

Disallowed - Describes the disallowed disk types.

func (Disallowed) MarshalJSON

func (d Disallowed) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Disallowed.

func (*Disallowed) UnmarshalJSON

func (d *Disallowed) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Disallowed.

type DisallowedConfiguration

type DisallowedConfiguration struct {
	// VM disk types which are disallowed.
	VMDiskType *VMDiskTypes
}

DisallowedConfiguration - Specifies the disallowed configuration for a virtual machine image.

func (DisallowedConfiguration) MarshalJSON

func (d DisallowedConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DisallowedConfiguration.

func (*DisallowedConfiguration) UnmarshalJSON

func (d *DisallowedConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DisallowedConfiguration.

type Disk

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

	// The extended location where the disk will be created. Extended location cannot be changed.
	ExtendedLocation *ExtendedLocation

	// Disk resource properties.
	Properties *DiskProperties

	// The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS.
	SKU *DiskSKU

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

	// The Logical zone list for Disk.
	Zones []*string

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

	// READ-ONLY; A relative URI containing the ID of the VM that has the disk attached.
	ManagedBy *string

	// READ-ONLY; List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to
	// a value greater than one for disks to allow attaching them to multiple VMs.
	ManagedByExtended []*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
}

Disk resource.

func (Disk) MarshalJSON

func (d Disk) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Disk.

func (*Disk) UnmarshalJSON

func (d *Disk) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Disk.

type DiskAccess

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

	// The extended location where the disk access will be created. Extended location cannot be changed.
	ExtendedLocation *ExtendedLocation
	Properties       *DiskAccessProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

DiskAccess - disk access resource.

func (DiskAccess) MarshalJSON

func (d DiskAccess) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskAccess.

func (*DiskAccess) UnmarshalJSON

func (d *DiskAccess) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccess.

type DiskAccessList

type DiskAccessList struct {
	// REQUIRED; The DiskAccess items on this page
	Value []*DiskAccess

	// The link to the next page of items
	NextLink *string
}

DiskAccessList - The List disk access operation response.

func (DiskAccessList) MarshalJSON

func (d DiskAccessList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskAccessList.

func (*DiskAccessList) UnmarshalJSON

func (d *DiskAccessList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessList.

type DiskAccessProperties

type DiskAccessProperties struct {
	// READ-ONLY; A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection
	// is supported.
	PrivateEndpointConnections []*PrivateEndpointConnection

	// READ-ONLY; The disk access resource provisioning state.
	ProvisioningState *string

	// READ-ONLY; The time when the disk access was created.
	TimeCreated *time.Time
}

func (DiskAccessProperties) MarshalJSON

func (d DiskAccessProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskAccessProperties.

func (*DiskAccessProperties) UnmarshalJSON

func (d *DiskAccessProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessProperties.

type DiskAccessUpdate

type DiskAccessUpdate struct {
	// Resource tags
	Tags map[string]*string
}

DiskAccessUpdate - Used for updating a disk access resource.

func (DiskAccessUpdate) MarshalJSON

func (d DiskAccessUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskAccessUpdate.

func (*DiskAccessUpdate) UnmarshalJSON

func (d *DiskAccessUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessUpdate.

type DiskAccessesClient

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

DiskAccessesClient contains the methods for the DiskAccesses group. Don't use this type directly, use NewDiskAccessesClient() instead.

func NewDiskAccessesClient

func NewDiskAccessesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskAccessesClient, error)

NewDiskAccessesClient creates a new instance of DiskAccessesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DiskAccessesClient) BeginCreateOrUpdate

func (client *DiskAccessesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesClientBeginCreateOrUpdateOptions) (*runtime.Poller[DiskAccessesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Creates or updates a disk access resource If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • diskAccess - disk access object supplied in the body of the Put disk access operation.
  • options - DiskAccessesClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskAccessesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccess{
		Location: to.Ptr("West US"),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskAccess = armcompute.DiskAccess{
	// 	Name: to.Ptr("myDiskAccess"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskAccessProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
	// 	},
	// }
}

func (*DiskAccessesClient) BeginDelete

func (client *DiskAccessesClient) BeginDelete(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientBeginDeleteOptions) (*runtime.Poller[DiskAccessesClientDeleteResponse], error)

BeginDelete - Deletes a disk access resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskAccessesClientBeginDeleteOptions contains the optional parameters for the DiskAccessesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskAccessesClient().BeginDelete(ctx, "myResourceGroup", "myDiskAccess", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DiskAccessesClient) BeginDeleteAPrivateEndpointConnection

func (client *DiskAccessesClient) BeginDeleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions) (*runtime.Poller[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse], error)

BeginDeleteAPrivateEndpointConnection - Deletes a private endpoint connection under a disk access resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • privateEndpointConnectionName - The name of the private endpoint connection.
  • options - DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginDeleteAPrivateEndpointConnection method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskAccessesClient().BeginDeleteAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DiskAccessesClient) BeginUpdate

func (client *DiskAccessesClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesClientBeginUpdateOptions) (*runtime.Poller[DiskAccessesClientUpdateResponse], error)

BeginUpdate - Updates (patches) a disk access resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • diskAccess - disk access object supplied in the body of the Patch disk access operation.
  • options - DiskAccessesClientBeginUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskAccessesClient().BeginUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccessUpdate{
		Tags: map[string]*string{
			"department": to.Ptr("Development"),
			"project":    to.Ptr("PrivateEndpoints"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskAccess = armcompute.DiskAccess{
	// 	Name: to.Ptr("myDiskAccess"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
	// 	Location: to.Ptr("West US"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("PrivateEndpoints"),
	// 	},
	// }
}

func (*DiskAccessesClient) BeginUpdateAPrivateEndpointConnection

func (client *DiskAccessesClient) BeginUpdateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions) (*runtime.Poller[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse], error)

BeginUpdateAPrivateEndpointConnection - Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • privateEndpointConnectionName - The name of the private endpoint connection.
  • privateEndpointConnection - private endpoint connection object supplied in the body of the Put private endpoint connection operation.
  • options - DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginUpdateAPrivateEndpointConnection method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskAccessesClient().BeginUpdateAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", armcompute.PrivateEndpointConnection{
		Properties: &armcompute.PrivateEndpointConnectionProperties{
			PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
				Description: to.Ptr("Approving myPrivateEndpointConnection"),
				Status:      to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{
	// 	Name: to.Ptr("myPrivateEndpointConnectionName"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnectionName"),
	// 	Properties: &armcompute.PrivateEndpointConnectionProperties{
	// 		PrivateEndpoint: &armcompute.PrivateEndpoint{
	// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"),
	// 		},
	// 		PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
	// 			Description: to.Ptr("Approving myPrivateEndpointConnection"),
	// 			ActionsRequired: to.Ptr("None"),
	// 			Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
	// 	},
	// }
}

func (*DiskAccessesClient) Get

func (client *DiskAccessesClient) Get(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetOptions) (DiskAccessesClientGetResponse, error)

Get - Gets information about a disk access resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskAccessesClientGetOptions contains the optional parameters for the DiskAccessesClient.Get method.
Example (GetInformationAboutADiskAccessResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", 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.DiskAccess = armcompute.DiskAccess{
	// 	Name: to.Ptr("myDiskAccess"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("PrivateEndpoints"),
	// 	},
	// 	Properties: &armcompute.DiskAccessProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
	// 	},
	// }
}
Example (GetInformationAboutADiskAccessResourceWithPrivateEndpoints)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", 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.DiskAccess = armcompute.DiskAccess{
	// 	Name: to.Ptr("myDiskAccess"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("PrivateEndpoints"),
	// 	},
	// 	Properties: &armcompute.DiskAccessProperties{
	// 		PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{
	// 			{
	// 				Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
	// 				Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
	// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
	// 				Properties: &armcompute.PrivateEndpointConnectionProperties{
	// 					PrivateEndpoint: &armcompute.PrivateEndpoint{
	// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"),
	// 					},
	// 					PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
	// 						Description: to.Ptr("Auto-Approved"),
	// 						ActionsRequired: to.Ptr("None"),
	// 						Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
	// 					},
	// 					ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
	// 				},
	// 		}},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
	// 	},
	// }
}

func (*DiskAccessesClient) GetAPrivateEndpointConnection

func (client *DiskAccessesClient) GetAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientGetAPrivateEndpointConnectionOptions) (DiskAccessesClientGetAPrivateEndpointConnectionResponse, error)

GetAPrivateEndpointConnection - Gets information about a private endpoint connection under a disk access resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • privateEndpointConnectionName - The name of the private endpoint connection.
  • options - DiskAccessesClientGetAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.GetAPrivateEndpointConnection method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskAccessesClient().GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", 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.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{
	// 	Name: to.Ptr("myPrivateEndpointConnection"),
	// 	Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"),
	// 	Properties: &armcompute.PrivateEndpointConnectionProperties{
	// 		PrivateEndpoint: &armcompute.PrivateEndpoint{
	// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"),
	// 		},
	// 		PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
	// 			Description: to.Ptr("Auto-Approved"),
	// 			ActionsRequired: to.Ptr("None"),
	// 			Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
	// 	},
	// }
}

func (*DiskAccessesClient) GetPrivateLinkResources

func (client *DiskAccessesClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetPrivateLinkResourcesOptions) (DiskAccessesClientGetPrivateLinkResourcesResponse, error)

GetPrivateLinkResources - Gets the private link resources possible under disk access resource If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskAccessesClientGetPrivateLinkResourcesOptions contains the optional parameters for the DiskAccessesClient.GetPrivateLinkResources method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskAccessesClient().GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", 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.PrivateLinkResourceListResult = armcompute.PrivateLinkResourceListResult{
	// 	Value: []*armcompute.PrivateLinkResource{
	// 		{
	// 			Name: to.Ptr("disks"),
	// 			Type: to.Ptr("Microsoft.Compute/diskAccesses/privateLinkResources"),
	// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateLinkResources/disks"),
	// 			Properties: &armcompute.PrivateLinkResourceProperties{
	// 				GroupID: to.Ptr("disks"),
	// 				RequiredMembers: []*string{
	// 					to.Ptr("diskAccess_1")},
	// 					RequiredZoneNames: []*string{
	// 						to.Ptr("privatelink.blob.core.windows.net")},
	// 					},
	// 			}},
	// 		}
}

func (*DiskAccessesClient) NewListByResourceGroupPager

NewListByResourceGroupPager - Lists all the disk access resources under a resource group.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - DiskAccessesClientListByResourceGroupOptions contains the optional parameters for the DiskAccessesClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskAccessesClient().NewListByResourceGroupPager("myResourceGroup", 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.DiskAccessList = armcompute.DiskAccessList{
		// 	Value: []*armcompute.DiskAccess{
		// 		{
		// 			Name: to.Ptr("myDiskAccess"),
		// 			Type: to.Ptr("Microsoft.Compute/diskAccesses"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("PrivateEndpoints"),
		// 			},
		// 			Properties: &armcompute.DiskAccessProperties{
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myDiskAccess2"),
		// 			Type: to.Ptr("Microsoft.Compute/diskAccesses"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("PrivateEndpoints"),
		// 			},
		// 			Properties: &armcompute.DiskAccessProperties{
		// 				PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{
		// 					{
		// 						Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
		// 						Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
		// 						Properties: &armcompute.PrivateEndpointConnectionProperties{
		// 							PrivateEndpoint: &armcompute.PrivateEndpoint{
		// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"),
		// 							},
		// 							PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
		// 								Description: to.Ptr("Auto-Approved"),
		// 								ActionsRequired: to.Ptr("None"),
		// 								Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
		// 							},
		// 							ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
		// 						},
		// 				}},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}

func (*DiskAccessesClient) NewListPager

NewListPager - Lists all the disk access resources under a subscription.

Generated from API version 2025-01-02

  • options - DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskAccessesClient().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.DiskAccessList = armcompute.DiskAccessList{
		// 	Value: []*armcompute.DiskAccess{
		// 		{
		// 			Name: to.Ptr("myDiskAccess"),
		// 			Type: to.Ptr("Microsoft.Compute/diskAccesses"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("PrivateEndpoints"),
		// 			},
		// 			Properties: &armcompute.DiskAccessProperties{
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myDiskAccess2"),
		// 			Type: to.Ptr("Microsoft.Compute/diskAccesses"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("PrivateEndpoints"),
		// 			},
		// 			Properties: &armcompute.DiskAccessProperties{
		// 				PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{
		// 					{
		// 						Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
		// 						Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
		// 						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"),
		// 						Properties: &armcompute.PrivateEndpointConnectionProperties{
		// 							PrivateEndpoint: &armcompute.PrivateEndpoint{
		// 								ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"),
		// 							},
		// 							PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
		// 								Description: to.Ptr("Auto-Approved"),
		// 								ActionsRequired: to.Ptr("None"),
		// 								Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
		// 							},
		// 							ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
		// 						},
		// 				}},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}

func (*DiskAccessesClient) NewListPrivateEndpointConnectionsPager

func (client *DiskAccessesClient) NewListPrivateEndpointConnectionsPager(resourceGroupName string, diskAccessName string, options *DiskAccessesClientListPrivateEndpointConnectionsOptions) *runtime.Pager[DiskAccessesClientListPrivateEndpointConnectionsResponse]

NewListPrivateEndpointConnectionsPager - List information about private endpoint connections under a disk access resource

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskAccessesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the DiskAccessesClient.NewListPrivateEndpointConnectionsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskAccessesClient().NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", 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.PrivateEndpointConnectionListResult = armcompute.PrivateEndpointConnectionListResult{
		// 	Value: []*armcompute.PrivateEndpointConnection{
		// 		{
		// 			Name: to.Ptr("myPrivateEndpointConnection"),
		// 			Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"),
		// 			Properties: &armcompute.PrivateEndpointConnectionProperties{
		// 				PrivateEndpoint: &armcompute.PrivateEndpoint{
		// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"),
		// 				},
		// 				PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
		// 					Description: to.Ptr("Auto-Approved"),
		// 					ActionsRequired: to.Ptr("None"),
		// 					Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
		// 				},
		// 				ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}

type DiskAccessesClientBeginCreateOrUpdateOptions

type DiskAccessesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskAccessesClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginCreateOrUpdate method.

type DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions

type DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginDeleteAPrivateEndpointConnection method.

type DiskAccessesClientBeginDeleteOptions

type DiskAccessesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskAccessesClientBeginDeleteOptions contains the optional parameters for the DiskAccessesClient.BeginDelete method.

type DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions

type DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginUpdateAPrivateEndpointConnection method.

type DiskAccessesClientBeginUpdateOptions

type DiskAccessesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskAccessesClientBeginUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginUpdate method.

type DiskAccessesClientCreateOrUpdateResponse

type DiskAccessesClientCreateOrUpdateResponse struct {
	// disk access resource.
	DiskAccess
}

DiskAccessesClientCreateOrUpdateResponse contains the response from method DiskAccessesClient.BeginCreateOrUpdate.

type DiskAccessesClientDeleteAPrivateEndpointConnectionResponse

type DiskAccessesClientDeleteAPrivateEndpointConnectionResponse struct {
}

DiskAccessesClientDeleteAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.BeginDeleteAPrivateEndpointConnection.

type DiskAccessesClientDeleteResponse

type DiskAccessesClientDeleteResponse struct {
}

DiskAccessesClientDeleteResponse contains the response from method DiskAccessesClient.BeginDelete.

type DiskAccessesClientGetAPrivateEndpointConnectionOptions

type DiskAccessesClientGetAPrivateEndpointConnectionOptions struct {
}

DiskAccessesClientGetAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.GetAPrivateEndpointConnection method.

type DiskAccessesClientGetAPrivateEndpointConnectionResponse

type DiskAccessesClientGetAPrivateEndpointConnectionResponse struct {
	// The Private Endpoint Connection resource.
	PrivateEndpointConnection
}

DiskAccessesClientGetAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.GetAPrivateEndpointConnection.

type DiskAccessesClientGetOptions

type DiskAccessesClientGetOptions struct {
}

DiskAccessesClientGetOptions contains the optional parameters for the DiskAccessesClient.Get method.

type DiskAccessesClientGetPrivateLinkResourcesOptions

type DiskAccessesClientGetPrivateLinkResourcesOptions struct {
}

DiskAccessesClientGetPrivateLinkResourcesOptions contains the optional parameters for the DiskAccessesClient.GetPrivateLinkResources method.

type DiskAccessesClientGetPrivateLinkResourcesResponse

type DiskAccessesClientGetPrivateLinkResourcesResponse struct {
	// A list of private link resources
	PrivateLinkResourceListResult
}

DiskAccessesClientGetPrivateLinkResourcesResponse contains the response from method DiskAccessesClient.GetPrivateLinkResources.

type DiskAccessesClientGetResponse

type DiskAccessesClientGetResponse struct {
	// disk access resource.
	DiskAccess
}

DiskAccessesClientGetResponse contains the response from method DiskAccessesClient.Get.

type DiskAccessesClientListByResourceGroupOptions

type DiskAccessesClientListByResourceGroupOptions struct {
}

DiskAccessesClientListByResourceGroupOptions contains the optional parameters for the DiskAccessesClient.NewListByResourceGroupPager method.

type DiskAccessesClientListByResourceGroupResponse

type DiskAccessesClientListByResourceGroupResponse struct {
	// The List disk access operation response.
	DiskAccessList
}

DiskAccessesClientListByResourceGroupResponse contains the response from method DiskAccessesClient.NewListByResourceGroupPager.

type DiskAccessesClientListOptions

type DiskAccessesClientListOptions struct {
}

DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.NewListPager method.

type DiskAccessesClientListPrivateEndpointConnectionsOptions

type DiskAccessesClientListPrivateEndpointConnectionsOptions struct {
}

DiskAccessesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the DiskAccessesClient.NewListPrivateEndpointConnectionsPager method.

type DiskAccessesClientListPrivateEndpointConnectionsResponse

type DiskAccessesClientListPrivateEndpointConnectionsResponse struct {
	// A list of private link resources
	PrivateEndpointConnectionListResult
}

DiskAccessesClientListPrivateEndpointConnectionsResponse contains the response from method DiskAccessesClient.NewListPrivateEndpointConnectionsPager.

type DiskAccessesClientListResponse

type DiskAccessesClientListResponse struct {
	// The List disk access operation response.
	DiskAccessList
}

DiskAccessesClientListResponse contains the response from method DiskAccessesClient.NewListPager.

type DiskAccessesClientUpdateAPrivateEndpointConnectionResponse

type DiskAccessesClientUpdateAPrivateEndpointConnectionResponse struct {
	// The Private Endpoint Connection resource.
	PrivateEndpointConnection
}

DiskAccessesClientUpdateAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.BeginUpdateAPrivateEndpointConnection.

type DiskAccessesClientUpdateResponse

type DiskAccessesClientUpdateResponse struct {
	// disk access resource.
	DiskAccess
}

DiskAccessesClientUpdateResponse contains the response from method DiskAccessesClient.BeginUpdate.

type DiskControllerTypes

type DiskControllerTypes string

DiskControllerTypes - Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.

const (
	DiskControllerTypesNVMe DiskControllerTypes = "NVMe"
	DiskControllerTypesSCSI DiskControllerTypes = "SCSI"
)

func PossibleDiskControllerTypesValues

func PossibleDiskControllerTypesValues() []DiskControllerTypes

PossibleDiskControllerTypesValues returns the possible values for the DiskControllerTypes const type.

type DiskCreateOption

type DiskCreateOption string

DiskCreateOption - This enumerates the possible sources of a disk's creation.

const (
	// DiskCreateOptionAttach - Disk will be attached to a VM.
	DiskCreateOptionAttach DiskCreateOption = "Attach"
	// DiskCreateOptionCopy - Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId.
	DiskCreateOptionCopy DiskCreateOption = "Copy"
	// DiskCreateOptionCopyFromSanSnapshot - Create a new disk by exporting from elastic san volume snapshot
	DiskCreateOptionCopyFromSanSnapshot DiskCreateOption = "CopyFromSanSnapshot"
	// DiskCreateOptionCopyStart - Create a new disk by using a deep copy process, where the resource creation is considered complete
	// only after all data has been copied from the source.
	DiskCreateOptionCopyStart DiskCreateOption = "CopyStart"
	// DiskCreateOptionEmpty - Create an empty data disk of a size given by diskSizeGB.
	DiskCreateOptionEmpty DiskCreateOption = "Empty"
	// DiskCreateOptionFromImage - Create a new disk from a platform image specified by the given imageReference or galleryImageReference.
	DiskCreateOptionFromImage DiskCreateOption = "FromImage"
	// DiskCreateOptionImport - Create a disk by importing from a blob specified by a sourceUri in a storage account specified
	// by storageAccountId.
	DiskCreateOptionImport DiskCreateOption = "Import"
	// DiskCreateOptionImportSecure - Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported
	// disk by importing additional blobs for VM guest state specified by securityDataUri and VM metadata specified by securityMetadataUri
	// in storage account specified by storageAccountId. The VM metadata is optional and only required for certain Confidential
	// VM configurations and not required for Trusted Launch VM.
	DiskCreateOptionImportSecure DiskCreateOption = "ImportSecure"
	// DiskCreateOptionRestore - Create a new disk by copying from a backup recovery point.
	DiskCreateOptionRestore DiskCreateOption = "Restore"
	// DiskCreateOptionUpload - Create a new disk by obtaining a write token and using it to directly upload the contents of the
	// disk.
	DiskCreateOptionUpload DiskCreateOption = "Upload"
	// DiskCreateOptionUploadPreparedSecure - Similar to Upload create option. Create a new Trusted Launch VM or Confidential
	// VM supported disk and upload using write token in disk, VM guest state and VM metadata. The VM metadata is optional and
	// only required for certain Confidential VM configurations and not required for Trusted Launch VM.
	DiskCreateOptionUploadPreparedSecure DiskCreateOption = "UploadPreparedSecure"
)

func PossibleDiskCreateOptionValues

func PossibleDiskCreateOptionValues() []DiskCreateOption

PossibleDiskCreateOptionValues returns the possible values for the DiskCreateOption const type.

type DiskCreateOptionTypes

type DiskCreateOptionTypes string

DiskCreateOptionTypes - Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when you are using a specialized disk to create the virtual machine. FromImage: This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described. Empty: This value is used when creating an empty data disk. Copy: This value is used to create a data disk from a snapshot or another disk. Restore: This value is used to create a data disk from a disk restore point.

const (
	DiskCreateOptionTypesAttach    DiskCreateOptionTypes = "Attach"
	DiskCreateOptionTypesCopy      DiskCreateOptionTypes = "Copy"
	DiskCreateOptionTypesEmpty     DiskCreateOptionTypes = "Empty"
	DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage"
	DiskCreateOptionTypesRestore   DiskCreateOptionTypes = "Restore"
)

func PossibleDiskCreateOptionTypesValues

func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes

PossibleDiskCreateOptionTypesValues returns the possible values for the DiskCreateOptionTypes const type.

type DiskDeleteOptionTypes

type DiskDeleteOptionTypes string

DiskDeleteOptionTypes - Specifies the behavior of the managed disk when the VM gets deleted, for example whether the managed disk is deleted or detached. Supported values are: Delete. If this value is used, the managed disk is deleted when VM gets deleted. Detach. If this value is used, the managed disk is retained after VM gets deleted. Minimum api-version: 2021-03-01.

const (
	DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete"
	DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach"
)

func PossibleDiskDeleteOptionTypesValues

func PossibleDiskDeleteOptionTypesValues() []DiskDeleteOptionTypes

PossibleDiskDeleteOptionTypesValues returns the possible values for the DiskDeleteOptionTypes const type.

type DiskDetachOptionTypes

type DiskDetachOptionTypes string

DiskDetachOptionTypes - Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values are: ForceDetach. detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. This feature is still in preview. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

const (
	DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach"
)

func PossibleDiskDetachOptionTypesValues

func PossibleDiskDetachOptionTypesValues() []DiskDetachOptionTypes

PossibleDiskDetachOptionTypesValues returns the possible values for the DiskDetachOptionTypes const type.

type DiskEncryptionSet

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

	// The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used
	// to encrypt disks.
	Identity   *EncryptionSetIdentity
	Properties *EncryptionSetProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

DiskEncryptionSet - disk encryption set resource.

func (DiskEncryptionSet) MarshalJSON

func (d DiskEncryptionSet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSet.

func (*DiskEncryptionSet) UnmarshalJSON

func (d *DiskEncryptionSet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSet.

type DiskEncryptionSetIdentityType

type DiskEncryptionSetIdentityType string

DiskEncryptionSetIdentityType - The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.

const (
	DiskEncryptionSetIdentityTypeNone                       DiskEncryptionSetIdentityType = "None"
	DiskEncryptionSetIdentityTypeSystemAssigned             DiskEncryptionSetIdentityType = "SystemAssigned"
	DiskEncryptionSetIdentityTypeSystemAssignedUserAssigned DiskEncryptionSetIdentityType = "SystemAssigned, UserAssigned"
	DiskEncryptionSetIdentityTypeUserAssigned               DiskEncryptionSetIdentityType = "UserAssigned"
)

func PossibleDiskEncryptionSetIdentityTypeValues

func PossibleDiskEncryptionSetIdentityTypeValues() []DiskEncryptionSetIdentityType

PossibleDiskEncryptionSetIdentityTypeValues returns the possible values for the DiskEncryptionSetIdentityType const type.

type DiskEncryptionSetList

type DiskEncryptionSetList struct {
	// REQUIRED; The DiskEncryptionSet items on this page
	Value []*DiskEncryptionSet

	// The link to the next page of items
	NextLink *string
}

DiskEncryptionSetList - The List disk encryption set operation response.

func (DiskEncryptionSetList) MarshalJSON

func (d DiskEncryptionSetList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetList.

func (*DiskEncryptionSetList) UnmarshalJSON

func (d *DiskEncryptionSetList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetList.

type DiskEncryptionSetParameters

type DiskEncryptionSetParameters struct {
	// Resource Id
	ID *string
}

DiskEncryptionSetParameters - Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.

func (DiskEncryptionSetParameters) MarshalJSON

func (d DiskEncryptionSetParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetParameters.

func (*DiskEncryptionSetParameters) UnmarshalJSON

func (d *DiskEncryptionSetParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetParameters.

type DiskEncryptionSetType

type DiskEncryptionSetType string

DiskEncryptionSetType - The type of key used to encrypt the data of the disk.

const (
	// DiskEncryptionSetTypeConfidentialVMEncryptedWithCustomerKey - Confidential VM supported disk and VM guest state would be
	// encrypted with customer managed key.
	DiskEncryptionSetTypeConfidentialVMEncryptedWithCustomerKey DiskEncryptionSetType = "ConfidentialVmEncryptedWithCustomerKey"
	// DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey - Resource using diskEncryptionSet would be encrypted at rest with
	// Customer managed key that can be changed and revoked by a customer.
	DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey DiskEncryptionSetType = "EncryptionAtRestWithCustomerKey"
	// DiskEncryptionSetTypeEncryptionAtRestWithPlatformAndCustomerKeys - Resource using diskEncryptionSet would be encrypted
	// at rest with two layers of encryption. One of the keys is Customer managed and the other key is Platform managed.
	DiskEncryptionSetTypeEncryptionAtRestWithPlatformAndCustomerKeys DiskEncryptionSetType = "EncryptionAtRestWithPlatformAndCustomerKeys"
)

func PossibleDiskEncryptionSetTypeValues

func PossibleDiskEncryptionSetTypeValues() []DiskEncryptionSetType

PossibleDiskEncryptionSetTypeValues returns the possible values for the DiskEncryptionSetType const type.

type DiskEncryptionSetUpdate

type DiskEncryptionSetUpdate struct {
	// The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used
	// to encrypt disks.
	Identity *EncryptionSetIdentity

	// disk encryption set resource update properties.
	Properties *DiskEncryptionSetUpdateProperties

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

DiskEncryptionSetUpdate - disk encryption set update resource.

func (DiskEncryptionSetUpdate) MarshalJSON

func (d DiskEncryptionSetUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetUpdate.

func (*DiskEncryptionSetUpdate) UnmarshalJSON

func (d *DiskEncryptionSetUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetUpdate.

type DiskEncryptionSetUpdateProperties

type DiskEncryptionSetUpdateProperties struct {
	// Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots
	ActiveKey *KeyForDiskEncryptionSet

	// The type of key used to encrypt the data of the disk.
	EncryptionType *DiskEncryptionSetType

	// Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the
	// property.
	FederatedClientID *string

	// Set this flag to true to enable auto-updating of this disk encryption set to the latest key version.
	RotationToLatestKeyVersionEnabled *bool
}

DiskEncryptionSetUpdateProperties - disk encryption set resource update properties.

func (DiskEncryptionSetUpdateProperties) MarshalJSON

func (d DiskEncryptionSetUpdateProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetUpdateProperties.

func (*DiskEncryptionSetUpdateProperties) UnmarshalJSON

func (d *DiskEncryptionSetUpdateProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetUpdateProperties.

type DiskEncryptionSetsClient

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

DiskEncryptionSetsClient contains the methods for the DiskEncryptionSets group. Don't use this type directly, use NewDiskEncryptionSetsClient() instead.

func NewDiskEncryptionSetsClient

func NewDiskEncryptionSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskEncryptionSetsClient, error)

NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DiskEncryptionSetsClient) BeginCreateOrUpdate

func (client *DiskEncryptionSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DiskEncryptionSetsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Creates or updates a disk encryption set If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • diskEncryptionSet - disk encryption set object supplied in the body of the Put disk encryption set operation.
  • options - DiskEncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginCreateOrUpdate method.
Example (CreateADiskEncryptionSet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
		Location: to.Ptr("West US"),
		Identity: &armcompute.EncryptionSetIdentity{
			Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		},
		Properties: &armcompute.EncryptionSetProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
				SourceVault: &armcompute.SourceVault{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
				},
			},
			EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
	// 			SourceVault: &armcompute.SourceVault{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 			},
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 	},
	// }
}
Example (CreateADiskEncryptionSetWithKeyVaultFromADifferentSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
		Location: to.Ptr("West US"),
		Identity: &armcompute.EncryptionSetIdentity{
			Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		},
		Properties: &armcompute.EncryptionSetProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"),
			},
			EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"),
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 	},
	// }
}
Example (CreateADiskEncryptionSetWithKeyVaultFromADifferentTenant)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
		Location: to.Ptr("West US"),
		Identity: &armcompute.EncryptionSetIdentity{
			Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned),
			UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
				"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {},
			},
		},
		Properties: &armcompute.EncryptionSetProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"),
			},
			EncryptionType:    to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
			FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned),
	// 		UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
	// 			"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": &armcompute.UserAssignedIdentitiesValue{
	// 			},
	// 		},
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"),
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 	},
	// }
}

func (*DiskEncryptionSetsClient) BeginDelete

func (client *DiskEncryptionSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientBeginDeleteOptions) (*runtime.Poller[DiskEncryptionSetsClientDeleteResponse], error)

BeginDelete - Deletes a disk encryption set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskEncryptionSetsClientBeginDeleteOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginDelete(ctx, "myResourceGroup", "myDiskEncryptionSet", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DiskEncryptionSetsClient) BeginUpdate

func (client *DiskEncryptionSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*runtime.Poller[DiskEncryptionSetsClientUpdateResponse], error)

BeginUpdate - Updates (patches) a disk encryption set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • diskEncryptionSet - disk encryption set object supplied in the body of the Patch disk encryption set operation.
  • options - DiskEncryptionSetsClientBeginUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginUpdate method.
Example (UpdateADiskEncryptionSet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
		Properties: &armcompute.DiskEncryptionSetUpdateProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"),
				SourceVault: &armcompute.SourceVault{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
				},
			},
			EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		},
		Tags: map[string]*string{
			"department": to.Ptr("Development"),
			"project":    to.Ptr("Encryption"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("Encryption"),
	// 	},
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"),
	// 			SourceVault: &armcompute.SourceVault{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 			},
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 	},
	// }
}
Example (UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
		Identity: &armcompute.EncryptionSetIdentity{
			Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		},
		Properties: &armcompute.DiskEncryptionSetUpdateProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"),
			},
			EncryptionType:                    to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
			RotationToLatestKeyVersionEnabled: to.Ptr(true),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/KeyVersion2"),
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RotationToLatestKeyVersionEnabled: to.Ptr(true),
	// 	},
	// }
}
Example (UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
		Identity: &armcompute.EncryptionSetIdentity{
			Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		},
		Properties: &armcompute.DiskEncryptionSetUpdateProperties{
			ActiveKey: &armcompute.KeyForDiskEncryptionSet{
				KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"),
			},
			EncryptionType:                    to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
			RotationToLatestKeyVersionEnabled: to.Ptr(true),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion2"),
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 			{
	// 				KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"),
	// 		}},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RotationToLatestKeyVersionEnabled: to.Ptr(true),
	// 	},
	// }
}

func (*DiskEncryptionSetsClient) Get

func (client *DiskEncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientGetOptions) (DiskEncryptionSetsClientGetResponse, error)

Get - Gets information about a disk encryption set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskEncryptionSetsClientGetOptions contains the optional parameters for the DiskEncryptionSetsClient.Get method.
Example (GetInformationAboutADiskEncryptionSet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", 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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("Encryption"),
	// 	},
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
	// 			SourceVault: &armcompute.SourceVault{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 			},
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (GetInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", 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.DiskEncryptionSet = armcompute.DiskEncryptionSet{
	// 	Name: to.Ptr("myDiskEncryptionSet"),
	// 	Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("Encryption"),
	// 	},
	// 	Identity: &armcompute.EncryptionSetIdentity{
	// 		Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
	// 	},
	// 	Properties: &armcompute.EncryptionSetProperties{
	// 		ActiveKey: &armcompute.KeyForDiskEncryptionSet{
	// 			KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
	// 			SourceVault: &armcompute.SourceVault{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 			},
	// 		},
	// 		AutoKeyRotationError: &armcompute.APIError{
	// 			Code: to.Ptr("ManagedServiceIdentityNotFound"),
	// 			Message: to.Ptr("Auto-key rotation was disabled as managed service identity associated with DiskEncryptionSet 'myDiskEncryptionSet' was not found. Please update the resource with correct identity to re-enable auto-key rotation."),
	// 		},
	// 		EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
	// 		PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		RotationToLatestKeyVersionEnabled: to.Ptr(true),
	// 	},
	// }
}

func (*DiskEncryptionSetsClient) NewListAssociatedResourcesPager

func (client *DiskEncryptionSetsClient) NewListAssociatedResourcesPager(resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientListAssociatedResourcesOptions) *runtime.Pager[DiskEncryptionSetsClientListAssociatedResourcesResponse]

NewListAssociatedResourcesPager - Lists all resources that are encrypted with this disk encryption set.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DiskEncryptionSetsClientListAssociatedResourcesOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListAssociatedResourcesPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskEncryptionSetsClient().NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", 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.ResourceURIList = armcompute.ResourceURIList{
		// 	Value: []*string{
		// 		to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
		// 		to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")},
		// 	}
	}
}

func (*DiskEncryptionSetsClient) NewListByResourceGroupPager

NewListByResourceGroupPager - Lists all the disk encryption sets under a resource group.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskEncryptionSetsClient().NewListByResourceGroupPager("myResourceGroup", 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.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{
		// 	Value: []*armcompute.DiskEncryptionSet{
		// 		{
		// 			Name: to.Ptr("myDiskEncryptionSet"),
		// 			Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("Encryption"),
		// 			},
		// 			Identity: &armcompute.EncryptionSetIdentity{
		// 				Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		// 			},
		// 			Properties: &armcompute.EncryptionSetProperties{
		// 				ActiveKey: &armcompute.KeyForDiskEncryptionSet{
		// 					KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 					SourceVault: &armcompute.SourceVault{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 					},
		// 				},
		// 				EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		// 				PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
		// 				},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myDiskEncryptionSet2"),
		// 			Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("Encryption"),
		// 			},
		// 			Identity: &armcompute.EncryptionSetIdentity{
		// 				Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		// 			},
		// 			Properties: &armcompute.EncryptionSetProperties{
		// 				ActiveKey: &armcompute.KeyForDiskEncryptionSet{
		// 					KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 					SourceVault: &armcompute.SourceVault{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"),
		// 					},
		// 				},
		// 				EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		// 				PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
		// 				},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 			},
		// 	}},
		// }
	}
}

func (*DiskEncryptionSetsClient) NewListPager

NewListPager - Lists all the disk encryption sets under a subscription.

Generated from API version 2025-01-02

  • options - DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskEncryptionSetsClient().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.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{
		// 	Value: []*armcompute.DiskEncryptionSet{
		// 		{
		// 			Name: to.Ptr("myDiskEncryptionSet"),
		// 			Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("Encryption"),
		// 			},
		// 			Identity: &armcompute.EncryptionSetIdentity{
		// 				Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		// 			},
		// 			Properties: &armcompute.EncryptionSetProperties{
		// 				ActiveKey: &armcompute.KeyForDiskEncryptionSet{
		// 					KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 					SourceVault: &armcompute.SourceVault{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 					},
		// 				},
		// 				EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		// 				PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
		// 				},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myDiskEncryptionSet2"),
		// 			Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("Encryption"),
		// 			},
		// 			Identity: &armcompute.EncryptionSetIdentity{
		// 				Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
		// 			},
		// 			Properties: &armcompute.EncryptionSetProperties{
		// 				ActiveKey: &armcompute.KeyForDiskEncryptionSet{
		// 					KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 					SourceVault: &armcompute.SourceVault{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"),
		// 					},
		// 				},
		// 				EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
		// 				PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{
		// 				},
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 			},
		// 	}},
		// }
	}
}

type DiskEncryptionSetsClientBeginCreateOrUpdateOptions

type DiskEncryptionSetsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskEncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginCreateOrUpdate method.

type DiskEncryptionSetsClientBeginDeleteOptions

type DiskEncryptionSetsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskEncryptionSetsClientBeginDeleteOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginDelete method.

type DiskEncryptionSetsClientBeginUpdateOptions

type DiskEncryptionSetsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskEncryptionSetsClientBeginUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginUpdate method.

type DiskEncryptionSetsClientCreateOrUpdateResponse

type DiskEncryptionSetsClientCreateOrUpdateResponse struct {
	// disk encryption set resource.
	DiskEncryptionSet
}

DiskEncryptionSetsClientCreateOrUpdateResponse contains the response from method DiskEncryptionSetsClient.BeginCreateOrUpdate.

type DiskEncryptionSetsClientDeleteResponse

type DiskEncryptionSetsClientDeleteResponse struct {
}

DiskEncryptionSetsClientDeleteResponse contains the response from method DiskEncryptionSetsClient.BeginDelete.

type DiskEncryptionSetsClientGetOptions

type DiskEncryptionSetsClientGetOptions struct {
}

DiskEncryptionSetsClientGetOptions contains the optional parameters for the DiskEncryptionSetsClient.Get method.

type DiskEncryptionSetsClientGetResponse

type DiskEncryptionSetsClientGetResponse struct {
	// disk encryption set resource.
	DiskEncryptionSet
}

DiskEncryptionSetsClientGetResponse contains the response from method DiskEncryptionSetsClient.Get.

type DiskEncryptionSetsClientListAssociatedResourcesOptions

type DiskEncryptionSetsClientListAssociatedResourcesOptions struct {
}

DiskEncryptionSetsClientListAssociatedResourcesOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListAssociatedResourcesPager method.

type DiskEncryptionSetsClientListAssociatedResourcesResponse

type DiskEncryptionSetsClientListAssociatedResourcesResponse struct {
	// The List resources which are encrypted with the disk encryption set.
	ResourceURIList
}

DiskEncryptionSetsClientListAssociatedResourcesResponse contains the response from method DiskEncryptionSetsClient.NewListAssociatedResourcesPager.

type DiskEncryptionSetsClientListByResourceGroupOptions

type DiskEncryptionSetsClientListByResourceGroupOptions struct {
}

DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListByResourceGroupPager method.

type DiskEncryptionSetsClientListByResourceGroupResponse

type DiskEncryptionSetsClientListByResourceGroupResponse struct {
	// The List disk encryption set operation response.
	DiskEncryptionSetList
}

DiskEncryptionSetsClientListByResourceGroupResponse contains the response from method DiskEncryptionSetsClient.NewListByResourceGroupPager.

type DiskEncryptionSetsClientListOptions

type DiskEncryptionSetsClientListOptions struct {
}

DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListPager method.

type DiskEncryptionSetsClientListResponse

type DiskEncryptionSetsClientListResponse struct {
	// The List disk encryption set operation response.
	DiskEncryptionSetList
}

DiskEncryptionSetsClientListResponse contains the response from method DiskEncryptionSetsClient.NewListPager.

type DiskEncryptionSetsClientUpdateResponse

type DiskEncryptionSetsClientUpdateResponse struct {
	// disk encryption set resource.
	DiskEncryptionSet
}

DiskEncryptionSetsClientUpdateResponse contains the response from method DiskEncryptionSetsClient.BeginUpdate.

type DiskEncryptionSettings

type DiskEncryptionSettings struct {
	// Specifies the location of the disk encryption key, which is a Key Vault Secret.
	DiskEncryptionKey *KeyVaultSecretReference

	// Specifies whether disk encryption should be enabled on the virtual machine.
	Enabled *bool

	// Specifies the location of the key encryption key in Key Vault.
	KeyEncryptionKey *KeyVaultKeyReference
}

DiskEncryptionSettings - Describes a Encryption Settings for a Disk

func (DiskEncryptionSettings) MarshalJSON

func (d DiskEncryptionSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSettings.

func (*DiskEncryptionSettings) UnmarshalJSON

func (d *DiskEncryptionSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSettings.

type DiskInstanceView

type DiskInstanceView struct {
	// Specifies the encryption settings for the OS Disk.
	// Minimum api-version: 2015-06-15
	EncryptionSettings []*DiskEncryptionSettings

	// The disk name.
	Name *string

	// The resource status information.
	Statuses []*InstanceViewStatus
}

DiskInstanceView - The instance view of the disk.

func (DiskInstanceView) MarshalJSON

func (d DiskInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskInstanceView.

func (*DiskInstanceView) UnmarshalJSON

func (d *DiskInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskInstanceView.

type DiskList

type DiskList struct {
	// REQUIRED; The Disk items on this page
	Value []*Disk

	// The link to the next page of items
	NextLink *string
}

DiskList - The List Disks operation response.

func (DiskList) MarshalJSON

func (d DiskList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskList.

func (*DiskList) UnmarshalJSON

func (d *DiskList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskList.

type DiskProperties

type DiskProperties struct {
	// REQUIRED; Disk source information. CreationData information cannot be changed after the disk has been created.
	CreationData *CreationData

	// Determines how platform treats disk failures
	AvailabilityPolicy *AvailabilityPolicy

	// Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default.
	// Does not apply to Ultra disks.
	BurstingEnabled *bool

	// Percentage complete for the background copy when a resource is created via the CopyStart operation.
	CompletionPercent *float32

	// Additional authentication requirements when exporting or uploading to a disk or snapshot.
	DataAccessAuthMode *DataAccessAuthMode

	// ARM id of the DiskAccess resource for using private endpoints on disks.
	DiskAccessID *string

	// The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer
	// between 4k and 256k bytes.
	DiskIOPSReadOnly *int64

	// The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k
	// bytes.
	DiskIOPSReadWrite *int64

	// The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions
	// of bytes per second - MB here uses the ISO notation, of powers of 10.
	DiskMBpsReadOnly *int64

	// The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here
	// uses the ISO notation, of powers of 10.
	DiskMBpsReadWrite *int64

	// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this
	// field is present for updates or creation with other options, it indicates a
	// resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
	DiskSizeGB *int32

	// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
	Encryption *Encryption

	// Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
	EncryptionSettingsCollection *EncryptionSettingsCollection

	// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
	HyperVGeneration *HyperVGeneration

	// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can
	// be mounted on multiple VMs at the same time.
	MaxShares *int32

	// Policy for accessing the disk via network.
	NetworkAccessPolicy *NetworkAccessPolicy

	// The Operating System type.
	OSType *OperatingSystemTypes

	// Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times
	// a day) by detached from one virtual machine and attached to another. This
	// property should not be set for disks that are not detached and attached frequently as it causes the disks to not align
	// with the fault domain of the virtual machine.
	OptimizedForFrequentAttach *bool

	// Policy for controlling export on the disk.
	PublicNetworkAccess *PublicNetworkAccess

	// Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher:
	// MicrosoftWindowsServer, product: WindowsServer}
	PurchasePlan *DiskPurchasePlan

	// Contains the security related information for the resource.
	SecurityProfile *DiskSecurityProfile

	// List of supported capabilities for the image from which the OS disk was created.
	SupportedCapabilities *SupportedCapabilities

	// Indicates the OS on a disk supports hibernation.
	SupportsHibernation *bool

	// Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/.
	// Does not apply to Ultra disks.
	Tier *string

	// READ-ONLY; Latest time when bursting was last enabled on a disk.
	BurstingEnabledTime *time.Time

	// READ-ONLY; The size of the disk in bytes. This field is read only.
	DiskSizeBytes *int64

	// READ-ONLY; The state of the disk.
	DiskState *DiskState

	// READ-ONLY; The UTC time when the ownership state of the disk was last changed i.e., the time the disk was last attached
	// or detached from a VM or the time when the VM to which the disk was attached was
	// deallocated or started.
	LastOwnershipUpdateTime *time.Time

	// READ-ONLY; Properties of the disk for which update is pending.
	PropertyUpdatesInProgress *PropertyUpdatesInProgress

	// READ-ONLY; The disk provisioning state.
	ProvisioningState *string

	// READ-ONLY; Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than
	// one for disks to allow attaching them to multiple VMs.
	ShareInfo []*ShareInfoElement

	// READ-ONLY; The time when the disk was created.
	TimeCreated *time.Time

	// READ-ONLY; Unique Guid identifying the resource.
	UniqueID *string
}

DiskProperties - Disk resource properties.

func (DiskProperties) MarshalJSON

func (d DiskProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskProperties.

func (*DiskProperties) UnmarshalJSON

func (d *DiskProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskProperties.

type DiskPurchasePlan

type DiskPurchasePlan struct {
	// REQUIRED; The plan ID.
	Name *string

	// REQUIRED; Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference
	// element.
	Product *string

	// REQUIRED; The publisher ID.
	Publisher *string

	// The Offer Promotion Code.
	PromotionCode *string
}

DiskPurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace.

func (DiskPurchasePlan) MarshalJSON

func (d DiskPurchasePlan) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskPurchasePlan.

func (*DiskPurchasePlan) UnmarshalJSON

func (d *DiskPurchasePlan) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskPurchasePlan.

type DiskRestorePoint

type DiskRestorePoint struct {
	// Properties of an incremental disk restore point
	Properties *DiskRestorePointProperties

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

DiskRestorePoint - Properties of disk restore point

func (DiskRestorePoint) MarshalJSON

func (d DiskRestorePoint) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePoint.

func (*DiskRestorePoint) UnmarshalJSON

func (d *DiskRestorePoint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePoint.

type DiskRestorePointAttributes

type DiskRestorePointAttributes struct {
	// Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while
	// creating a restore point.
	Encryption *RestorePointEncryption

	// Resource Id of the source disk restore point.
	SourceDiskRestorePoint *APIEntityReference

	// READ-ONLY; Resource Id
	ID *string
}

DiskRestorePointAttributes - Disk Restore Point details.

func (DiskRestorePointAttributes) MarshalJSON

func (d DiskRestorePointAttributes) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePointAttributes.

func (*DiskRestorePointAttributes) UnmarshalJSON

func (d *DiskRestorePointAttributes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointAttributes.

type DiskRestorePointClient

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

DiskRestorePointClient contains the methods for the DiskRestorePoint group. Don't use this type directly, use NewDiskRestorePointClient() instead.

func NewDiskRestorePointClient

func NewDiskRestorePointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskRestorePointClient, error)

NewDiskRestorePointClient creates a new instance of DiskRestorePointClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DiskRestorePointClient) BeginGrantAccess

func (client *DiskRestorePointClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointClientBeginGrantAccessOptions) (*runtime.Poller[DiskRestorePointClientGrantAccessResponse], error)

BeginGrantAccess - Grants access to a diskRestorePoint. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • restorePointCollectionName - The name of the restore point collection that the disk restore point belongs.
  • vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs.
  • diskRestorePointName - The name of the DiskRestorePoint
  • grantAccessData - Access data object supplied in the body of the get disk access operation.
  • options - DiskRestorePointClientBeginGrantAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginGrantAccess method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskRestorePointClient().BeginGrantAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", armcompute.GrantAccessData{
		Access:            to.Ptr(armcompute.AccessLevelRead),
		DurationInSeconds: to.Ptr[int32](300),
		FileFormat:        to.Ptr(armcompute.FileFormatVHDX),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.AccessURI = armcompute.AccessURI{
	// 	AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"),
	// }
}

func (*DiskRestorePointClient) BeginRevokeAccess

func (client *DiskRestorePointClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientBeginRevokeAccessOptions) (*runtime.Poller[DiskRestorePointClientRevokeAccessResponse], error)

BeginRevokeAccess - Revokes access to a diskRestorePoint. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • restorePointCollectionName - The name of the restore point collection that the disk restore point belongs.
  • vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs.
  • diskRestorePointName - The name of the DiskRestorePoint
  • options - DiskRestorePointClientBeginRevokeAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginRevokeAccess method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiskRestorePointClient().BeginRevokeAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DiskRestorePointClient) Get

func (client *DiskRestorePointClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientGetOptions) (DiskRestorePointClientGetResponse, error)

Get - Get disk restorePoint resource If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • restorePointCollectionName - The name of the restore point collection that the disk restore point belongs.
  • vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs.
  • diskRestorePointName - The name of the DiskRestorePoint
  • options - DiskRestorePointClientGetOptions contains the optional parameters for the DiskRestorePointClient.Get method.
Example (GetAnIncrementalDiskRestorePointResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", 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.DiskRestorePoint = armcompute.DiskRestorePoint{
	// 	Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
	// 	Properties: &armcompute.DiskRestorePointProperties{
	// 		FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		LogicalSectorSize: to.Ptr[int32](4096),
	// 		NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled),
	// 		SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"),
	// 		SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()),
	// 	},
	// }
}
Example (GetAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", 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.DiskRestorePoint = armcompute.DiskRestorePoint{
	// 	Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
	// 	Properties: &armcompute.DiskRestorePointProperties{
	// 		CompletionPercent: to.Ptr[float32](100),
	// 		FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		LogicalSectorSize: to.Ptr[int32](4096),
	// 		NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled),
	// 		ReplicationState: to.Ptr("Succeeded"),
	// 		SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"),
	// 		SourceResourceLocation: to.Ptr("eastus2"),
	// 		SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()),
	// 	},
	// }
}

func (*DiskRestorePointClient) NewListByRestorePointPager

func (client *DiskRestorePointClient) NewListByRestorePointPager(resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointClientListByRestorePointOptions) *runtime.Pager[DiskRestorePointClientListByRestorePointResponse]

NewListByRestorePointPager - Lists diskRestorePoints under a vmRestorePoint.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • restorePointCollectionName - The name of the restore point collection that the disk restore point belongs.
  • vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs.
  • options - DiskRestorePointClientListByRestorePointOptions contains the optional parameters for the DiskRestorePointClient.NewListByRestorePointPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiskRestorePointClient().NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", 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.DiskRestorePointList = armcompute.DiskRestorePointList{
		// 	Value: []*armcompute.DiskRestorePoint{
		// 		{
		// 			Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"),
		// 			Properties: &armcompute.DiskRestorePointProperties{
		// 				FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"),
		// 				HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
		// 				LogicalSectorSize: to.Ptr[int32](4096),
		// 				NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled),
		// 				SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"),
		// 				SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}

type DiskRestorePointClientBeginGrantAccessOptions

type DiskRestorePointClientBeginGrantAccessOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskRestorePointClientBeginGrantAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginGrantAccess method.

type DiskRestorePointClientBeginRevokeAccessOptions

type DiskRestorePointClientBeginRevokeAccessOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DiskRestorePointClientBeginRevokeAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginRevokeAccess method.

type DiskRestorePointClientGetOptions

type DiskRestorePointClientGetOptions struct {
}

DiskRestorePointClientGetOptions contains the optional parameters for the DiskRestorePointClient.Get method.

type DiskRestorePointClientGetResponse

type DiskRestorePointClientGetResponse struct {
	// Properties of disk restore point
	DiskRestorePoint
}

DiskRestorePointClientGetResponse contains the response from method DiskRestorePointClient.Get.

type DiskRestorePointClientGrantAccessResponse

type DiskRestorePointClientGrantAccessResponse struct {
	// A disk access SAS uri.
	AccessURI
}

DiskRestorePointClientGrantAccessResponse contains the response from method DiskRestorePointClient.BeginGrantAccess.

type DiskRestorePointClientListByRestorePointOptions

type DiskRestorePointClientListByRestorePointOptions struct {
}

DiskRestorePointClientListByRestorePointOptions contains the optional parameters for the DiskRestorePointClient.NewListByRestorePointPager method.

type DiskRestorePointClientListByRestorePointResponse

type DiskRestorePointClientListByRestorePointResponse struct {
	// The List Disk Restore Points operation response.
	DiskRestorePointList
}

DiskRestorePointClientListByRestorePointResponse contains the response from method DiskRestorePointClient.NewListByRestorePointPager.

type DiskRestorePointClientRevokeAccessResponse

type DiskRestorePointClientRevokeAccessResponse struct {
}

DiskRestorePointClientRevokeAccessResponse contains the response from method DiskRestorePointClient.BeginRevokeAccess.

type DiskRestorePointInstanceView

type DiskRestorePointInstanceView struct {
	// Disk restore point Id.
	ID *string

	// The disk restore point replication status information.
	ReplicationStatus *DiskRestorePointReplicationStatus

	// The state of snapshot which determines the access availability of the snapshot.
	SnapshotAccessState *SnapshotAccessState
}

DiskRestorePointInstanceView - The instance view of a disk restore point.

func (DiskRestorePointInstanceView) MarshalJSON

func (d DiskRestorePointInstanceView) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePointInstanceView.

func (*DiskRestorePointInstanceView) UnmarshalJSON

func (d *DiskRestorePointInstanceView) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointInstanceView.

type DiskRestorePointList

type DiskRestorePointList struct {
	// REQUIRED; The DiskRestorePoint items on this page
	Value []*DiskRestorePoint

	// The link to the next page of items
	NextLink *string
}

DiskRestorePointList - The List Disk Restore Points operation response.

func (DiskRestorePointList) MarshalJSON

func (d DiskRestorePointList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePointList.

func (*DiskRestorePointList) UnmarshalJSON

func (d *DiskRestorePointList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointList.

type DiskRestorePointProperties

type DiskRestorePointProperties struct {
	// Percentage complete for the background copy of disk restore point when source resource is from a different region.
	CompletionPercent *float32

	// ARM id of the DiskAccess resource for using private endpoints on disks.
	DiskAccessID *string

	// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
	HyperVGeneration *HyperVGeneration

	// Policy for accessing the disk via network.
	NetworkAccessPolicy *NetworkAccessPolicy

	// Policy for controlling export on the disk.
	PublicNetworkAccess *PublicNetworkAccess

	// Purchase plan information for the the image from which the OS disk was created.
	PurchasePlan *DiskPurchasePlan

	// Contains the security related information for the resource.
	SecurityProfile *DiskSecurityProfile

	// List of supported capabilities for the image from which the OS disk was created.
	SupportedCapabilities *SupportedCapabilities

	// Indicates the OS on a disk supports hibernation.
	SupportsHibernation *bool

	// READ-ONLY; Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
	Encryption *Encryption

	// READ-ONLY; id of the backing snapshot's MIS family
	FamilyID *string

	// READ-ONLY; Logical sector size in bytes for disk restore points of UltraSSDLRS and PremiumV2LRS disks. Supported values
	// are 512 and 4096. 4096 is the default.
	LogicalSectorSize *int32

	// READ-ONLY; The Operating System type.
	OSType *OperatingSystemTypes

	// READ-ONLY; Replication state of disk restore point when source resource is from a different region.
	ReplicationState *string

	// READ-ONLY; arm id of source disk or source disk restore point.
	SourceResourceID *string

	// READ-ONLY; Location of source disk or source disk restore point when source resource is from a different region.
	SourceResourceLocation *string

	// READ-ONLY; unique incarnation id of the source disk
	SourceUniqueID *string

	// READ-ONLY; The timestamp of restorePoint creation
	TimeCreated *time.Time
}

DiskRestorePointProperties - Properties of an incremental disk restore point

func (DiskRestorePointProperties) MarshalJSON

func (d DiskRestorePointProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePointProperties.

func (*DiskRestorePointProperties) UnmarshalJSON

func (d *DiskRestorePointProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointProperties.

type DiskRestorePointReplicationStatus

type DiskRestorePointReplicationStatus struct {
	// Replication completion percentage.
	CompletionPercent *int32

	// The resource status information.
	Status *InstanceViewStatus
}

DiskRestorePointReplicationStatus - The instance view of a disk restore point.

func (DiskRestorePointReplicationStatus) MarshalJSON

func (d DiskRestorePointReplicationStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskRestorePointReplicationStatus.

func (*DiskRestorePointReplicationStatus) UnmarshalJSON

func (d *DiskRestorePointReplicationStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointReplicationStatus.

type DiskSKU

type DiskSKU struct {
	// The sku name.
	Name *DiskStorageAccountTypes

	// READ-ONLY; The sku tier.
	Tier *string
}

DiskSKU - The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS.

func (DiskSKU) MarshalJSON

func (d DiskSKU) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskSKU.

func (*DiskSKU) UnmarshalJSON

func (d *DiskSKU) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskSKU.

type DiskSecurityProfile

type DiskSecurityProfile struct {
	// ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key
	SecureVMDiskEncryptionSetID *string

	// Specifies the SecurityType of the VM. Applicable for OS disks only.
	SecurityType *DiskSecurityTypes
}

DiskSecurityProfile - Contains the security related information for the resource.

func (DiskSecurityProfile) MarshalJSON

func (d DiskSecurityProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskSecurityProfile.

func (*DiskSecurityProfile) UnmarshalJSON

func (d *DiskSecurityProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskSecurityProfile.

type DiskSecurityTypes

type DiskSecurityTypes string

DiskSecurityTypes - Specifies the SecurityType of the VM. Applicable for OS disks only.

const (
	// DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey - Indicates Confidential VM disk with both OS disk and VM guest
	// state encrypted with a customer managed key
	DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey DiskSecurityTypes = "ConfidentialVM_DiskEncryptedWithCustomerKey"
	// DiskSecurityTypesConfidentialVMDiskEncryptedWithPlatformKey - Indicates Confidential VM disk with both OS disk and VM guest
	// state encrypted with a platform managed key
	DiskSecurityTypesConfidentialVMDiskEncryptedWithPlatformKey DiskSecurityTypes = "ConfidentialVM_DiskEncryptedWithPlatformKey"
	// DiskSecurityTypesConfidentialVMNonPersistedTPM - Indicates Confidential VM disk with a ephemeral vTPM. vTPM state is not
	// persisted across VM reboots.
	DiskSecurityTypesConfidentialVMNonPersistedTPM DiskSecurityTypes = "ConfidentialVM_NonPersistedTPM"
	// DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey - Indicates Confidential VM disk with only VM guest
	// state encrypted
	DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey DiskSecurityTypes = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
	// DiskSecurityTypesTrustedLaunch - Trusted Launch provides security features such as secure boot and virtual Trusted Platform
	// Module (vTPM)
	DiskSecurityTypesTrustedLaunch DiskSecurityTypes = "TrustedLaunch"
)

func PossibleDiskSecurityTypesValues

func PossibleDiskSecurityTypesValues() []DiskSecurityTypes

PossibleDiskSecurityTypesValues returns the possible values for the DiskSecurityTypes const type.

type DiskState

type DiskState string

DiskState - This enumerates the possible state of the disk.

const (
	// DiskStateActiveSAS - The disk currently has an Active SAS Uri associated with it.
	DiskStateActiveSAS DiskState = "ActiveSAS"
	// DiskStateActiveSASFrozen - The disk is attached to a VM in hibernated state and has an active SAS URI associated with it.
	DiskStateActiveSASFrozen DiskState = "ActiveSASFrozen"
	// DiskStateActiveUpload - A disk is created for upload and a write token has been issued for uploading to it.
	DiskStateActiveUpload DiskState = "ActiveUpload"
	// DiskStateAttached - The disk is currently attached to a running VM.
	DiskStateAttached DiskState = "Attached"
	// DiskStateFrozen - The disk is attached to a VM which is in hibernated state.
	DiskStateFrozen DiskState = "Frozen"
	// DiskStateReadyToUpload - A disk is ready to be created by upload by requesting a write token.
	DiskStateReadyToUpload DiskState = "ReadyToUpload"
	// DiskStateReserved - The disk is attached to a stopped-deallocated VM.
	DiskStateReserved DiskState = "Reserved"
	// DiskStateUnattached - The disk is not being used and can be attached to a VM.
	DiskStateUnattached DiskState = "Unattached"
)

func PossibleDiskStateValues

func PossibleDiskStateValues() []DiskState

PossibleDiskStateValues returns the possible values for the DiskState const type.

type DiskStorageAccountTypes

type DiskStorageAccountTypes string

DiskStorageAccountTypes - The sku name.

const (
	// DiskStorageAccountTypesPremiumLRS - Premium SSD locally redundant storage. Best for production and performance sensitive
	// workloads.
	DiskStorageAccountTypesPremiumLRS DiskStorageAccountTypes = "Premium_LRS"
	// DiskStorageAccountTypesPremiumV2LRS - Premium SSD v2 locally redundant storage. Best for production and performance-sensitive
	// workloads that consistently require low latency and high IOPS and throughput.
	DiskStorageAccountTypesPremiumV2LRS DiskStorageAccountTypes = "PremiumV2_LRS"
	// DiskStorageAccountTypesPremiumZRS - Premium SSD zone redundant storage. Best for the production workloads that need storage
	// resiliency against zone failures.
	DiskStorageAccountTypesPremiumZRS DiskStorageAccountTypes = "Premium_ZRS"
	// DiskStorageAccountTypesStandardLRS - Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent
	// access.
	DiskStorageAccountTypesStandardLRS DiskStorageAccountTypes = "Standard_LRS"
	// DiskStorageAccountTypesStandardSSDLRS - Standard SSD locally redundant storage. Best for web servers, lightly used enterprise
	// applications and dev/test.
	DiskStorageAccountTypesStandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS"
	// DiskStorageAccountTypesStandardSSDZRS - Standard SSD zone redundant storage. Best for web servers, lightly used enterprise
	// applications and dev/test that need storage resiliency against zone failures.
	DiskStorageAccountTypesStandardSSDZRS DiskStorageAccountTypes = "StandardSSD_ZRS"
	// DiskStorageAccountTypesUltraSSDLRS - Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA,
	// top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads.
	DiskStorageAccountTypesUltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS"
)

func PossibleDiskStorageAccountTypesValues

func PossibleDiskStorageAccountTypesValues() []DiskStorageAccountTypes

PossibleDiskStorageAccountTypesValues returns the possible values for the DiskStorageAccountTypes const type.

type DiskUpdate

type DiskUpdate struct {
	// Disk resource update properties.
	Properties *DiskUpdateProperties

	// The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS.
	SKU *DiskSKU

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

DiskUpdate - Disk update resource.

func (DiskUpdate) MarshalJSON

func (d DiskUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskUpdate.

func (*DiskUpdate) UnmarshalJSON

func (d *DiskUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskUpdate.

type DiskUpdateProperties

type DiskUpdateProperties struct {
	// Determines how platform treats disk failures
	AvailabilityPolicy *AvailabilityPolicy

	// Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default.
	// Does not apply to Ultra disks.
	BurstingEnabled *bool

	// Additional authentication requirements when exporting or uploading to a disk or snapshot.
	DataAccessAuthMode *DataAccessAuthMode

	// ARM id of the DiskAccess resource for using private endpoints on disks.
	DiskAccessID *string

	// The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer
	// between 4k and 256k bytes.
	DiskIOPSReadOnly *int64

	// The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k
	// bytes.
	DiskIOPSReadWrite *int64

	// The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions
	// of bytes per second - MB here uses the ISO notation, of powers of 10.
	DiskMBpsReadOnly *int64

	// The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here
	// uses the ISO notation, of powers of 10.
	DiskMBpsReadWrite *int64

	// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this
	// field is present for updates or creation with other options, it indicates a
	// resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
	DiskSizeGB *int32

	// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
	Encryption *Encryption

	// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
	EncryptionSettingsCollection *EncryptionSettingsCollection

	// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can
	// be mounted on multiple VMs at the same time.
	MaxShares *int32

	// Policy for accessing the disk via network.
	NetworkAccessPolicy *NetworkAccessPolicy

	// the Operating System type.
	OSType *OperatingSystemTypes

	// Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times
	// a day) by detached from one virtual machine and attached to another. This
	// property should not be set for disks that are not detached and attached frequently as it causes the disks to not align
	// with the fault domain of the virtual machine.
	OptimizedForFrequentAttach *bool

	// Policy for controlling export on the disk.
	PublicNetworkAccess *PublicNetworkAccess

	// Purchase plan information to be added on the OS disk
	PurchasePlan *DiskPurchasePlan

	// List of supported capabilities to be added on the OS disk.
	SupportedCapabilities *SupportedCapabilities

	// Indicates the OS on a disk supports hibernation.
	SupportsHibernation *bool

	// Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/.
	// Does not apply to Ultra disks.
	Tier *string

	// READ-ONLY; Properties of the disk for which update is pending.
	PropertyUpdatesInProgress *PropertyUpdatesInProgress
}

DiskUpdateProperties - Disk resource update properties.

func (DiskUpdateProperties) MarshalJSON

func (d DiskUpdateProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DiskUpdateProperties.

func (*DiskUpdateProperties) UnmarshalJSON

func (d *DiskUpdateProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DiskUpdateProperties.

type DisksClient

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

DisksClient contains the methods for the Disks group. Don't use this type directly, use NewDisksClient() instead.

func NewDisksClient

func NewDisksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DisksClient, error)

NewDisksClient creates a new instance of DisksClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*DisksClient) BeginCreateOrUpdate

func (client *DisksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[DisksClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Creates or updates a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • disk - Disk object supplied in the body of the Put disk operation.
  • options - DisksClientBeginCreateOrUpdateOptions contains the optional parameters for the DisksClient.BeginCreateOrUpdate method.
Example (CreateAConfidentialVmSupportedDiskEncryptedWithCustomerManagedKey)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				ImageReference: &armcompute.ImageDiskReference{
					ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
			SecurityProfile: &armcompute.DiskSecurityProfile{
				SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"),
				SecurityType:                to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
	// 			},
	// 		},
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"),
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskAndAssociateWithDiskAccessResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskAccess.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskAccessID:        to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
			DiskSizeGB:          to.Ptr[int32](200),
			NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessEnabled),
	// 	},
	// }
}
Example (CreateAManagedDiskAndAssociateWithDiskEncryptionSet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB: to.Ptr[int32](200),
			Encryption: &armcompute.Encryption{
				DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		Encryption: &armcompute.Encryption{
	// 			DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskByCopyingASnapshot)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:     to.Ptr(armcompute.DiskCreateOptionCopy),
				SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
	// 			SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:     to.Ptr(armcompute.DiskCreateOptionImport),
				SourceURI:        to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
				StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
	// 			SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 			StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
				SourceURI:    to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
	// 			SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskFromAPlatformImage)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAPlatformImage.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				ImageReference: &armcompute.ImageDiskReference{
					ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
	// 			},
	// 		},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		PurchasePlan: &armcompute.DiskPurchasePlan{
	// 			Name: to.Ptr("{sku}"),
	// 			Product: to.Ptr("{offer}"),
	// 			Publisher: to.Ptr("{publisher}"),
	// 		},
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromAnAzureComputeGalleryCommunityImage)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				GalleryImageReference: &armcompute.ImageDiskReference{
					CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			GalleryImageReference: &armcompute.ImageDiskReference{
	// 				CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"),
	// 			},
	// 		},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromAnAzureComputeGalleryDirectSharedImage)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				GalleryImageReference: &armcompute.ImageDiskReference{
					SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			GalleryImageReference: &armcompute.ImageDiskReference{
	// 				SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"),
	// 			},
	// 		},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromAnAzureComputeGalleryImage)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				GalleryImageReference: &armcompute.ImageDiskReference{
					ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			GalleryImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"),
	// 			},
	// 		},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(true),
	// 			SupportedSecurityOption: to.Ptr(armcompute.SupportedSecurityOptionTrustedLaunchSupported),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk2", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:     to.Ptr(armcompute.DiskCreateOptionCopy),
				SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk2"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
	// 			SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskFromElasticSanVolumeSnapshot)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:         to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
				ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
	// 			ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskFromImportSecureCreateOption)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:     to.Ptr(armcompute.DiskCreateOptionImportSecure),
				SecurityDataURI:  to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
				SourceURI:        to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
				StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
			SecurityProfile: &armcompute.DiskSecurityProfile{
				SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
	// 			SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
	// 			SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 			StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
	// 		},
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromImportSecureCreateOptionWithMetadataUriForConfidentialVm)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:        to.Ptr(armcompute.DiskCreateOptionImportSecure),
				SecurityDataURI:     to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
				SecurityMetadataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"),
				SourceURI:           to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
				StorageAccountID:    to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
			SecurityProfile: &armcompute.DiskSecurityProfile{
				SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
	// 			SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
	// 			SecurityMetadataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"),
	// 			SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 			StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
	// 		},
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskFromUploadPreparedSecureCreateOption)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:    to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure),
				UploadSizeBytes: to.Ptr[int64](10737418752),
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
			SecurityProfile: &armcompute.DiskSecurityProfile{
				SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure),
	// 			UploadSizeBytes: to.Ptr[int64](10737418752),
	// 		},
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskWithAvailabilityPolicy)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			AvailabilityPolicy: &armcompute.AvailabilityPolicy{
				ActionOnDiskDelay: to.Ptr(armcompute.AvailabilityPolicyDiskDelayAutomaticReattach),
			},
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB: to.Ptr[int32](1024),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		AvailabilityPolicy: &armcompute.AvailabilityPolicy{
	// 			ActionOnDiskDelay: to.Ptr(armcompute.AvailabilityPolicyDiskDelayAutomaticReattach),
	// 		},
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](1024),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithDataAccessAuthMode)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory),
			DiskSizeGB:         to.Ptr[int32](200),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory),
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithOptimizedForFrequentAttach)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB:                 to.Ptr[int32](200),
			OptimizedForFrequentAttach: to.Ptr(true),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		OptimizedForFrequentAttach: to.Ptr(true),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithPerformancePlus)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_PerformancePlus.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:    to.Ptr(armcompute.DiskCreateOptionUpload),
				PerformancePlus: to.Ptr(true),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
	// 			PerformancePlus: to.Ptr(true),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithPremiumV2AccountType)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myPremiumV2Disk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskIOPSReadWrite: to.Ptr[int64](125),
			DiskMBpsReadWrite: to.Ptr[int64](3000),
			DiskSizeGB:        to.Ptr[int32](200),
		},
		SKU: &armcompute.DiskSKU{
			Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myPremiumV2Disk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS),
	// 		Tier: to.Ptr("Premium"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithSecurityProfile)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSecurityProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("North Central US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
				ImageReference: &armcompute.ImageDiskReference{
					ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
				},
			},
			OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
			SecurityProfile: &armcompute.DiskSecurityProfile{
				SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("North Central US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
	// 			},
	// 		},
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
	// 		},
	// 	},
	// }
}
Example (CreateAManagedDiskWithSsdZrsAccountType)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB: to.Ptr[int32](200),
		},
		SKU: &armcompute.DiskSKU{
			Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS),
	// 		Tier: to.Ptr("Premium"),
	// 	},
	// }
}
Example (CreateAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myUltraReadOnlyDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:      to.Ptr(armcompute.DiskCreateOptionEmpty),
				LogicalSectorSize: to.Ptr[int32](4096),
			},
			DiskIOPSReadWrite: to.Ptr[int64](125),
			DiskMBpsReadWrite: to.Ptr[int64](3000),
			DiskSizeGB:        to.Ptr[int32](200),
			Encryption: &armcompute.Encryption{
				Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
			},
		},
		SKU: &armcompute.DiskSKU{
			Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myUltraReadOnlyDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		Encryption: &armcompute.Encryption{
	// 			Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
	// 		Tier: to.Ptr("Ultra"),
	// 	},
	// }
}
Example (CreateAManagedUploadDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_UploadDisk.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:    to.Ptr(armcompute.DiskCreateOptionUpload),
				UploadSizeBytes: to.Ptr[int64](10737418752),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
	// 			UploadSizeBytes: to.Ptr[int64](10737418752),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAnEmptyManagedDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_Empty.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB: to.Ptr[int32](200),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAnEmptyManagedDiskInExtendedLocation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_InExtendedLocation.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		ExtendedLocation: &armcompute.ExtendedLocation{
			Name: to.Ptr("{edge-zone-id}"),
			Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone),
		},
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
			},
			DiskSizeGB: to.Ptr[int32](200),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	ExtendedLocation: &armcompute.ExtendedLocation{
	// 		Name: to.Ptr("{edge-zone-id}"),
	// 		Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone),
	// 	},
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (CreateAnUltraManagedDiskWithLogicalSectorSize512E)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
		Location: to.Ptr("West US"),
		Properties: &armcompute.DiskProperties{
			CreationData: &armcompute.CreationData{
				CreateOption:      to.Ptr(armcompute.DiskCreateOptionEmpty),
				LogicalSectorSize: to.Ptr[int32](512),
			},
			DiskSizeGB: to.Ptr[int32](200),
		},
		SKU: &armcompute.DiskSKU{
			Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 			LogicalSectorSize: to.Ptr[int32](512),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
	// 		Tier: to.Ptr("Ultra"),
	// 	},
	// }
}

func (*DisksClient) BeginDelete

func (client *DisksClient) BeginDelete(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginDeleteOptions) (*runtime.Poller[DisksClientDeleteResponse], error)

BeginDelete - Deletes a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DisksClientBeginDeleteOptions contains the optional parameters for the DisksClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginDelete(ctx, "myResourceGroup", "myDisk", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DisksClient) BeginGrantAccess

func (client *DisksClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksClientBeginGrantAccessOptions) (*runtime.Poller[DisksClientGrantAccessResponse], error)

BeginGrantAccess - Grants access to a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • grantAccessData - Access data object supplied in the body of the get disk access operation.
  • options - DisksClientBeginGrantAccessOptions contains the optional parameters for the DisksClient.BeginGrantAccess method.
Example (GetASasOnAManagedDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{
		Access:            to.Ptr(armcompute.AccessLevelRead),
		DurationInSeconds: to.Ptr[int32](300),
		FileFormat:        to.Ptr(armcompute.FileFormatVHD),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.AccessURI = armcompute.AccessURI{
	// 	AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"),
	// }
}
Example (GetSasOnManagedDiskAndVmGuestState)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{
		Access:                   to.Ptr(armcompute.AccessLevelRead),
		DurationInSeconds:        to.Ptr[int32](300),
		GetSecureVMGuestStateSAS: to.Ptr(true),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.AccessURI = armcompute.AccessURI{
	// 	AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"),
	// 	SecurityDataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"),
	// }
}
Example (GetSasOnManagedDiskVmGuestStateAndVmMetadataForConfidentialVm)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{
		Access:                   to.Ptr(armcompute.AccessLevelRead),
		DurationInSeconds:        to.Ptr[int32](300),
		GetSecureVMGuestStateSAS: to.Ptr(true),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.AccessURI = armcompute.AccessURI{
	// 	AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2025-05-29T18:02:34Z&se=2025-05-29T18:19:14Z&sp=r"),
	// 	SecurityDataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2025-05-29T18:02:34Z&se=2025-05-29T18:19:14Z&sp=r"),
	// 	SecurityMetadataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/ghm3kwd5jzbn/2be55b76-f471-4f6b-bff0-4dcea6cbca7f_vmmd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2025-05-29T18:02:34Z&se=2025-05-29T18:19:14Z&sp=r"),
	// }
}

func (*DisksClient) BeginRevokeAccess

func (client *DisksClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginRevokeAccessOptions) (*runtime.Poller[DisksClientRevokeAccessResponse], error)

BeginRevokeAccess - Revokes access to a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DisksClientBeginRevokeAccessOptions contains the optional parameters for the DisksClient.BeginRevokeAccess method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_EndGetAccess.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginRevokeAccess(ctx, "myResourceGroup", "myDisk", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*DisksClient) BeginUpdate

func (client *DisksClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksClientBeginUpdateOptions) (*runtime.Poller[DisksClientUpdateResponse], error)

BeginUpdate - Updates (patches) a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • disk - Disk object supplied in the body of the Patch disk operation.
  • options - DisksClientBeginUpdateOptions contains the optional parameters for the DisksClient.BeginUpdate method.
Example (CreateOrUpdateABurstingEnabledManagedDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			BurstingEnabled: to.Ptr(true),
			DiskSizeGB:      to.Ptr[int32](1024),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		BurstingEnabled: to.Ptr(true),
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](1024),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToAddAcceleratedNetworking)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			SupportedCapabilities: &armcompute.SupportedCapabilities{
				AcceleratedNetwork: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
	// 			},
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](127),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(false),
	// 		},
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToAddArchitecture)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ToAddArchitecture.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			SupportedCapabilities: &armcompute.SupportedCapabilities{
				Architecture: to.Ptr(armcompute.ArchitectureArm64),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
	// 			},
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](127),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			Architecture: to.Ptr(armcompute.ArchitectureArm64),
	// 		},
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToAddPurchasePlan)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddPurchasePlan.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			PurchasePlan: &armcompute.DiskPurchasePlan{
				Name:          to.Ptr("myPurchasePlanName"),
				Product:       to.Ptr("myPurchasePlanProduct"),
				PromotionCode: to.Ptr("myPurchasePlanPromotionCode"),
				Publisher:     to.Ptr("myPurchasePlanPublisher"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
	// 			},
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](127),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		PurchasePlan: &armcompute.DiskPurchasePlan{
	// 			Name: to.Ptr("myPurchasePlanName"),
	// 			Product: to.Ptr("myPurchasePlanProduct"),
	// 			PromotionCode: to.Ptr("myPurchasePlanPromotionCode"),
	// 			Publisher: to.Ptr("myPurchasePlanPublisher"),
	// 		},
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToAddSupportsHibernation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			SupportsHibernation: to.Ptr(true),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
	// 			SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](127),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportsHibernation: to.Ptr(true),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToChangeTier)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ChangeTier.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			Tier: to.Ptr("P30"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		Tier: to.Ptr("P30"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToDisableBursting)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableBursting.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			BurstingEnabled: to.Ptr(false),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (UpdateAManagedDiskToDisableOptimizedForFrequentAttach)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			OptimizedForFrequentAttach: to.Ptr(false),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		OptimizedForFrequentAttach: to.Ptr(false),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}
Example (UpdateAManagedDiskWithDiskControllerTypes)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			SupportedCapabilities: &armcompute.SupportedCapabilities{
				DiskControllerTypes: to.Ptr("SCSI"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"),
	// 			},
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](127),
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			DiskControllerTypes: to.Ptr("SCSI"),
	// 		},
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 		Tier: to.Ptr("Standard"),
	// 	},
	// }
}
Example (UpdateManagedDiskToRemoveDiskAccessResourceAssociation)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
		Properties: &armcompute.DiskUpdateProperties{
			NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myDisk"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.DiskProperties{
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](200),
	// 		NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 	},
	// }
}

func (*DisksClient) Get

func (client *DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientGetOptions) (DisksClientGetResponse, error)

Get - Gets information about a disk. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
  • options - DisksClientGetOptions contains the optional parameters for the DisksClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDisksClient().Get(ctx, "myResourceGroup", "myManagedDisk", 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.Disk = armcompute.Disk{
	// 	Name: to.Ptr("myManagedDisk"),
	// 	Type: to.Ptr("Microsoft.Compute/disks"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("Development"),
	// 		"project": to.Ptr("ManagedDisks"),
	// 	},
	// 	ManagedBy: to.Ptr("/subscriptions/123caaa-123v-v211-a49f-f88ccac5bf88/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/virtualMachines/TestVM414689371c88843d65ec"),
	// 	Properties: &armcompute.DiskProperties{
	// 		LastOwnershipUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()),
	// 		CreationData: &armcompute.CreationData{
	// 			CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
	// 			ImageReference: &armcompute.ImageDiskReference{
	// 				ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
	// 			},
	// 		},
	// 		DiskSizeGB: to.Ptr[int32](10),
	// 		Encryption: &armcompute.Encryption{
	// 			Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
	// 		},
	// 		EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{
	// 			Enabled: to.Ptr(true),
	// 			EncryptionSettings: []*armcompute.EncryptionSettingsElement{
	// 				{
	// 					DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{
	// 						SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"),
	// 						SourceVault: &armcompute.SourceVault{
	// 							ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 						},
	// 					},
	// 					KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{
	// 						KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
	// 						SourceVault: &armcompute.SourceVault{
	// 							ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
	// 						},
	// 					},
	// 			}},
	// 		},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		PurchasePlan: &armcompute.DiskPurchasePlan{
	// 			Name: to.Ptr("test_sku"),
	// 			Product: to.Ptr("marketplace_vm_test"),
	// 			Publisher: to.Ptr("test_test_pmc2pc1"),
	// 		},
	// 		SecurityProfile: &armcompute.DiskSecurityProfile{
	// 			SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
	// 		},
	// 		SupportedCapabilities: &armcompute.SupportedCapabilities{
	// 			AcceleratedNetwork: to.Ptr(true),
	// 		},
	// 		SupportsHibernation: to.Ptr(true),
	// 		TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()),
	// 	},
	// 	SKU: &armcompute.DiskSKU{
	// 		Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
	// 	},
	// }
}

func (*DisksClient) NewListByResourceGroupPager

func (client *DisksClient) NewListByResourceGroupPager(resourceGroupName string, options *DisksClientListByResourceGroupOptions) *runtime.Pager[DisksClientListByResourceGroupResponse]

NewListByResourceGroupPager - Lists all the disks under a resource group.

Generated from API version 2025-01-02

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - DisksClientListByResourceGroupOptions contains the optional parameters for the DisksClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDisksClient().NewListByResourceGroupPager("myResourceGroup", 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.DiskList = armcompute.DiskList{
		// 	Value: []*armcompute.Disk{
		// 		{
		// 			Name: to.Ptr("myManagedDisk1"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("ManagedDisks"),
		// 			},
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
		// 					SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](200),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{
		// 					Enabled: to.Ptr(true),
		// 					EncryptionSettings: []*armcompute.EncryptionSettingsElement{
		// 						{
		// 							DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{
		// 								SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 							KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{
		// 								KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 					}},
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.927Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myManagedDisk2"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
		// 			Location: to.Ptr("westus"),
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](10),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myManagedDisk3"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("ManagedDisks"),
		// 			},
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
		// 					ImageReference: &armcompute.ImageDiskReference{
		// 						ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
		// 					},
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](200),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{
		// 					Enabled: to.Ptr(true),
		// 					EncryptionSettings: []*armcompute.EncryptionSettingsElement{
		// 						{
		// 							DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{
		// 								SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 							KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{
		// 								KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 					}},
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.397Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}

func (*DisksClient) NewListPager

func (client *DisksClient) NewListPager(options *DisksClientListOptions) *runtime.Pager[DisksClientListResponse]

NewListPager - Lists all the disks under a subscription.

Generated from API version 2025-01-02

  • options - DisksClientListOptions contains the optional parameters for the DisksClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDisksClient().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.DiskList = armcompute.DiskList{
		// 	Value: []*armcompute.Disk{
		// 		{
		// 			Name: to.Ptr("myManagedDisk1"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("ManagedDisks"),
		// 			},
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
		// 					SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](200),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{
		// 					Enabled: to.Ptr(true),
		// 					EncryptionSettings: []*armcompute.EncryptionSettingsElement{
		// 						{
		// 							DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{
		// 								SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 							KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{
		// 								KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 					}},
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.927Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myManagedDisk2"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
		// 			Location: to.Ptr("westus"),
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](10),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myManagedDisk3"),
		// 			Type: to.Ptr("Microsoft.Compute/disks"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk3"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"department": to.Ptr("Development"),
		// 				"project": to.Ptr("ManagedDisks"),
		// 			},
		// 			Properties: &armcompute.DiskProperties{
		// 				CreationData: &armcompute.CreationData{
		// 					CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
		// 					ImageReference: &armcompute.ImageDiskReference{
		// 						ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
		// 					},
		// 				},
		// 				DiskSizeGB: to.Ptr[int32](200),
		// 				Encryption: &armcompute.Encryption{
		// 					Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
		// 				},
		// 				EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{
		// 					Enabled: to.Ptr(true),
		// 					EncryptionSettings: []*armcompute.EncryptionSettingsElement{
		// 						{
		// 							DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{
		// 								SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 							KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{
		// 								KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
		// 								SourceVault: &armcompute.SourceVault{
		// 									ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
		// 								},
		// 							},
		// 					}},
		// 				},
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.397Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}

type DisksClientBeginCreateOrUpdateOptions

type DisksClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DisksClientBeginCreateOrUpdateOptions contains the optional parameters for the DisksClient.BeginCreateOrUpdate method.

type DisksClientBeginDeleteOptions

type DisksClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DisksClientBeginDeleteOptions contains the optional parameters for the DisksClient.BeginDelete method.

type DisksClientBeginGrantAccessOptions

type DisksClientBeginGrantAccessOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DisksClientBeginGrantAccessOptions contains the optional parameters for the DisksClient.BeginGrantAccess method.

type DisksClientBeginRevokeAccessOptions

type DisksClientBeginRevokeAccessOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DisksClientBeginRevokeAccessOptions contains the optional parameters for the DisksClient.BeginRevokeAccess method.

type DisksClientBeginUpdateOptions

type DisksClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

DisksClientBeginUpdateOptions contains the optional parameters for the DisksClient.BeginUpdate method.

type DisksClientCreateOrUpdateResponse

type DisksClientCreateOrUpdateResponse struct {
	// Disk resource.
	Disk
}

DisksClientCreateOrUpdateResponse contains the response from method DisksClient.BeginCreateOrUpdate.

type DisksClientDeleteResponse

type DisksClientDeleteResponse struct {
}

DisksClientDeleteResponse contains the response from method DisksClient.BeginDelete.

type DisksClientGetOptions

type DisksClientGetOptions struct {
}

DisksClientGetOptions contains the optional parameters for the DisksClient.Get method.

type DisksClientGetResponse

type DisksClientGetResponse struct {
	// Disk resource.
	Disk
}

DisksClientGetResponse contains the response from method DisksClient.Get.

type DisksClientGrantAccessResponse

type DisksClientGrantAccessResponse struct {
	// A disk access SAS uri.
	AccessURI
}

DisksClientGrantAccessResponse contains the response from method DisksClient.BeginGrantAccess.

type DisksClientListByResourceGroupOptions

type DisksClientListByResourceGroupOptions struct {
}

DisksClientListByResourceGroupOptions contains the optional parameters for the DisksClient.NewListByResourceGroupPager method.

type DisksClientListByResourceGroupResponse

type DisksClientListByResourceGroupResponse struct {
	// The List Disks operation response.
	DiskList
}

DisksClientListByResourceGroupResponse contains the response from method DisksClient.NewListByResourceGroupPager.

type DisksClientListOptions

type DisksClientListOptions struct {
}

DisksClientListOptions contains the optional parameters for the DisksClient.NewListPager method.

type DisksClientListResponse

type DisksClientListResponse struct {
	// The List Disks operation response.
	DiskList
}

DisksClientListResponse contains the response from method DisksClient.NewListPager.

type DisksClientRevokeAccessResponse

type DisksClientRevokeAccessResponse struct {
}

DisksClientRevokeAccessResponse contains the response from method DisksClient.BeginRevokeAccess.

type DisksClientUpdateResponse

type DisksClientUpdateResponse struct {
	// Disk resource.
	Disk
}

DisksClientUpdateResponse contains the response from method DisksClient.BeginUpdate.

type DomainNameLabelScopeTypes

type DomainNameLabelScopeTypes string

DomainNameLabelScopeTypes - The Domain name label scope.The concatenation of the hashed domain name label that generated according to the policy from domain name label scope and vm index will be the domain name labels of the PublicIPAddress resources that will be created

const (
	DomainNameLabelScopeTypesNoReuse            DomainNameLabelScopeTypes = "NoReuse"
	DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse"
	DomainNameLabelScopeTypesSubscriptionReuse  DomainNameLabelScopeTypes = "SubscriptionReuse"
	DomainNameLabelScopeTypesTenantReuse        DomainNameLabelScopeTypes = "TenantReuse"
)

func PossibleDomainNameLabelScopeTypesValues

func PossibleDomainNameLabelScopeTypesValues() []DomainNameLabelScopeTypes

PossibleDomainNameLabelScopeTypesValues returns the possible values for the DomainNameLabelScopeTypes const type.

type EdgeZoneStorageAccountType

type EdgeZoneStorageAccountType string

EdgeZoneStorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable.

const (
	EdgeZoneStorageAccountTypePremiumLRS     EdgeZoneStorageAccountType = "Premium_LRS"
	EdgeZoneStorageAccountTypeStandardLRS    EdgeZoneStorageAccountType = "Standard_LRS"
	EdgeZoneStorageAccountTypeStandardSSDLRS EdgeZoneStorageAccountType = "StandardSSD_LRS"
	EdgeZoneStorageAccountTypeStandardZRS    EdgeZoneStorageAccountType = "Standard_ZRS"
)

func PossibleEdgeZoneStorageAccountTypeValues

func PossibleEdgeZoneStorageAccountTypeValues() []EdgeZoneStorageAccountType

PossibleEdgeZoneStorageAccountTypeValues returns the possible values for the EdgeZoneStorageAccountType const type.

type Encryption

type Encryption struct {
	// ResourceId of the disk encryption set to use for enabling encryption at rest.
	DiskEncryptionSetID *string

	// The type of key used to encrypt the data of the disk.
	Type *EncryptionType
}

Encryption at rest settings for disk or snapshot

func (Encryption) MarshalJSON

func (e Encryption) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Encryption.

func (*Encryption) UnmarshalJSON

func (e *Encryption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Encryption.

type EncryptionIdentity

type EncryptionIdentity struct {
	// Specifies ARM Resource ID of one of the user identities associated with the VM.
	UserAssignedIdentityResourceID *string
}

EncryptionIdentity - Specifies the Managed Identity used by ADE to get access token for keyvault operations.

func (EncryptionIdentity) MarshalJSON

func (e EncryptionIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionIdentity.

func (*EncryptionIdentity) UnmarshalJSON

func (e *EncryptionIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity.

type EncryptionImages

type EncryptionImages struct {
	// A list of encryption specifications for data disk images.
	DataDiskImages []*DataDiskImageEncryption

	// Contains encryption settings for an OS disk image.
	OSDiskImage *OSDiskImageEncryption
}

EncryptionImages - Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact.

func (EncryptionImages) MarshalJSON

func (e EncryptionImages) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionImages.

func (*EncryptionImages) UnmarshalJSON

func (e *EncryptionImages) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionImages.

type EncryptionSetIdentity

type EncryptionSetIdentity struct {
	// The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption
	// Sets can be updated with Identity type None during migration of
	// subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.
	Type *DiskEncryptionSetIdentityType

	// The list of user identities associated with the disk encryption set. The user identity dictionary key references will be
	// ARM resource ids in the form:
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
	UserAssignedIdentities map[string]*UserAssignedIdentitiesValue

	// READ-ONLY; The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id
	// header in the PUT request if the resource has a systemAssigned(implicit)
	// identity
	PrincipalID *string

	// READ-ONLY; The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id
	// header in the PUT request if the resource has a systemAssigned(implicit) identity
	TenantID *string
}

EncryptionSetIdentity - The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks.

func (EncryptionSetIdentity) MarshalJSON

func (e EncryptionSetIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionSetIdentity.

func (*EncryptionSetIdentity) UnmarshalJSON

func (e *EncryptionSetIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetIdentity.

type EncryptionSetProperties

type EncryptionSetProperties struct {
	// The key vault key which is currently used by this disk encryption set.
	ActiveKey *KeyForDiskEncryptionSet

	// The type of key used to encrypt the data of the disk.
	EncryptionType *DiskEncryptionSetType

	// Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the
	// property.
	FederatedClientID *string

	// Set this flag to true to enable auto-updating of this disk encryption set to the latest key version.
	RotationToLatestKeyVersionEnabled *bool

	// READ-ONLY; The error that was encountered during auto-key rotation. If an error is present, then auto-key rotation will
	// not be attempted until the error on this disk encryption set is fixed.
	AutoKeyRotationError *APIError

	// READ-ONLY; The time when the active key of this disk encryption set was updated.
	LastKeyRotationTimestamp *time.Time

	// READ-ONLY; A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is
	// in progress. It will be empty if there is no ongoing key rotation.
	PreviousKeys []*KeyForDiskEncryptionSet

	// READ-ONLY; The disk encryption set provisioning state.
	ProvisioningState *string
}

func (EncryptionSetProperties) MarshalJSON

func (e EncryptionSetProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionSetProperties.

func (*EncryptionSetProperties) UnmarshalJSON

func (e *EncryptionSetProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetProperties.

type EncryptionSettingsCollection

type EncryptionSettingsCollection struct {
	// REQUIRED; Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this
	// flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption.
	// If EncryptionSettings is null in the request object, the existing settings remain unchanged.
	Enabled *bool

	// A collection of encryption settings, one for each disk volume.
	EncryptionSettings []*EncryptionSettingsElement

	// Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds
	// to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk
	// Encryption.
	EncryptionSettingsVersion *string
}

EncryptionSettingsCollection - Encryption settings for disk or snapshot

func (EncryptionSettingsCollection) MarshalJSON

func (e EncryptionSettingsCollection) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionSettingsCollection.

func (*EncryptionSettingsCollection) UnmarshalJSON

func (e *EncryptionSettingsCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSettingsCollection.

type EncryptionSettingsElement

type EncryptionSettingsElement struct {
	// Key Vault Secret Url and vault id of the disk encryption key
	DiskEncryptionKey *KeyVaultAndSecretReference

	// Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap
	// the disk encryption key.
	KeyEncryptionKey *KeyVaultAndKeyReference
}

EncryptionSettingsElement - Encryption settings for one disk volume.

func (EncryptionSettingsElement) MarshalJSON

func (e EncryptionSettingsElement) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EncryptionSettingsElement.

func (*EncryptionSettingsElement) UnmarshalJSON

func (e *EncryptionSettingsElement) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSettingsElement.

type EncryptionType

type EncryptionType string

EncryptionType - The type of key used to encrypt the data of the disk.

const (
	// EncryptionTypeEncryptionAtRestWithCustomerKey - Disk is encrypted at rest with Customer managed key that can be changed
	// and revoked by a customer.
	EncryptionTypeEncryptionAtRestWithCustomerKey EncryptionType = "EncryptionAtRestWithCustomerKey"
	// EncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys - Disk is encrypted at rest with 2 layers of encryption. One
	// of the keys is Customer managed and the other key is Platform managed.
	EncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys EncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys"
	// EncryptionTypeEncryptionAtRestWithPlatformKey - Disk is encrypted at rest with Platform managed key. It is the default
	// encryption type. This is not a valid encryption type for disk encryption sets.
	EncryptionTypeEncryptionAtRestWithPlatformKey EncryptionType = "EncryptionAtRestWithPlatformKey"
)

func PossibleEncryptionTypeValues

func PossibleEncryptionTypeValues() []EncryptionType

PossibleEncryptionTypeValues returns the possible values for the EncryptionType const type.

type EndpointAccess

type EndpointAccess string

EndpointAccess - This property allows you to specify if the requests will be allowed to access the host endpoints. Possible values are: 'Allow', 'Deny'.

const (
	EndpointAccessAllow EndpointAccess = "Allow"
	EndpointAccessDeny  EndpointAccess = "Deny"
)

func PossibleEndpointAccessValues

func PossibleEndpointAccessValues() []EndpointAccess

PossibleEndpointAccessValues returns the possible values for the EndpointAccess const type.

type EndpointTypes

type EndpointTypes string

EndpointTypes - This property allows you to specify the Endpoint type for which this profile is defining the access control for. Possible values are: 'WireServer' or 'IMDS'

const (
	EndpointTypesIMDS       EndpointTypes = "IMDS"
	EndpointTypesWireServer EndpointTypes = "WireServer"
)

func PossibleEndpointTypesValues

func PossibleEndpointTypesValues() []EndpointTypes

PossibleEndpointTypesValues returns the possible values for the EndpointTypes const type.

type EventGridAndResourceGraph

type EventGridAndResourceGraph struct {
	// Specifies if event grid and resource graph is enabled for Scheduled event related configurations.
	Enable *bool

	// Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered.
	ScheduledEventsAPIVersion *string
}

EventGridAndResourceGraph - Specifies eventGridAndResourceGraph related Scheduled Event related configurations.

func (EventGridAndResourceGraph) MarshalJSON

func (e EventGridAndResourceGraph) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EventGridAndResourceGraph.

func (*EventGridAndResourceGraph) UnmarshalJSON

func (e *EventGridAndResourceGraph) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EventGridAndResourceGraph.

type ExecutedValidation

type ExecutedValidation struct {
	// This property specifies the starting timestamp.
	ExecutionTime *time.Time

	// This property specifies the type of image version validation.
	Type *string

	// This property specifies the valid version of the validation.
	Version *string

	// READ-ONLY; This property specifies the status of the validationProfile of the image version.
	Status *ValidationStatus
}

ExecutedValidation - This is the executed Validation.

func (ExecutedValidation) MarshalJSON

func (e ExecutedValidation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExecutedValidation.

func (*ExecutedValidation) UnmarshalJSON

func (e *ExecutedValidation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExecutedValidation.

type ExecutionState

type ExecutionState string

ExecutionState - Script execution status.

const (
	ExecutionStateCanceled  ExecutionState = "Canceled"
	ExecutionStateFailed    ExecutionState = "Failed"
	ExecutionStatePending   ExecutionState = "Pending"
	ExecutionStateRunning   ExecutionState = "Running"
	ExecutionStateSucceeded ExecutionState = "Succeeded"
	ExecutionStateTimedOut  ExecutionState = "TimedOut"
	ExecutionStateUnknown   ExecutionState = "Unknown"
)

func PossibleExecutionStateValues

func PossibleExecutionStateValues() []ExecutionState

PossibleExecutionStateValues returns the possible values for the ExecutionState const type.

type ExpandTypeForListVMs

type ExpandTypeForListVMs string
const (
	ExpandTypeForListVMsInstanceView ExpandTypeForListVMs = "instanceView"
)

func PossibleExpandTypeForListVMsValues

func PossibleExpandTypeForListVMsValues() []ExpandTypeForListVMs

PossibleExpandTypeForListVMsValues returns the possible values for the ExpandTypeForListVMs const type.

type ExpandTypesForGetCapacityReservationGroups

type ExpandTypesForGetCapacityReservationGroups string
const (
	ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef ExpandTypesForGetCapacityReservationGroups = "virtualMachineScaleSetVMs/$ref"
	ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef           ExpandTypesForGetCapacityReservationGroups = "virtualMachines/$ref"
)

func PossibleExpandTypesForGetCapacityReservationGroupsValues

func PossibleExpandTypesForGetCapacityReservationGroupsValues() []ExpandTypesForGetCapacityReservationGroups

PossibleExpandTypesForGetCapacityReservationGroupsValues returns the possible values for the ExpandTypesForGetCapacityReservationGroups const type.

type ExpandTypesForGetVMScaleSets

type ExpandTypesForGetVMScaleSets string
const (
	ExpandTypesForGetVMScaleSetsUserData ExpandTypesForGetVMScaleSets = "userData"
)

func PossibleExpandTypesForGetVMScaleSetsValues

func PossibleExpandTypesForGetVMScaleSetsValues() []ExpandTypesForGetVMScaleSets

PossibleExpandTypesForGetVMScaleSetsValues returns the possible values for the ExpandTypesForGetVMScaleSets const type.

type ExpandTypesForListVMs

type ExpandTypesForListVMs string
const (
	ExpandTypesForListVMsInstanceView ExpandTypesForListVMs = "instanceView"
)

func PossibleExpandTypesForListVMsValues

func PossibleExpandTypesForListVMsValues() []ExpandTypesForListVMs

PossibleExpandTypesForListVMsValues returns the possible values for the ExpandTypesForListVMs const type.

type ExtendedLocation

type ExtendedLocation struct {
	// The name of the extended location.
	Name *string

	// The type of the extended location.
	Type *ExtendedLocationTypes
}

ExtendedLocation - The complex type of the extended location.

func (ExtendedLocation) MarshalJSON

func (e ExtendedLocation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExtendedLocation.

func (*ExtendedLocation) UnmarshalJSON

func (e *ExtendedLocation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation.

type ExtendedLocationType

type ExtendedLocationType string

ExtendedLocationType - The type of the extended location.

const (
	ExtendedLocationTypeEdgeZone ExtendedLocationType = "EdgeZone"
)

func PossibleExtendedLocationTypeValues

func PossibleExtendedLocationTypeValues() []ExtendedLocationType

PossibleExtendedLocationTypeValues returns the possible values for the ExtendedLocationType const type.

type ExtendedLocationTypes

type ExtendedLocationTypes string

ExtendedLocationTypes - The type of extendedLocation.

const (
	ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone"
)

func PossibleExtendedLocationTypesValues

func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes

PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type.

type Extension

type Extension struct {
	// The name of the extension.
	Name *string

	// Extension Properties.
	Properties *CloudServiceExtensionProperties
}

Extension - Describes a cloud service Extension.

func (Extension) MarshalJSON

func (e Extension) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Extension.

func (*Extension) UnmarshalJSON

func (e *Extension) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Extension.

type FileFormat

type FileFormat string

FileFormat - Used to specify the file format when making request for SAS on a VHDX file format snapshot

const (
	// FileFormatVHD - A VHD file is a disk image file in the Virtual Hard Disk file format.
	FileFormatVHD FileFormat = "VHD"
	// FileFormatVHDX - A VHDX file is a disk image file in the Virtual Hard Disk v2 file format.
	FileFormatVHDX FileFormat = "VHDX"
)

func PossibleFileFormatValues

func PossibleFileFormatValues() []FileFormat

PossibleFileFormatValues returns the possible values for the FileFormat const type.

type GalleriesClient

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

GalleriesClient contains the methods for the Galleries group. Don't use this type directly, use NewGalleriesClient() instead.

func NewGalleriesClient

func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleriesClient, error)

NewGalleriesClient creates a new instance of GalleriesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleriesClient) BeginCreateOrUpdate

func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleriesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a Shared Image Gallery. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • gallery - Parameters supplied to the create or update Shared Image Gallery operation.
  • options - GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate method.
Example (CreateACommunityGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/CommunityGallery_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
			SharingProfile: &armcompute.SharingProfile{
				CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
					Eula:             to.Ptr("eula"),
					PublicNamePrefix: to.Ptr("PirPublic"),
					PublisherContact: to.Ptr("pir@microsoft.com"),
					PublisherURI:     to.Ptr("uri"),
				},
				Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		SharingProfile: &armcompute.SharingProfile{
	// 			CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
	// 				Eula: to.Ptr("eula"),
	// 				PublicNamePrefix: to.Ptr("PirPublic"),
	// 				PublisherContact: to.Ptr("pir@microsoft.com"),
	// 				PublisherURI: to.Ptr("uri"),
	// 			},
	// 			Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryWithSharingProfile)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
			SharingProfile: &armcompute.SharingProfile{
				Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		SharingProfile: &armcompute.SharingProfile{
	// 			Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryWithSoftDeletionEnabled)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
			SoftDeletePolicy: &armcompute.SoftDeletePolicy{
				IsSoftDeleteEnabled: to.Ptr(true),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		SoftDeletePolicy: &armcompute.SoftDeletePolicy{
	// 			IsSoftDeleteEnabled: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryWithSystemAssignedAndUserAssignedManagedIdentities)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Create_WithManagedIdentity.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
		Location: to.Ptr("West US"),
		Identity: &armcompute.GalleryIdentity{
			Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssignedUserAssigned),
			UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
				"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {},
			},
		},
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.GalleryIdentity{
	// 		Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssignedUserAssigned),
	// 		PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
	// 			"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcompute.UserAssignedIdentitiesValue{
	// 			},
	// 		},
	// 	},
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleriesClient) BeginDelete

func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*runtime.Poller[GalleriesClientDeleteResponse], error)

BeginDelete - Delete a Shared Image Gallery. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleriesClient) BeginUpdate

func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*runtime.Poller[GalleriesClientUpdateResponse], error)

BeginUpdate - Update a Shared Image Gallery. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • gallery - Parameters supplied to the update Shared Image Gallery operation.
  • options - GalleriesClientBeginUpdateOptions contains the optional parameters for the GalleriesClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleriesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.GalleryUpdate{
		Properties: &armcompute.GalleryProperties{
			Description: to.Ptr("This is the gallery description."),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleriesClient) Get

func (client *GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientGetOptions) (GalleriesClientGetResponse, error)

Get - Retrieves information about a Shared Image Gallery. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method.
Example (GetACommunityGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/CommunityGallery_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
		Expand: 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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/communityGalleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		SharingProfile: &armcompute.SharingProfile{
	// 			CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
	// 				CommunityGalleryEnabled: to.Ptr(true),
	// 				Eula: to.Ptr("eula"),
	// 				PublicNames: []*string{
	// 					to.Ptr("GalleryPublicName")},
	// 					PublisherContact: to.Ptr("pir@microsoft.com"),
	// 					PublisherURI: to.Ptr("uri"),
	// 				},
	// 				Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
	// 			},
	// 			SharingStatus: &armcompute.SharingStatus{
	// 				AggregatedState: to.Ptr(armcompute.SharingStateSucceeded),
	// 				Summary: []*armcompute.RegionalSharingStatus{
	// 					{
	// 						Region: to.Ptr("westus"),
	// 						State: to.Ptr(armcompute.SharingStateSucceeded),
	// 						Details: to.Ptr(""),
	// 				}},
	// 			},
	// 		},
	// 	}
}
Example (GetAGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
		Expand: 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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}
Example (GetAGalleryWithExpandSharingProfileGroups)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
		Expand: to.Ptr(armcompute.GalleryExpandParamsSharingProfileGroups),
	})
	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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		SharingProfile: &armcompute.SharingProfile{
	// 			Groups: []*armcompute.SharingProfileGroup{
	// 				{
	// 					Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
	// 					IDs: []*string{
	// 						to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
	// 						to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
	// 					},
	// 					{
	// 						Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
	// 						IDs: []*string{
	// 							to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
	// 					}},
	// 					Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
	// 				},
	// 			},
	// 		}
}
Example (GetAGalleryWithSelectPermissions)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: to.Ptr(armcompute.SelectPermissionsPermissions),
		Expand: 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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryProperties{
	// 		SharingProfile: &armcompute.SharingProfile{
	// 			Groups: []*armcompute.SharingProfileGroup{
	// 				{
	// 					Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
	// 					IDs: []*string{
	// 						to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
	// 						to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
	// 					},
	// 					{
	// 						Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
	// 						IDs: []*string{
	// 							to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
	// 					}},
	// 					Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
	// 				},
	// 			},
	// 		}
}
Example (GetAGalleryWithSystemAssignedAndUserAssignedManagedIdentities)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_Get_WithManagedIdentity.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
		Expand: 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.Gallery = armcompute.Gallery{
	// 	Name: to.Ptr("myGalleryName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
	// 	Location: to.Ptr("West US"),
	// 	Identity: &armcompute.GalleryIdentity{
	// 		Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssignedUserAssigned),
	// 		PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
	// 			"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcompute.UserAssignedIdentitiesValue{
	// 				ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 				PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 			},
	// 		},
	// 	},
	// 	Properties: &armcompute.GalleryProperties{
	// 		Description: to.Ptr("This is the gallery description."),
	// 		Identifier: &armcompute.GalleryIdentifier{
	// 			UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
	// 		},
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleriesClient) NewListByResourceGroupPager

func (client *GalleriesClient) NewListByResourceGroupPager(resourceGroupName string, options *GalleriesClientListByResourceGroupOptions) *runtime.Pager[GalleriesClientListByResourceGroupResponse]

NewListByResourceGroupPager - List galleries under a resource group.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleriesClient().NewListByResourceGroupPager("myResourceGroup", 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.GalleryList = armcompute.GalleryList{
		// 	Value: []*armcompute.Gallery{
		// 		{
		// 			Name: to.Ptr("myGalleryName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryProperties{
		// 				Description: to.Ptr("This is the gallery description."),
		// 				Identifier: &armcompute.GalleryIdentifier{
		// 					UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
		// 				},
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}

func (*GalleriesClient) NewListPager

NewListPager - List galleries under a subscription.

Generated from API version 2025-03-03

  • options - GalleriesClientListOptions contains the optional parameters for the GalleriesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_ListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleriesClient().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.GalleryList = armcompute.GalleryList{
		// 	Value: []*armcompute.Gallery{
		// 		{
		// 			Name: to.Ptr("myGalleryName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryProperties{
		// 				Description: to.Ptr("This is the gallery description."),
		// 				Identifier: &armcompute.GalleryIdentifier{
		// 					UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"),
		// 				},
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}

type GalleriesClientBeginCreateOrUpdateOptions

type GalleriesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate method.

type GalleriesClientBeginDeleteOptions

type GalleriesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method.

type GalleriesClientBeginUpdateOptions

type GalleriesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleriesClientBeginUpdateOptions contains the optional parameters for the GalleriesClient.BeginUpdate method.

type GalleriesClientCreateOrUpdateResponse

type GalleriesClientCreateOrUpdateResponse struct {
	// Specifies information about the Shared Image Gallery that you want to create or update.
	Gallery
}

GalleriesClientCreateOrUpdateResponse contains the response from method GalleriesClient.BeginCreateOrUpdate.

type GalleriesClientDeleteResponse

type GalleriesClientDeleteResponse struct {
}

GalleriesClientDeleteResponse contains the response from method GalleriesClient.BeginDelete.

type GalleriesClientGetOptions

type GalleriesClientGetOptions struct {
	// The expand query option to apply on the operation.
	Expand *GalleryExpandParams

	// The select expression to apply on the operation.
	Select *SelectPermissions
}

GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method.

type GalleriesClientGetResponse

type GalleriesClientGetResponse struct {
	// Specifies information about the Shared Image Gallery that you want to create or update.
	Gallery
}

GalleriesClientGetResponse contains the response from method GalleriesClient.Get.

type GalleriesClientListByResourceGroupOptions

type GalleriesClientListByResourceGroupOptions struct {
}

GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.NewListByResourceGroupPager method.

type GalleriesClientListByResourceGroupResponse

type GalleriesClientListByResourceGroupResponse struct {
	// The List Galleries operation response.
	GalleryList
}

GalleriesClientListByResourceGroupResponse contains the response from method GalleriesClient.NewListByResourceGroupPager.

type GalleriesClientListOptions

type GalleriesClientListOptions struct {
}

GalleriesClientListOptions contains the optional parameters for the GalleriesClient.NewListPager method.

type GalleriesClientListResponse

type GalleriesClientListResponse struct {
	// The List Galleries operation response.
	GalleryList
}

GalleriesClientListResponse contains the response from method GalleriesClient.NewListPager.

type GalleriesClientUpdateResponse

type GalleriesClientUpdateResponse struct {
	// Specifies information about the Shared Image Gallery that you want to create or update.
	Gallery
}

GalleriesClientUpdateResponse contains the response from method GalleriesClient.BeginUpdate.

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

	// The identity of the gallery, if configured.
	Identity *GalleryIdentity

	// Describes the properties of a Shared Image Gallery.
	Properties *GalleryProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

Gallery - Specifies information about the Shared Image Gallery that you want to create or update.

func (Gallery) MarshalJSON

func (g Gallery) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Gallery.

func (*Gallery) UnmarshalJSON

func (g *Gallery) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Gallery.

type GalleryApplication

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

	// Describes the properties of a gallery Application Definition.
	Properties *GalleryApplicationProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryApplication - Specifies information about the gallery Application Definition that you want to create or update.

func (GalleryApplication) MarshalJSON

func (g GalleryApplication) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplication.

func (*GalleryApplication) UnmarshalJSON

func (g *GalleryApplication) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplication.

type GalleryApplicationCustomAction

type GalleryApplicationCustomAction struct {
	// REQUIRED; The name of the custom action. Must be unique within the Gallery Application Version.
	Name *string

	// REQUIRED; The script to run when executing this custom action.
	Script *string

	// Description to help the users understand what this custom action does.
	Description *string

	// The parameters that this custom action uses
	Parameters []*GalleryApplicationCustomActionParameter
}

GalleryApplicationCustomAction - A custom action that can be performed with a Gallery Application Version.

func (GalleryApplicationCustomAction) MarshalJSON

func (g GalleryApplicationCustomAction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationCustomAction.

func (*GalleryApplicationCustomAction) UnmarshalJSON

func (g *GalleryApplicationCustomAction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationCustomAction.

type GalleryApplicationCustomActionParameter

type GalleryApplicationCustomActionParameter struct {
	// REQUIRED; The name of the custom action. Must be unique within the Gallery Application Version.
	Name *string

	// The default value of the parameter. Only applies to string types
	DefaultValue *string

	// A description to help users understand what this parameter means
	Description *string

	// Indicates whether this parameter must be passed when running the custom action.
	Required *bool

	// Specifies the type of the custom action parameter. Possible values are: String, ConfigurationDataBlob or LogOutputBlob
	Type *GalleryApplicationCustomActionParameterType
}

GalleryApplicationCustomActionParameter - The definition of a parameter that can be passed to a custom action of a Gallery Application Version.

func (GalleryApplicationCustomActionParameter) MarshalJSON

func (g GalleryApplicationCustomActionParameter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationCustomActionParameter.

func (*GalleryApplicationCustomActionParameter) UnmarshalJSON

func (g *GalleryApplicationCustomActionParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationCustomActionParameter.

type GalleryApplicationCustomActionParameterType

type GalleryApplicationCustomActionParameterType string

GalleryApplicationCustomActionParameterType - Specifies the type of the custom action parameter. Possible values are: String, ConfigurationDataBlob or LogOutputBlob

const (
	GalleryApplicationCustomActionParameterTypeConfigurationDataBlob GalleryApplicationCustomActionParameterType = "ConfigurationDataBlob"
	GalleryApplicationCustomActionParameterTypeLogOutputBlob         GalleryApplicationCustomActionParameterType = "LogOutputBlob"
	GalleryApplicationCustomActionParameterTypeString                GalleryApplicationCustomActionParameterType = "String"
)

func PossibleGalleryApplicationCustomActionParameterTypeValues

func PossibleGalleryApplicationCustomActionParameterTypeValues() []GalleryApplicationCustomActionParameterType

PossibleGalleryApplicationCustomActionParameterTypeValues returns the possible values for the GalleryApplicationCustomActionParameterType const type.

type GalleryApplicationList

type GalleryApplicationList struct {
	// REQUIRED; The GalleryApplication items on this page
	Value []*GalleryApplication

	// The link to the next page of items
	NextLink *string
}

GalleryApplicationList - The List Gallery Applications operation response.

func (GalleryApplicationList) MarshalJSON

func (g GalleryApplicationList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationList.

func (*GalleryApplicationList) UnmarshalJSON

func (g *GalleryApplicationList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationList.

type GalleryApplicationProperties

type GalleryApplicationProperties struct {
	// REQUIRED; This property allows you to specify the supported type of the OS that application is built for. Possible values
	// are: Windows, Linux.
	SupportedOSType *OperatingSystemTypes

	// A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application.
	CustomActions []*GalleryApplicationCustomAction

	// The description of this gallery Application Definition resource. This property is updatable.
	Description *string

	// The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This
	// property is updatable.
	EndOfLifeDate *time.Time

	// The Eula agreement for the gallery Application Definition.
	Eula *string

	// The privacy statement uri.
	PrivacyStatementURI *string

	// The release note uri.
	ReleaseNoteURI *string
}

GalleryApplicationProperties - Describes the properties of a gallery Application Definition.

func (GalleryApplicationProperties) MarshalJSON

func (g GalleryApplicationProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationProperties.

func (*GalleryApplicationProperties) UnmarshalJSON

func (g *GalleryApplicationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationProperties.

type GalleryApplicationScriptRebootBehavior

type GalleryApplicationScriptRebootBehavior string

GalleryApplicationScriptRebootBehavior - Optional. The action to be taken with regards to install/update/remove of the gallery application in the event of a reboot.

const (
	GalleryApplicationScriptRebootBehaviorNone  GalleryApplicationScriptRebootBehavior = "None"
	GalleryApplicationScriptRebootBehaviorRerun GalleryApplicationScriptRebootBehavior = "Rerun"
)

func PossibleGalleryApplicationScriptRebootBehaviorValues

func PossibleGalleryApplicationScriptRebootBehaviorValues() []GalleryApplicationScriptRebootBehavior

PossibleGalleryApplicationScriptRebootBehaviorValues returns the possible values for the GalleryApplicationScriptRebootBehavior const type.

type GalleryApplicationUpdate

type GalleryApplicationUpdate struct {
	// Describes the properties of a gallery Application Definition.
	Properties *GalleryApplicationProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryApplicationUpdate - Specifies information about the gallery Application Definition that you want to update.

func (GalleryApplicationUpdate) MarshalJSON

func (g GalleryApplicationUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationUpdate.

func (*GalleryApplicationUpdate) UnmarshalJSON

func (g *GalleryApplicationUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationUpdate.

type GalleryApplicationVersion

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

	// Describes the properties of a gallery image version.
	Properties *GalleryApplicationVersionProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryApplicationVersion - Specifies information about the gallery Application Version that you want to create or update.

func (GalleryApplicationVersion) MarshalJSON

func (g GalleryApplicationVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersion.

func (*GalleryApplicationVersion) UnmarshalJSON

func (g *GalleryApplicationVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersion.

type GalleryApplicationVersionList

type GalleryApplicationVersionList struct {
	// REQUIRED; A list of gallery Application Versions.
	Value []*GalleryApplicationVersion

	// The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery
	// Application Versions.
	NextLink *string
}

GalleryApplicationVersionList - The List Gallery Application version operation response.

func (GalleryApplicationVersionList) MarshalJSON

func (g GalleryApplicationVersionList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionList.

func (*GalleryApplicationVersionList) UnmarshalJSON

func (g *GalleryApplicationVersionList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionList.

type GalleryApplicationVersionProperties

type GalleryApplicationVersionProperties struct {
	// REQUIRED; The publishing profile of a gallery image version.
	PublishingProfile *GalleryApplicationVersionPublishingProfile

	// The safety profile of the Gallery Application Version.
	SafetyProfile *GalleryApplicationVersionSafetyProfile

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState

	// READ-ONLY; This is the replication status of the gallery image version.
	ReplicationStatus *ReplicationStatus
}

GalleryApplicationVersionProperties - Describes the properties of a gallery image version.

func (GalleryApplicationVersionProperties) MarshalJSON

func (g GalleryApplicationVersionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionProperties.

func (*GalleryApplicationVersionProperties) UnmarshalJSON

func (g *GalleryApplicationVersionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionProperties.

type GalleryApplicationVersionPublishingProfile

type GalleryApplicationVersionPublishingProfile struct {
	// REQUIRED; The source image from which the Image Version is going to be created.
	Source *UserArtifactSource

	// Optional. Additional settings to pass to the vm-application-manager extension. For advanced use only.
	AdvancedSettings map[string]*string

	// A list of custom actions that can be performed with this Gallery Application Version.
	CustomActions []*GalleryApplicationCustomAction

	// Optional. Whether or not this application reports health.
	EnableHealthCheck *bool

	// The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.
	ExcludeFromLatest *bool
	ManageActions     *UserArtifactManage

	// The number of replicas of the Image Version to be created per region. This property would take effect for a region when
	// regionalReplicaCount is not specified. This property is updatable.
	ReplicaCount *int32

	// Optional parameter which specifies the mode to be used for replication. This property is not updatable.
	ReplicationMode *ReplicationMode

	// Additional settings for the VM app that contains the target package and config file name when it is deployed to target
	// VM or VM scale set.
	Settings *UserArtifactSettings

	// Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType,
	// but can be overridden per region by specifying
	// targetRegions[].storageAccountType. This property is not updatable.
	StorageAccountStrategy *StorageAccountStrategy

	// Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy.
	// This property is not updatable.
	StorageAccountType *StorageAccountType

	// The target extended locations where the Image Version is going to be replicated to. This property is updatable.
	TargetExtendedLocations []*GalleryTargetExtendedLocation

	// The target regions where the Image Version is going to be replicated to. This property is updatable.
	TargetRegions []*TargetRegion

	// READ-ONLY; The timestamp for when the gallery image version is published.
	PublishedDate *time.Time
}

GalleryApplicationVersionPublishingProfile - The publishing profile of a gallery image version.

func (GalleryApplicationVersionPublishingProfile) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionPublishingProfile.

func (*GalleryApplicationVersionPublishingProfile) UnmarshalJSON

func (g *GalleryApplicationVersionPublishingProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionPublishingProfile.

type GalleryApplicationVersionSafetyProfile

type GalleryApplicationVersionSafetyProfile struct {
	// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed.
	AllowDeletionOfReplicatedLocations *bool
}

GalleryApplicationVersionSafetyProfile - The safety profile of the Gallery Application Version.

func (GalleryApplicationVersionSafetyProfile) MarshalJSON

func (g GalleryApplicationVersionSafetyProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionSafetyProfile.

func (*GalleryApplicationVersionSafetyProfile) UnmarshalJSON

func (g *GalleryApplicationVersionSafetyProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionSafetyProfile.

type GalleryApplicationVersionUpdate

type GalleryApplicationVersionUpdate struct {
	// Describes the properties of a gallery image version.
	Properties *GalleryApplicationVersionProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryApplicationVersionUpdate - Specifies information about the gallery Application Version that you want to update.

func (GalleryApplicationVersionUpdate) MarshalJSON

func (g GalleryApplicationVersionUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionUpdate.

func (*GalleryApplicationVersionUpdate) UnmarshalJSON

func (g *GalleryApplicationVersionUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionUpdate.

type GalleryApplicationVersionsClient

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

GalleryApplicationVersionsClient contains the methods for the GalleryApplicationVersions group. Don't use this type directly, use NewGalleryApplicationVersionsClient() instead.

func NewGalleryApplicationVersionsClient

func NewGalleryApplicationVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryApplicationVersionsClient, error)

NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryApplicationVersionsClient) BeginCreateOrUpdate

func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryApplicationVersionsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery Application Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplicationVersionName - The name of the gallery Application Version to be retrieved.
  • galleryApplicationVersion - Parameters supplied to the create or update gallery Application Version operation.
  • options - GalleryApplicationVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryApplicationVersionProperties{
			PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
				EndOfLifeDate:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t }()),
				ReplicaCount:       to.Ptr[int32](1),
				StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardLRS),
					}},
				CustomActions: []*armcompute.GalleryApplicationCustomAction{
					{
						Name:        to.Ptr("myCustomAction"),
						Description: to.Ptr("This is the custom action description."),
						Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
							{
								Name:         to.Ptr("myCustomActionParameter"),
								Type:         to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
								Description:  to.Ptr("This is the description of the parameter"),
								DefaultValue: to.Ptr("default value of parameter."),
								Required:     to.Ptr(false),
							}},
						Script: to.Ptr("myCustomActionScript"),
					}},
				ManageActions: &armcompute.UserArtifactManage{
					Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
					Remove:  to.Ptr("del C:\\package "),
				},
				Source: &armcompute.UserArtifactSource{
					MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
				},
			},
			SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"),
	// 	ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			AdvancedSettings: map[string]*string{
	// 				"timeout": to.Ptr("300"),
	// 				"user": to.Ptr("root"),
	// 			},
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Required: to.Ptr(false),
	// 					}},
	// 					Script: to.Ptr("myCustomActionScript"),
	// 			}},
	// 			EnableHealthCheck: to.Ptr(false),
	// 			ManageActions: &armcompute.UserArtifactManage{
	// 				Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
	// 				Remove: to.Ptr("del C:\\package "),
	// 			},
	// 			Settings: &armcompute.UserArtifactSettings{
	// 				ConfigFileName: to.Ptr("configuration.cfg"),
	// 				PackageFileName: to.Ptr("package.zip"),
	// 			},
	// 			Source: &armcompute.UserArtifactSource{
	// 				MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
	// 			},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 		},
	// 	},
	// }
}

func (*GalleryApplicationVersionsClient) BeginDelete

func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryApplicationVersionsClientDeleteResponse], error)

BeginDelete - Delete a gallery Application Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplicationVersionName - The name of the gallery Application Version to be retrieved.
  • options - GalleryApplicationVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryApplicationVersionsClient) BeginUpdate

func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryApplicationVersionsClientUpdateResponse], error)

BeginUpdate - Update a gallery Application Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplicationVersionName - The name of the gallery Application Version to be retrieved.
  • galleryApplicationVersion - Parameters supplied to the update gallery Application Version operation.
  • options - GalleryApplicationVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersionUpdate{
		Properties: &armcompute.GalleryApplicationVersionProperties{
			PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
				EndOfLifeDate:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t }()),
				ReplicaCount:       to.Ptr[int32](1),
				StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardLRS),
					}},
				ManageActions: &armcompute.UserArtifactManage{
					Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
					Remove:  to.Ptr("del C:\\package "),
				},
				Source: &armcompute.UserArtifactSource{
					MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
				},
			},
			SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"),
	// 	ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			EnableHealthCheck: to.Ptr(false),
	// 			ManageActions: &armcompute.UserArtifactManage{
	// 				Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
	// 				Remove: to.Ptr("del C:\\package "),
	// 			},
	// 			Source: &armcompute.UserArtifactSource{
	// 				MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
	// 			},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 		},
	// 	},
	// }
}

func (*GalleryApplicationVersionsClient) Get

func (client *GalleryApplicationVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientGetOptions) (GalleryApplicationVersionsClientGetResponse, error)

Get - Retrieves information about a gallery Application Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplicationVersionName - The name of the gallery Application Version to be retrieved.
  • options - GalleryApplicationVersionsClientGetOptions contains the optional parameters for the GalleryApplicationVersionsClient.Get method.
Example (GetAGalleryApplicationVersion)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: 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.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"),
	// 	ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Required: to.Ptr(false),
	// 					}},
	// 					Script: to.Ptr("myCustomActionScript"),
	// 			}},
	// 			EnableHealthCheck: to.Ptr(false),
	// 			ManageActions: &armcompute.UserArtifactManage{
	// 				Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
	// 				Remove: to.Ptr("del C:\\package "),
	// 			},
	// 			Source: &armcompute.UserArtifactSource{
	// 				MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
	// 			},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 		},
	// 	},
	// }
}
Example (GetAGalleryApplicationVersionWithReplicationStatus)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)})
	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.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			AdvancedSettings: map[string]*string{
	// 				"timeout": to.Ptr("300"),
	// 				"user": to.Ptr("root"),
	// 			},
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Required: to.Ptr(false),
	// 					}},
	// 					Script: to.Ptr("myCustomActionScript"),
	// 			}},
	// 			EnableHealthCheck: to.Ptr(false),
	// 			ManageActions: &armcompute.UserArtifactManage{
	// 				Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
	// 				Remove: to.Ptr("del C:\\package "),
	// 			},
	// 			Settings: &armcompute.UserArtifactSettings{
	// 				ConfigFileName: to.Ptr("configuration.cfg"),
	// 				PackageFileName: to.Ptr("package.zip"),
	// 			},
	// 			Source: &armcompute.UserArtifactSource{
	// 				MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
	// 			},
	// 		},
	// 		ReplicationStatus: &armcompute.ReplicationStatus{
	// 			AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted),
	// 			Summary: []*armcompute.RegionalReplicationStatus{
	// 				{
	// 					Progress: to.Ptr[int32](100),
	// 					Region: to.Ptr("West US"),
	// 					State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 					Details: to.Ptr(""),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 		},
	// 	},
	// }
}

func (*GalleryApplicationVersionsClient) NewListByGalleryApplicationPager

NewListByGalleryApplicationPager - List gallery Application Versions in a gallery Application Definition.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • options - GalleryApplicationVersionsClientListByGalleryApplicationOptions contains the optional parameters for the GalleryApplicationVersionsClient.NewListByGalleryApplicationPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryApplicationVersionsClient().NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", 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.GalleryApplicationVersionList = armcompute.GalleryApplicationVersionList{
		// 	Value: []*armcompute.GalleryApplicationVersion{
		// 		{
		// 			Name: to.Ptr("1.0.0"),
		// 			Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"),
		// 			ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryApplicationVersionProperties{
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
		// 					EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()),
		// 					ExcludeFromLatest: to.Ptr(false),
		// 					PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); return t}()),
		// 					ReplicaCount: to.Ptr[int32](1),
		// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					TargetRegions: []*armcompute.TargetRegion{
		// 						{
		// 							Name: to.Ptr("West US"),
		// 							ExcludeFromLatest: to.Ptr(false),
		// 							RegionalReplicaCount: to.Ptr[int32](1),
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					}},
		// 					CustomActions: []*armcompute.GalleryApplicationCustomAction{
		// 						{
		// 							Name: to.Ptr("myCustomAction"),
		// 							Description: to.Ptr("This is the custom action description."),
		// 							Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
		// 								{
		// 									Name: to.Ptr("myCustomActionParameter"),
		// 									Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
		// 									Description: to.Ptr("This is the description of the parameter"),
		// 									DefaultValue: to.Ptr("default value of parameter."),
		// 									Required: to.Ptr(false),
		// 							}},
		// 							Script: to.Ptr("myCustomActionScript"),
		// 					}},
		// 					EnableHealthCheck: to.Ptr(false),
		// 					ManageActions: &armcompute.UserArtifactManage{
		// 						Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
		// 						Remove: to.Ptr("del C:\\package "),
		// 					},
		// 					Source: &armcompute.UserArtifactSource{
		// 						MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
		// 					},
		// 				},
		// 				SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
		// 					AllowDeletionOfReplicatedLocations: to.Ptr(false),
		// 				},
		// 			},
		// 	}},
		// }
	}
}

type GalleryApplicationVersionsClientBeginCreateOrUpdateOptions

type GalleryApplicationVersionsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginCreateOrUpdate method.

type GalleryApplicationVersionsClientBeginDeleteOptions

type GalleryApplicationVersionsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginDelete method.

type GalleryApplicationVersionsClientBeginUpdateOptions

type GalleryApplicationVersionsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginUpdate method.

type GalleryApplicationVersionsClientCreateOrUpdateResponse

type GalleryApplicationVersionsClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery Application Version that you want to create or update.
	GalleryApplicationVersion
}

GalleryApplicationVersionsClientCreateOrUpdateResponse contains the response from method GalleryApplicationVersionsClient.BeginCreateOrUpdate.

type GalleryApplicationVersionsClientDeleteResponse

type GalleryApplicationVersionsClientDeleteResponse struct {
}

GalleryApplicationVersionsClientDeleteResponse contains the response from method GalleryApplicationVersionsClient.BeginDelete.

type GalleryApplicationVersionsClientGetOptions

type GalleryApplicationVersionsClientGetOptions struct {
	// The expand expression to apply on the operation.
	Expand *ReplicationStatusTypes
}

GalleryApplicationVersionsClientGetOptions contains the optional parameters for the GalleryApplicationVersionsClient.Get method.

type GalleryApplicationVersionsClientGetResponse

type GalleryApplicationVersionsClientGetResponse struct {
	// Specifies information about the gallery Application Version that you want to create or update.
	GalleryApplicationVersion
}

GalleryApplicationVersionsClientGetResponse contains the response from method GalleryApplicationVersionsClient.Get.

type GalleryApplicationVersionsClientListByGalleryApplicationOptions

type GalleryApplicationVersionsClientListByGalleryApplicationOptions struct {
}

GalleryApplicationVersionsClientListByGalleryApplicationOptions contains the optional parameters for the GalleryApplicationVersionsClient.NewListByGalleryApplicationPager method.

type GalleryApplicationVersionsClientListByGalleryApplicationResponse

type GalleryApplicationVersionsClientListByGalleryApplicationResponse struct {
	// The List Gallery Application version operation response.
	GalleryApplicationVersionList
}

GalleryApplicationVersionsClientListByGalleryApplicationResponse contains the response from method GalleryApplicationVersionsClient.NewListByGalleryApplicationPager.

type GalleryApplicationVersionsClientUpdateResponse

type GalleryApplicationVersionsClientUpdateResponse struct {
	// Specifies information about the gallery Application Version that you want to create or update.
	GalleryApplicationVersion
}

GalleryApplicationVersionsClientUpdateResponse contains the response from method GalleryApplicationVersionsClient.BeginUpdate.

type GalleryApplicationsClient

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

GalleryApplicationsClient contains the methods for the GalleryApplications group. Don't use this type directly, use NewGalleryApplicationsClient() instead.

func NewGalleryApplicationsClient

func NewGalleryApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryApplicationsClient, error)

NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryApplicationsClient) BeginCreateOrUpdate

func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryApplicationsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery Application Definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplication - Parameters supplied to the create or update gallery Application operation.
  • options - GalleryApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplication_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplication{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryApplicationProperties{
			Description: to.Ptr("This is the gallery application description."),
			CustomActions: []*armcompute.GalleryApplicationCustomAction{
				{
					Name:        to.Ptr("myCustomAction"),
					Description: to.Ptr("This is the custom action description."),
					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
						{
							Name:         to.Ptr("myCustomActionParameter"),
							Type:         to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
							Description:  to.Ptr("This is the description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter."),
							Required:     to.Ptr(false),
						}},
					Script: to.Ptr("myCustomActionScript"),
				}},
			Eula:                to.Ptr("This is the gallery application EULA."),
			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("myReleaseNoteUri"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryApplication = armcompute.GalleryApplication{
	// 	Name: to.Ptr("myGalleryApplicationName"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationProperties{
	// 		Description: to.Ptr("This is the gallery application description."),
	// 		CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 			{
	// 				Name: to.Ptr("myCustomAction"),
	// 				Description: to.Ptr("This is the custom action description."),
	// 				Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 					{
	// 						Name: to.Ptr("myCustomActionParameter"),
	// 						Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 						Description: to.Ptr("This is the description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter."),
	// 						Required: to.Ptr(false),
	// 				}},
	// 				Script: to.Ptr("myCustomActionScript"),
	// 		}},
	// 		Eula: to.Ptr("This is the gallery application EULA."),
	// 		PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 		ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryApplicationsClient) BeginDelete

func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*runtime.Poller[GalleryApplicationsClientDeleteResponse], error)

BeginDelete - Delete a gallery Application. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • options - GalleryApplicationsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplication_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryApplicationsClient) BeginUpdate

func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*runtime.Poller[GalleryApplicationsClientUpdateResponse], error)

BeginUpdate - Update a gallery Application Definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • galleryApplication - Parameters supplied to the update gallery Application operation.
  • options - GalleryApplicationsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplication_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplicationUpdate{
		Properties: &armcompute.GalleryApplicationProperties{
			Description: to.Ptr("This is the gallery application description."),
			CustomActions: []*armcompute.GalleryApplicationCustomAction{
				{
					Name:        to.Ptr("myCustomAction"),
					Description: to.Ptr("This is the custom action description."),
					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
						{
							Name:         to.Ptr("myCustomActionParameter"),
							Type:         to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
							Description:  to.Ptr("This is the description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter."),
							Required:     to.Ptr(false),
						}},
					Script: to.Ptr("myCustomActionScript"),
				}},
			Eula:                to.Ptr("This is the gallery application EULA."),
			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("myReleaseNoteUri"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryApplication = armcompute.GalleryApplication{
	// 	Name: to.Ptr("myGalleryApplicationName"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationProperties{
	// 		Description: to.Ptr("This is the gallery application description."),
	// 		CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 			{
	// 				Name: to.Ptr("myCustomAction"),
	// 				Description: to.Ptr("This is the custom action description."),
	// 				Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 					{
	// 						Name: to.Ptr("myCustomActionParameter"),
	// 						Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 						Description: to.Ptr("This is the description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter."),
	// 						Required: to.Ptr(false),
	// 				}},
	// 				Script: to.Ptr("myCustomActionScript"),
	// 		}},
	// 		Eula: to.Ptr("This is the gallery application EULA."),
	// 		PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 		ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryApplicationsClient) Get

func (client *GalleryApplicationsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientGetOptions) (GalleryApplicationsClientGetResponse, error)

Get - Retrieves information about a gallery Application Definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryApplicationName - The name of the gallery Application Definition to be retrieved.
  • options - GalleryApplicationsClientGetOptions contains the optional parameters for the GalleryApplicationsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplication_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryApplicationsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", 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.GalleryApplication = armcompute.GalleryApplication{
	// 	Name: to.Ptr("myGalleryApplicationName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryApplicationProperties{
	// 		Description: to.Ptr("This is the gallery application description."),
	// 		CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 			{
	// 				Name: to.Ptr("myCustomAction"),
	// 				Description: to.Ptr("This is the custom action description."),
	// 				Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 					{
	// 						Name: to.Ptr("myCustomActionParameter"),
	// 						Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 						Description: to.Ptr("This is the description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter."),
	// 						Required: to.Ptr(false),
	// 				}},
	// 				Script: to.Ptr("myCustomActionScript"),
	// 		}},
	// 		Eula: to.Ptr("This is the gallery application EULA."),
	// 		PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 		ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryApplicationsClient) NewListByGalleryPager

NewListByGalleryPager - List gallery Application Definitions in a gallery.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.NewListByGalleryPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryApplicationsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", 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.GalleryApplicationList = armcompute.GalleryApplicationList{
		// 	Value: []*armcompute.GalleryApplication{
		// 		{
		// 			Name: to.Ptr("myGalleryApplicationName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryApplicationProperties{
		// 				Description: to.Ptr("This is the gallery application description."),
		// 				CustomActions: []*armcompute.GalleryApplicationCustomAction{
		// 					{
		// 						Name: to.Ptr("myCustomAction"),
		// 						Description: to.Ptr("This is the custom action description."),
		// 						Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
		// 							{
		// 								Name: to.Ptr("myCustomActionParameter"),
		// 								Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
		// 								Description: to.Ptr("This is the description of the parameter"),
		// 								DefaultValue: to.Ptr("default value of parameter."),
		// 								Required: to.Ptr(false),
		// 						}},
		// 						Script: to.Ptr("myCustomActionScript"),
		// 				}},
		// 				Eula: to.Ptr("This is the gallery application EULA."),
		// 				PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
		// 				ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
		// 				SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 			},
		// 	}},
		// }
	}
}

type GalleryApplicationsClientBeginCreateOrUpdateOptions

type GalleryApplicationsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginCreateOrUpdate method.

type GalleryApplicationsClientBeginDeleteOptions

type GalleryApplicationsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationsClient.BeginDelete method.

type GalleryApplicationsClientBeginUpdateOptions

type GalleryApplicationsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryApplicationsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginUpdate method.

type GalleryApplicationsClientCreateOrUpdateResponse

type GalleryApplicationsClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery Application Definition that you want to create or update.
	GalleryApplication
}

GalleryApplicationsClientCreateOrUpdateResponse contains the response from method GalleryApplicationsClient.BeginCreateOrUpdate.

type GalleryApplicationsClientDeleteResponse

type GalleryApplicationsClientDeleteResponse struct {
}

GalleryApplicationsClientDeleteResponse contains the response from method GalleryApplicationsClient.BeginDelete.

type GalleryApplicationsClientGetOptions

type GalleryApplicationsClientGetOptions struct {
}

GalleryApplicationsClientGetOptions contains the optional parameters for the GalleryApplicationsClient.Get method.

type GalleryApplicationsClientGetResponse

type GalleryApplicationsClientGetResponse struct {
	// Specifies information about the gallery Application Definition that you want to create or update.
	GalleryApplication
}

GalleryApplicationsClientGetResponse contains the response from method GalleryApplicationsClient.Get.

type GalleryApplicationsClientListByGalleryOptions

type GalleryApplicationsClientListByGalleryOptions struct {
}

GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.NewListByGalleryPager method.

type GalleryApplicationsClientListByGalleryResponse

type GalleryApplicationsClientListByGalleryResponse struct {
	// The List Gallery Applications operation response.
	GalleryApplicationList
}

GalleryApplicationsClientListByGalleryResponse contains the response from method GalleryApplicationsClient.NewListByGalleryPager.

type GalleryApplicationsClientUpdateResponse

type GalleryApplicationsClientUpdateResponse struct {
	// Specifies information about the gallery Application Definition that you want to create or update.
	GalleryApplication
}

GalleryApplicationsClientUpdateResponse contains the response from method GalleryApplicationsClient.BeginUpdate.

type GalleryArtifactVersionFullSource

type GalleryArtifactVersionFullSource struct {
	// The resource Id of the source Community Gallery Image. Only required when using Community Gallery Image as a source.
	CommunityGalleryImageID *string

	// The id of the gallery artifact version source.
	ID *string

	// The resource Id of the source virtual machine. Only required when capturing a virtual machine to source this Gallery Image
	// Version.
	VirtualMachineID *string
}

GalleryArtifactVersionFullSource - The source of the gallery artifact version.

func (GalleryArtifactVersionFullSource) MarshalJSON

func (g GalleryArtifactVersionFullSource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryArtifactVersionFullSource.

func (*GalleryArtifactVersionFullSource) UnmarshalJSON

func (g *GalleryArtifactVersionFullSource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactVersionFullSource.

type GalleryDataDiskImage

type GalleryDataDiskImage struct {
	// REQUIRED; This property specifies the logical unit number of the data disk. This value is used to identify data disks within
	// the Virtual Machine and therefore must be unique for each data disk attached to the
	// Virtual Machine.
	Lun *int32

	// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'
	HostCaching *HostCaching

	// The source for the disk image.
	Source *GalleryDiskImageSource

	// READ-ONLY; This property indicates the size of the VHD to be created.
	SizeInGB *int32
}

GalleryDataDiskImage - This is the data disk image.

func (GalleryDataDiskImage) MarshalJSON

func (g GalleryDataDiskImage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryDataDiskImage.

func (*GalleryDataDiskImage) UnmarshalJSON

func (g *GalleryDataDiskImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDataDiskImage.

type GalleryDiskImageSource

type GalleryDiskImageSource struct {
	// The id of the gallery artifact version source.
	ID *string

	// The Storage Account Id that contains the vhd blob being used as a source for this artifact version.
	StorageAccountID *string

	// The uri of the gallery artifact version source. Currently used to specify vhd/blob source.
	URI *string
}

GalleryDiskImageSource - The source for the disk image.

func (GalleryDiskImageSource) MarshalJSON

func (g GalleryDiskImageSource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryDiskImageSource.

func (*GalleryDiskImageSource) UnmarshalJSON

func (g *GalleryDiskImageSource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDiskImageSource.

type GalleryExpandParams

type GalleryExpandParams string
const (
	GalleryExpandParamsSharingProfileGroups GalleryExpandParams = "SharingProfile/Groups"
)

func PossibleGalleryExpandParamsValues

func PossibleGalleryExpandParamsValues() []GalleryExpandParams

PossibleGalleryExpandParamsValues returns the possible values for the GalleryExpandParams const type.

type GalleryExtendedLocation

type GalleryExtendedLocation struct {
	Name *string

	// It is type of the extended location.
	Type *GalleryExtendedLocationType
}

GalleryExtendedLocation - The name of the extended location.

func (GalleryExtendedLocation) MarshalJSON

func (g GalleryExtendedLocation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryExtendedLocation.

func (*GalleryExtendedLocation) UnmarshalJSON

func (g *GalleryExtendedLocation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryExtendedLocation.

type GalleryExtendedLocationType

type GalleryExtendedLocationType string

GalleryExtendedLocationType - It is type of the extended location.

const (
	GalleryExtendedLocationTypeEdgeZone GalleryExtendedLocationType = "EdgeZone"
	GalleryExtendedLocationTypeUnknown  GalleryExtendedLocationType = "Unknown"
)

func PossibleGalleryExtendedLocationTypeValues

func PossibleGalleryExtendedLocationTypeValues() []GalleryExtendedLocationType

PossibleGalleryExtendedLocationTypeValues returns the possible values for the GalleryExtendedLocationType const type.

type GalleryIdentifier

type GalleryIdentifier struct {
	// READ-ONLY; The unique name of the Shared Image Gallery. This name is generated automatically by Azure.
	UniqueName *string
}

GalleryIdentifier - Describes the gallery unique name.

func (GalleryIdentifier) MarshalJSON

func (g GalleryIdentifier) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryIdentifier.

func (*GalleryIdentifier) UnmarshalJSON

func (g *GalleryIdentifier) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryIdentifier.

type GalleryIdentity

type GalleryIdentity struct {
	// The type of identity used for the gallery. The type 'SystemAssigned, UserAssigned' includes both an implicitly created
	// identity and a set of user assigned identities. The type 'None' will remove all
	// identities from the gallery.
	Type *ResourceIdentityType

	// The list of user identities associated with the gallery. The user identity dictionary key references will be ARM resource
	// ids in the form:
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
	UserAssignedIdentities map[string]*UserAssignedIdentitiesValue

	// READ-ONLY; The principal id of the gallery identity. This property will only be provided for a system assigned identity.
	PrincipalID *string

	// READ-ONLY; The AAD tenant id of the gallery identity. This property will only be provided for a system assigned identity.
	TenantID *string
}

GalleryIdentity - Identity for the virtual machine.

func (GalleryIdentity) MarshalJSON

func (g GalleryIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryIdentity.

func (*GalleryIdentity) UnmarshalJSON

func (g *GalleryIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryIdentity.

type GalleryImage

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

	// Describes the properties of a gallery image definition.
	Properties *GalleryImageProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryImage - Specifies information about the gallery image definition that you want to create or update.

func (GalleryImage) MarshalJSON

func (g GalleryImage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImage.

func (*GalleryImage) UnmarshalJSON

func (g *GalleryImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImage.

type GalleryImageFeature

type GalleryImageFeature struct {
	// The name of the gallery image feature.
	Name *string

	// The minimum gallery image version which supports this feature.
	StartsAtVersion *string

	// The value of the gallery image feature.
	Value *string
}

GalleryImageFeature - A feature for gallery image.

func (GalleryImageFeature) MarshalJSON

func (g GalleryImageFeature) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageFeature.

func (*GalleryImageFeature) UnmarshalJSON

func (g *GalleryImageFeature) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageFeature.

type GalleryImageIdentifier

type GalleryImageIdentifier struct {
	// REQUIRED; The name of the gallery image definition offer.
	Offer *string

	// REQUIRED; The name of the gallery image definition publisher.
	Publisher *string

	// REQUIRED; The name of the gallery image definition SKU.
	SKU *string
}

GalleryImageIdentifier - This is the gallery image definition identifier.

func (GalleryImageIdentifier) MarshalJSON

func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier.

func (*GalleryImageIdentifier) UnmarshalJSON

func (g *GalleryImageIdentifier) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier.

type GalleryImageList

type GalleryImageList struct {
	// REQUIRED; A list of Shared Image Gallery images.
	Value []*GalleryImage

	// The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the
	// next page of gallery image definitions.
	NextLink *string
}

GalleryImageList - The List Gallery Images operation response.

func (GalleryImageList) MarshalJSON

func (g GalleryImageList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageList.

func (*GalleryImageList) UnmarshalJSON

func (g *GalleryImageList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageList.

type GalleryImageProperties

type GalleryImageProperties struct {
	// REQUIRED; This is the gallery image definition identifier.
	Identifier *GalleryImageIdentifier

	// REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized'
	// or 'Specialized'.
	OSState *OperatingSystemStateTypes

	// REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a
	// managed image. Possible values are: Windows, Linux.
	OSType *OperatingSystemTypes

	// Optional. Must be set to true if the gallery image features are being updated.
	AllowUpdateImage *bool

	// The architecture of the image. Applicable to OS disks only.
	Architecture *Architecture

	// The description of this gallery image definition resource. This property is updatable.
	Description *string

	// Describes the disallowed disk types.
	Disallowed *Disallowed

	// The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// The Eula agreement for the gallery image definition.
	Eula *string

	// A list of gallery image features.
	Features []*GalleryImageFeature

	// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
	HyperVGeneration *HyperVGeneration

	// The privacy statement uri.
	PrivacyStatementURI *string

	// Describes the gallery image definition purchase plan. This is used by marketplace images.
	PurchasePlan *ImagePurchasePlan

	// The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.
	Recommended *RecommendedMachineConfiguration

	// The release note uri.
	ReleaseNoteURI *string

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState
}

GalleryImageProperties - Describes the properties of a gallery image definition.

func (GalleryImageProperties) MarshalJSON

func (g GalleryImageProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties.

func (*GalleryImageProperties) UnmarshalJSON

func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties.

type GalleryImageUpdate

type GalleryImageUpdate struct {
	// Describes the properties of a gallery image definition.
	Properties *GalleryImageProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryImageUpdate - Specifies information about the gallery image definition that you want to update.

func (GalleryImageUpdate) MarshalJSON

func (g GalleryImageUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageUpdate.

func (*GalleryImageUpdate) UnmarshalJSON

func (g *GalleryImageUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageUpdate.

type GalleryImageVersion

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

	// Describes the properties of a gallery image version.
	Properties *GalleryImageVersionProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryImageVersion - Specifies information about the gallery image version that you want to create or update.

func (GalleryImageVersion) MarshalJSON

func (g GalleryImageVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion.

func (*GalleryImageVersion) UnmarshalJSON

func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion.

type GalleryImageVersionList

type GalleryImageVersionList struct {
	// REQUIRED; A list of gallery image versions.
	Value []*GalleryImageVersion

	// The uri to fetch the next page of gallery image versions. Call ListNext() with this to fetch the next page of gallery image
	// versions.
	NextLink *string
}

GalleryImageVersionList - The List Gallery Image version operation response.

func (GalleryImageVersionList) MarshalJSON

func (g GalleryImageVersionList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionList.

func (*GalleryImageVersionList) UnmarshalJSON

func (g *GalleryImageVersionList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionList.

type GalleryImageVersionProperties

type GalleryImageVersionProperties struct {
	// REQUIRED; This is the storage profile of a Gallery Image Version.
	StorageProfile *GalleryImageVersionStorageProfile

	// The publishing profile of a gallery image Version.
	PublishingProfile *GalleryImageVersionPublishingProfile

	// Indicates if this is a soft-delete resource restoration request.
	Restore *bool

	// This is the safety profile of the Gallery Image Version.
	SafetyProfile *GalleryImageVersionSafetyProfile

	// The security profile of a gallery image version
	SecurityProfile *ImageVersionSecurityProfile

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState

	// READ-ONLY; This is the replication status of the gallery image version.
	ReplicationStatus *ReplicationStatus

	// READ-ONLY; This is the validations profile of a Gallery Image Version.
	ValidationsProfile *ValidationsProfile
}

GalleryImageVersionProperties - Describes the properties of a gallery image version.

func (GalleryImageVersionProperties) MarshalJSON

func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties.

func (*GalleryImageVersionProperties) UnmarshalJSON

func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties.

type GalleryImageVersionPublishingProfile

type GalleryImageVersionPublishingProfile struct {
	// The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.
	ExcludeFromLatest *bool

	// The number of replicas of the Image Version to be created per region. This property would take effect for a region when
	// regionalReplicaCount is not specified. This property is updatable.
	ReplicaCount *int32

	// Optional parameter which specifies the mode to be used for replication. This property is not updatable.
	ReplicationMode *ReplicationMode

	// Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType,
	// but can be overridden per region by specifying
	// targetRegions[].storageAccountType. This property is not updatable.
	StorageAccountStrategy *StorageAccountStrategy

	// Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy.
	// This property is not updatable.
	StorageAccountType *StorageAccountType

	// The target extended locations where the Image Version is going to be replicated to. This property is updatable.
	TargetExtendedLocations []*GalleryTargetExtendedLocation

	// The target regions where the Image Version is going to be replicated to. This property is updatable.
	TargetRegions []*TargetRegion

	// READ-ONLY; The timestamp for when the gallery image version is published.
	PublishedDate *time.Time
}

GalleryImageVersionPublishingProfile - The publishing profile of a gallery image Version.

func (GalleryImageVersionPublishingProfile) MarshalJSON

func (g GalleryImageVersionPublishingProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionPublishingProfile.

func (*GalleryImageVersionPublishingProfile) UnmarshalJSON

func (g *GalleryImageVersionPublishingProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionPublishingProfile.

type GalleryImageVersionSafetyProfile

type GalleryImageVersionSafetyProfile struct {
	// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed.
	AllowDeletionOfReplicatedLocations *bool

	// Indicates whether or not the deletion is blocked for this Gallery Image Version if its End Of Life has not expired.
	BlockDeletionBeforeEndOfLife *bool

	// READ-ONLY; A list of Policy Violations that have been reported for this Gallery Image Version.
	PolicyViolations []*PolicyViolation

	// READ-ONLY; Indicates whether this image has been reported as violating Microsoft's policies.
	ReportedForPolicyViolation *bool
}

GalleryImageVersionSafetyProfile - This is the safety profile of the Gallery Image Version.

func (GalleryImageVersionSafetyProfile) MarshalJSON

func (g GalleryImageVersionSafetyProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionSafetyProfile.

func (*GalleryImageVersionSafetyProfile) UnmarshalJSON

func (g *GalleryImageVersionSafetyProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionSafetyProfile.

type GalleryImageVersionStorageProfile

type GalleryImageVersionStorageProfile struct {
	// A list of data disk images.
	DataDiskImages []*GalleryDataDiskImage

	// This is the OS disk image.
	OSDiskImage *GalleryOSDiskImage

	// The source of the gallery artifact version.
	Source *GalleryArtifactVersionFullSource
}

GalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version.

func (GalleryImageVersionStorageProfile) MarshalJSON

func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile.

func (*GalleryImageVersionStorageProfile) UnmarshalJSON

func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile.

type GalleryImageVersionUefiSettings

type GalleryImageVersionUefiSettings struct {
	// Additional UEFI key signatures that will be added to the image in addition to the signature templates
	AdditionalSignatures *UefiKeySignatures

	// The name of the template(s) that contains default UEFI key signatures that will be added to the image.
	SignatureTemplateNames []*UefiSignatureTemplateName
}

GalleryImageVersionUefiSettings - Contains UEFI settings for the image version.

func (GalleryImageVersionUefiSettings) MarshalJSON

func (g GalleryImageVersionUefiSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionUefiSettings.

func (*GalleryImageVersionUefiSettings) UnmarshalJSON

func (g *GalleryImageVersionUefiSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionUefiSettings.

type GalleryImageVersionUpdate

type GalleryImageVersionUpdate struct {
	// Describes the properties of a gallery image version.
	Properties *GalleryImageVersionProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryImageVersionUpdate - Specifies information about the gallery image version that you want to update.

func (GalleryImageVersionUpdate) MarshalJSON

func (g GalleryImageVersionUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionUpdate.

func (*GalleryImageVersionUpdate) UnmarshalJSON

func (g *GalleryImageVersionUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionUpdate.

type GalleryImageVersionsClient

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

GalleryImageVersionsClient contains the methods for the GalleryImageVersions group. Don't use this type directly, use NewGalleryImageVersionsClient() instead.

func NewGalleryImageVersionsClient

func NewGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryImageVersionsClient, error)

NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryImageVersionsClient) BeginCreateOrUpdate

func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImageVersionsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery image version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImageVersionName - The name of the gallery image version to be retrieved.
  • galleryImageVersion - Parameters supplied to the create or update gallery image version operation.
  • options - GalleryImageVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginCreateOrUpdate method.
Example (CreateOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				DataDiskImages: []*armcompute.GalleryDataDiskImage{
					{
						HostCaching: to.Ptr(armcompute.HostCachingNone),
						Source: &armcompute.GalleryDiskImageSource{
							ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
						},
						Lun: to.Ptr[int32](1),
					}},
				OSDiskImage: &armcompute.GalleryOSDiskImage{
					HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
					Source: &armcompute.GalleryDiskImageSource{
						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Source: &armcompute.GalleryDiskImageSource{
	// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 				Source: &armcompute.GalleryDiskImageSource{
	// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingVhdAsASource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name:                 to.Ptr("East US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				DataDiskImages: []*armcompute.GalleryDataDiskImage{
					{
						HostCaching: to.Ptr(armcompute.HostCachingNone),
						Source: &armcompute.GalleryDiskImageSource{
							StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
							URI:              to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
						},
						Lun: to.Ptr[int32](1),
					}},
				OSDiskImage: &armcompute.GalleryOSDiskImage{
					HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
					Source: &armcompute.GalleryDiskImageSource{
						StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
						URI:              to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					Source: &armcompute.GalleryDiskImageSource{
	// 						StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 						URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				Source: &armcompute.GalleryDiskImageSource{
	// 					StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 					URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingVhdAsASourceWithCustomUefiKeys)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name:                 to.Ptr("East US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			SecurityProfile: &armcompute.ImageVersionSecurityProfile{
				UefiSettings: &armcompute.GalleryImageVersionUefiSettings{
					AdditionalSignatures: &armcompute.UefiKeySignatures{
						Db: []*armcompute.UefiKey{
							{
								Type: to.Ptr(armcompute.UefiKeyTypeX509),
								Value: []*string{
									to.Ptr("<x509 value>")},
							}},
						Dbx: []*armcompute.UefiKey{
							{
								Type: to.Ptr(armcompute.UefiKeyTypeX509),
								Value: []*string{
									to.Ptr("<x509 value>")},
							}},
						Kek: []*armcompute.UefiKey{
							{
								Type: to.Ptr(armcompute.UefiKeyTypeSHA256),
								Value: []*string{
									to.Ptr("<sha256 value>")},
							}},
					},
					SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{
						to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)},
				},
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				DataDiskImages: []*armcompute.GalleryDataDiskImage{
					{
						HostCaching: to.Ptr(armcompute.HostCachingNone),
						Source: &armcompute.GalleryDiskImageSource{
							StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
							URI:              to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
						},
						Lun: to.Ptr[int32](1),
					}},
				OSDiskImage: &armcompute.GalleryOSDiskImage{
					HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
					Source: &armcompute.GalleryDiskImageSource{
						StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
						URI:              to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		SecurityProfile: &armcompute.ImageVersionSecurityProfile{
	// 			UefiSettings: &armcompute.GalleryImageVersionUefiSettings{
	// 				AdditionalSignatures: &armcompute.UefiKeySignatures{
	// 					Db: []*armcompute.UefiKey{
	// 						{
	// 							Type: to.Ptr(armcompute.UefiKeyTypeX509),
	// 							Value: []*string{
	// 								to.Ptr("<x509 value>")},
	// 						}},
	// 						Dbx: []*armcompute.UefiKey{
	// 							{
	// 								Type: to.Ptr(armcompute.UefiKeyTypeX509),
	// 								Value: []*string{
	// 									to.Ptr("<x509 value>")},
	// 							}},
	// 							Kek: []*armcompute.UefiKey{
	// 								{
	// 									Type: to.Ptr(armcompute.UefiKeyTypeSHA256),
	// 									Value: []*string{
	// 										to.Ptr("<sha256 value>")},
	// 								}},
	// 							},
	// 							SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{
	// 								to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)},
	// 							},
	// 						},
	// 						StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 							DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 								{
	// 									HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 									Source: &armcompute.GalleryDiskImageSource{
	// 										StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 										URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 									},
	// 									Lun: to.Ptr[int32](1),
	// 							}},
	// 							OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 								HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 								Source: &armcompute.GalleryDiskImageSource{
	// 									StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 									URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 								},
	// 							},
	// 						},
	// 					},
	// 				}
}
Example (CreateOrUpdateASimpleGalleryImageVersionUsingVmAsSource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionWithDirectDriveReplicas)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						AdditionalReplicaSets: []*armcompute.AdditionalReplicaSet{
							{
								RegionalReplicaCount: to.Ptr[int32](1),
								StorageAccountType:   to.Ptr(armcompute.StorageAccountType("PreviumV2_LRS")),
							}},
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					AdditionalReplicaSets: []*armcompute.AdditionalReplicaSet{
	// 						{
	// 							RegionalReplicaCount: to.Ptr[int32](1),
	// 							StorageAccountType: to.Ptr(armcompute.StorageAccountType("PreviumV2_LRS")),
	// 					}},
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionWithStorageAccountStrategyAndRegionalStorageAccountTypeOverride)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithStorageAccountStrategy.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				StorageAccountStrategy: to.Ptr(armcompute.StorageAccountStrategyPreferStandardZRS),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
					},
					{
						Name: to.Ptr("East US"),
					},
					{
						Name:               to.Ptr("East US 2"),
						StorageAccountType: to.Ptr(armcompute.StorageAccountTypePremiumLRS),
					}},
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountStrategy: to.Ptr(armcompute.StorageAccountStrategyPreferStandardZRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US 2"),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypePremiumLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			ReportedForPolicyViolation: to.Ptr(false),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name: to.Ptr("West US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name: to.Ptr("East US"),
						Encryption: &armcompute.EncryptionImages{
							DataDiskImages: []*armcompute.DataDiskImageEncryption{
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](0),
								},
								{
									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
									Lun:                 to.Ptr[int32](1),
								}},
							OSDiskImage: &armcompute.OSDiskImageEncryption{
								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
							},
						},
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
				BlockDeletionBeforeEndOfLife:       to.Ptr(false),
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetExtendedLocations: []*armcompute.GalleryTargetExtendedLocation{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExtendedLocation: &armcompute.GalleryExtendedLocation{
	// 						Name: to.Ptr("microsoftlosangeles1"),
	// 						Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone),
	// 					},
	// 					ExtendedLocationReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExtendedLocation: &armcompute.GalleryExtendedLocation{
	// 						Name: to.Ptr("microsoftnewyork1"),
	// 						Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone),
	// 					},
	// 					ExtendedLocationReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")),
	// 			}},
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}

func (*GalleryImageVersionsClient) BeginDelete

func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryImageVersionsClientDeleteResponse], error)

BeginDelete - Delete a gallery image version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImageVersionName - The name of the gallery image version to be retrieved.
  • options - GalleryImageVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryImageVersionsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryImageVersionsClient) BeginUpdate

func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryImageVersionsClientUpdateResponse], error)

BeginUpdate - Update a gallery image version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImageVersionName - The name of the gallery image version to be retrieved.
  • galleryImageVersion - Parameters supplied to the update gallery image version operation.
  • options - GalleryImageVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginUpdate method.
Example (RestoreASoftDeletedGalleryImageVersion)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{
		Properties: &armcompute.GalleryImageVersionProperties{
			Restore:        to.Ptr(true),
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (UpdateASimpleGalleryImageVersionManagedImageAsSource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name:                 to.Ptr("East US"),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
				Source: &armcompute.GalleryArtifactVersionFullSource{
					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (UpdateASimpleGalleryImageVersionWithoutSourceId)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImageVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{
		Properties: &armcompute.GalleryImageVersionProperties{
			PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						RegionalReplicaCount: to.Ptr[int32](1),
					},
					{
						Name:                 to.Ptr("East US"),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardZRS),
					}},
			},
			StorageProfile: &armcompute.GalleryImageVersionStorageProfile{},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
	// 			}},
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}

func (*GalleryImageVersionsClient) Get

func (client *GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientGetOptions) (GalleryImageVersionsClientGetResponse, error)

Get - Retrieves information about a gallery image version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImageVersionName - The name of the gallery image version to be retrieved.
  • options - GalleryImageVersionsClientGetOptions contains the optional parameters for the GalleryImageVersionsClient.Get method.
Example (GetAGalleryImageVersion)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: 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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (GetAGalleryImageVersionWithReplicationStatus)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)})
	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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		ReplicationStatus: &armcompute.ReplicationStatus{
	// 			AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted),
	// 			Summary: []*armcompute.RegionalReplicationStatus{
	// 				{
	// 					Progress: to.Ptr[int32](100),
	// 					Region: to.Ptr("West US"),
	// 					State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 					Details: to.Ptr(""),
	// 				},
	// 				{
	// 					Progress: to.Ptr[int32](100),
	// 					Region: to.Ptr("East US"),
	// 					State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 					Details: to.Ptr(""),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (GetAGalleryImageVersionWithSnapshotsAsASource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: 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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Source: &armcompute.GalleryDiskImageSource{
	// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{diskSnapshotName}"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 				Source: &armcompute.GalleryDiskImageSource{
	// 					ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}
Example (GetAGalleryImageVersionWithValidationProfile)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypes("ValidationProfile"))})
	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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 		ValidationsProfile: &armcompute.ValidationsProfile{
	// 			ExecutedValidations: []*armcompute.ExecutedValidation{
	// 				{
	// 					Type: to.Ptr("LinuxSecurityBaseline"),
	// 					ExecutionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 					Status: to.Ptr(armcompute.ValidationStatusFailed),
	// 					Version: to.Ptr("beta"),
	// 				},
	// 				{
	// 					Type: to.Ptr("AzCertify"),
	// 					ExecutionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 					Status: to.Ptr(armcompute.ValidationStatusSucceeded),
	// 					Version: to.Ptr("10.0.4"),
	// 			}},
	// 			PlatformAttributes: []*armcompute.PlatformAttribute{
	// 				{
	// 					Name: to.Ptr("source_image_publisher"),
	// 					Value: to.Ptr("publishValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_offer"),
	// 					Value: to.Ptr("OfferValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_sku"),
	// 					Value: to.Ptr("SkuValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_version"),
	// 					Value: to.Ptr("1.0.0"),
	// 			}},
	// 			ValidationEtag: to.Ptr("2018-01-01T00:00:00Z"),
	// 		},
	// 	},
	// }
}
Example (GetAGalleryImageVersionWithValidationProfileAndReplicationStatus)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypes("ValidationProfile,ReplicationStatus"))})
	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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](0),
	// 							},
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		ReplicationStatus: &armcompute.ReplicationStatus{
	// 			AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted),
	// 			Summary: []*armcompute.RegionalReplicationStatus{
	// 				{
	// 					Progress: to.Ptr[int32](100),
	// 					Region: to.Ptr("West US"),
	// 					State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 					Details: to.Ptr(""),
	// 				},
	// 				{
	// 					Progress: to.Ptr[int32](100),
	// 					Region: to.Ptr("East US"),
	// 					State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 					Details: to.Ptr(""),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					SizeInGB: to.Ptr[int32](10),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				SizeInGB: to.Ptr[int32](10),
	// 			},
	// 			Source: &armcompute.GalleryArtifactVersionFullSource{
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
	// 			},
	// 		},
	// 		ValidationsProfile: &armcompute.ValidationsProfile{
	// 			ExecutedValidations: []*armcompute.ExecutedValidation{
	// 				{
	// 					Type: to.Ptr("LinuxSecurityBaseline"),
	// 					ExecutionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 					Status: to.Ptr(armcompute.ValidationStatusFailed),
	// 					Version: to.Ptr("beta"),
	// 				},
	// 				{
	// 					Type: to.Ptr("AzCertify"),
	// 					ExecutionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 					Status: to.Ptr(armcompute.ValidationStatusSucceeded),
	// 					Version: to.Ptr("10.0.4"),
	// 			}},
	// 			PlatformAttributes: []*armcompute.PlatformAttribute{
	// 				{
	// 					Name: to.Ptr("source_image_publisher"),
	// 					Value: to.Ptr("publishValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_offer"),
	// 					Value: to.Ptr("OfferValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_sku"),
	// 					Value: to.Ptr("SkuValue"),
	// 				},
	// 				{
	// 					Name: to.Ptr("source_image_version"),
	// 					Value: to.Ptr("1.0.0"),
	// 			}},
	// 			ValidationEtag: to.Ptr("2018-01-01T00:00:00Z"),
	// 		},
	// 	},
	// }
}
Example (GetAGalleryImageVersionWithVhdAsASource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: 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.GalleryImageVersion = armcompute.GalleryImageVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](1),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					Encryption: &armcompute.EncryptionImages{
	// 						DataDiskImages: []*armcompute.DataDiskImageEncryption{
	// 							{
	// 								DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 								Lun: to.Ptr[int32](1),
	// 						}},
	// 						OSDiskImage: &armcompute.OSDiskImageEncryption{
	// 							DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
	// 						},
	// 					},
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](1),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 				},
	// 				{
	// 					Name: to.Ptr("East US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 		},
	// 		SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
	// 			AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			BlockDeletionBeforeEndOfLife: to.Ptr(false),
	// 			PolicyViolations: []*armcompute.PolicyViolation{
	// 				{
	// 					Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
	// 					Details: to.Ptr("This is the policy violation details."),
	// 			}},
	// 			ReportedForPolicyViolation: to.Ptr(true),
	// 		},
	// 		StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
	// 			DataDiskImages: []*armcompute.GalleryDataDiskImage{
	// 				{
	// 					HostCaching: to.Ptr(armcompute.HostCachingNone),
	// 					Source: &armcompute.GalleryDiskImageSource{
	// 						StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 						URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDiskImage: &armcompute.GalleryOSDiskImage{
	// 				HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
	// 				Source: &armcompute.GalleryDiskImageSource{
	// 					StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
	// 					URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}

func (*GalleryImageVersionsClient) NewListByGalleryImagePager

func (client *GalleryImageVersionsClient) NewListByGalleryImagePager(resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsClientListByGalleryImageOptions) *runtime.Pager[GalleryImageVersionsClientListByGalleryImageResponse]

NewListByGalleryImagePager - List gallery image versions in a gallery image definition.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • options - GalleryImageVersionsClientListByGalleryImageOptions contains the optional parameters for the GalleryImageVersionsClient.NewListByGalleryImagePager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryImageVersionsClient().NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", 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.GalleryImageVersionList = armcompute.GalleryImageVersionList{
		// 	Value: []*armcompute.GalleryImageVersion{
		// 		{
		// 			Name: to.Ptr("1.0.0"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryImageVersionProperties{
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
		// 					PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
		// 					ReplicaCount: to.Ptr[int32](1),
		// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					TargetRegions: []*armcompute.TargetRegion{
		// 						{
		// 							Name: to.Ptr("West US"),
		// 							Encryption: &armcompute.EncryptionImages{
		// 								DataDiskImages: []*armcompute.DataDiskImageEncryption{
		// 									{
		// 										DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
		// 										Lun: to.Ptr[int32](0),
		// 									},
		// 									{
		// 										DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
		// 										Lun: to.Ptr[int32](1),
		// 								}},
		// 								OSDiskImage: &armcompute.OSDiskImageEncryption{
		// 									DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
		// 								},
		// 							},
		// 							ExcludeFromLatest: to.Ptr(false),
		// 							RegionalReplicaCount: to.Ptr[int32](1),
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 						},
		// 						{
		// 							Name: to.Ptr("East US"),
		// 							ExcludeFromLatest: to.Ptr(false),
		// 							RegionalReplicaCount: to.Ptr[int32](2),
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					}},
		// 				},
		// 				SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
		// 					AllowDeletionOfReplicatedLocations: to.Ptr(false),
		// 					BlockDeletionBeforeEndOfLife: to.Ptr(false),
		// 					PolicyViolations: []*armcompute.PolicyViolation{
		// 						{
		// 							Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
		// 							Details: to.Ptr("This is the policy violation details."),
		// 					}},
		// 					ReportedForPolicyViolation: to.Ptr(true),
		// 				},
		// 				StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
		// 					DataDiskImages: []*armcompute.GalleryDataDiskImage{
		// 						{
		// 							HostCaching: to.Ptr(armcompute.HostCachingNone),
		// 							SizeInGB: to.Ptr[int32](10),
		// 							Lun: to.Ptr[int32](1),
		// 					}},
		// 					OSDiskImage: &armcompute.GalleryOSDiskImage{
		// 						HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
		// 						SizeInGB: to.Ptr[int32](10),
		// 					},
		// 					Source: &armcompute.GalleryArtifactVersionFullSource{
		// 						ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
		// 					},
		// 				},
		// 			},
		// 	}},
		// }
	}
}

type GalleryImageVersionsClientBeginCreateOrUpdateOptions

type GalleryImageVersionsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImageVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginCreateOrUpdate method.

type GalleryImageVersionsClientBeginDeleteOptions

type GalleryImageVersionsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImageVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryImageVersionsClient.BeginDelete method.

type GalleryImageVersionsClientBeginUpdateOptions

type GalleryImageVersionsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImageVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginUpdate method.

type GalleryImageVersionsClientCreateOrUpdateResponse

type GalleryImageVersionsClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery image version that you want to create or update.
	GalleryImageVersion
}

GalleryImageVersionsClientCreateOrUpdateResponse contains the response from method GalleryImageVersionsClient.BeginCreateOrUpdate.

type GalleryImageVersionsClientDeleteResponse

type GalleryImageVersionsClientDeleteResponse struct {
}

GalleryImageVersionsClientDeleteResponse contains the response from method GalleryImageVersionsClient.BeginDelete.

type GalleryImageVersionsClientGetOptions

type GalleryImageVersionsClientGetOptions struct {
	// The expand expression to apply on the operation.
	Expand *ReplicationStatusTypes
}

GalleryImageVersionsClientGetOptions contains the optional parameters for the GalleryImageVersionsClient.Get method.

type GalleryImageVersionsClientGetResponse

type GalleryImageVersionsClientGetResponse struct {
	// Specifies information about the gallery image version that you want to create or update.
	GalleryImageVersion
}

GalleryImageVersionsClientGetResponse contains the response from method GalleryImageVersionsClient.Get.

type GalleryImageVersionsClientListByGalleryImageOptions

type GalleryImageVersionsClientListByGalleryImageOptions struct {
}

GalleryImageVersionsClientListByGalleryImageOptions contains the optional parameters for the GalleryImageVersionsClient.NewListByGalleryImagePager method.

type GalleryImageVersionsClientListByGalleryImageResponse

type GalleryImageVersionsClientListByGalleryImageResponse struct {
	// The List Gallery Image version operation response.
	GalleryImageVersionList
}

GalleryImageVersionsClientListByGalleryImageResponse contains the response from method GalleryImageVersionsClient.NewListByGalleryImagePager.

type GalleryImageVersionsClientUpdateResponse

type GalleryImageVersionsClientUpdateResponse struct {
	// Specifies information about the gallery image version that you want to create or update.
	GalleryImageVersion
}

GalleryImageVersionsClientUpdateResponse contains the response from method GalleryImageVersionsClient.BeginUpdate.

type GalleryImagesClient

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

GalleryImagesClient contains the methods for the GalleryImages group. Don't use this type directly, use NewGalleryImagesClient() instead.

func NewGalleryImagesClient

func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryImagesClient, error)

NewGalleryImagesClient creates a new instance of GalleryImagesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryImagesClient) BeginCreateOrUpdate

func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery image definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImage - Parameters supplied to the create or update gallery image operation.
  • options - GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImage{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryImageProperties{
			HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
			Identifier: &armcompute.GalleryImageIdentifier{
				Offer:     to.Ptr("myOfferName"),
				Publisher: to.Ptr("myPublisherName"),
				SKU:       to.Ptr("mySkuName"),
			},
			OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
			OSType:  to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImage = armcompute.GalleryImage{
	// 	Name: to.Ptr("myGalleryImageName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageProperties{
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		Identifier: &armcompute.GalleryImageIdentifier{
	// 			Offer: to.Ptr("myOfferName"),
	// 			Publisher: to.Ptr("myPublisherName"),
	// 			SKU: to.Ptr("mySkuName"),
	// 		},
	// 		OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleryImagesClient) BeginDelete

func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error)

BeginDelete - Delete a gallery image. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • options - GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImagesClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryImagesClient) BeginUpdate

func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error)

BeginUpdate - Update a gallery image definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • galleryImage - Parameters supplied to the update gallery image operation.
  • options - GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate method.
Example (UpdateAGalleryImageFeature)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_UpdateFeatures.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImageUpdate{
		Properties: &armcompute.GalleryImageProperties{
			AllowUpdateImage: to.Ptr(true),
			Features: []*armcompute.GalleryImageFeature{
				{
					Name:            to.Ptr("SecurityType"),
					StartsAtVersion: to.Ptr("2.0.0"),
					Value:           to.Ptr("TrustedLaunch"),
				}},
			HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV2),
			Identifier: &armcompute.GalleryImageIdentifier{
				Offer:     to.Ptr("myOfferName"),
				Publisher: to.Ptr("myPublisherName"),
				SKU:       to.Ptr("mySkuName"),
			},
			OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
			OSType:  to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImage = armcompute.GalleryImage{
	// 	Name: to.Ptr("myGalleryImageName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageProperties{
	// 		Features: []*armcompute.GalleryImageFeature{
	// 			{
	// 				Name: to.Ptr("SecurityType"),
	// 				StartsAtVersion: to.Ptr("2.0.0"),
	// 				Value: to.Ptr("TrustedLaunch"),
	// 		}},
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV2),
	// 		Identifier: &armcompute.GalleryImageIdentifier{
	// 			Offer: to.Ptr("myOfferName"),
	// 			Publisher: to.Ptr("myPublisherName"),
	// 			SKU: to.Ptr("mySkuName"),
	// 		},
	// 		OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}
Example (UpdateASimpleGalleryImage)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImageUpdate{
		Properties: &armcompute.GalleryImageProperties{
			HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
			Identifier: &armcompute.GalleryImageIdentifier{
				Offer:     to.Ptr("myOfferName"),
				Publisher: to.Ptr("myPublisherName"),
				SKU:       to.Ptr("mySkuName"),
			},
			OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
			OSType:  to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryImage = armcompute.GalleryImage{
	// 	Name: to.Ptr("myGalleryImageName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageProperties{
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		Identifier: &armcompute.GalleryImageIdentifier{
	// 			Offer: to.Ptr("myOfferName"),
	// 			Publisher: to.Ptr("myPublisherName"),
	// 			SKU: to.Ptr("mySkuName"),
	// 		},
	// 		OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleryImagesClient) Get

func (client *GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error)

Get - Retrieves information about a gallery image definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryImageName - The name of the gallery image definition to be retrieved.
  • options - GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", 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.GalleryImage = armcompute.GalleryImage{
	// 	Name: to.Ptr("myGalleryImageName"),
	// 	ID: to.Ptr("/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryImageProperties{
	// 		HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
	// 		Identifier: &armcompute.GalleryImageIdentifier{
	// 			Offer: to.Ptr("myOfferName"),
	// 			Publisher: to.Ptr("myPublisherName"),
	// 			SKU: to.Ptr("mySkuName"),
	// 		},
	// 		OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 	},
	// }
}

func (*GalleryImagesClient) NewListByGalleryPager

func (client *GalleryImagesClient) NewListByGalleryPager(resourceGroupName string, galleryName string, options *GalleryImagesClientListByGalleryOptions) *runtime.Pager[GalleryImagesClientListByGalleryResponse]

NewListByGalleryPager - List gallery image definitions in a gallery.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.NewListByGalleryPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryImagesClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", 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.GalleryImageList = armcompute.GalleryImageList{
		// 	Value: []*armcompute.GalleryImage{
		// 		{
		// 			Name: to.Ptr("myGalleryImageName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryImageProperties{
		// 				HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
		// 				Identifier: &armcompute.GalleryImageIdentifier{
		// 					Offer: to.Ptr("myOfferName"),
		// 					Publisher: to.Ptr("myPublisherName"),
		// 					SKU: to.Ptr("mySkuName"),
		// 				},
		// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 			},
		// 	}},
		// }
	}
}

type GalleryImagesClientBeginCreateOrUpdateOptions

type GalleryImagesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate method.

type GalleryImagesClientBeginDeleteOptions

type GalleryImagesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete method.

type GalleryImagesClientBeginUpdateOptions

type GalleryImagesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate method.

type GalleryImagesClientCreateOrUpdateResponse

type GalleryImagesClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery image definition that you want to create or update.
	GalleryImage
}

GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.BeginCreateOrUpdate.

type GalleryImagesClientDeleteResponse

type GalleryImagesClientDeleteResponse struct {
}

GalleryImagesClientDeleteResponse contains the response from method GalleryImagesClient.BeginDelete.

type GalleryImagesClientGetOptions

type GalleryImagesClientGetOptions struct {
}

GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method.

type GalleryImagesClientGetResponse

type GalleryImagesClientGetResponse struct {
	// Specifies information about the gallery image definition that you want to create or update.
	GalleryImage
}

GalleryImagesClientGetResponse contains the response from method GalleryImagesClient.Get.

type GalleryImagesClientListByGalleryOptions

type GalleryImagesClientListByGalleryOptions struct {
}

GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.NewListByGalleryPager method.

type GalleryImagesClientListByGalleryResponse

type GalleryImagesClientListByGalleryResponse struct {
	// The List Gallery Images operation response.
	GalleryImageList
}

GalleryImagesClientListByGalleryResponse contains the response from method GalleryImagesClient.NewListByGalleryPager.

type GalleryImagesClientUpdateResponse

type GalleryImagesClientUpdateResponse struct {
	// Specifies information about the gallery image definition that you want to create or update.
	GalleryImage
}

GalleryImagesClientUpdateResponse contains the response from method GalleryImagesClient.BeginUpdate.

type GalleryInVMAccessControlProfile

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

	// Describes the properties of a gallery inVMAccessControlProfile.
	Properties *GalleryInVMAccessControlProfileProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryInVMAccessControlProfile - Specifies information about the gallery inVMAccessControlProfile that you want to create or update.

func (GalleryInVMAccessControlProfile) MarshalJSON

func (g GalleryInVMAccessControlProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfile.

func (*GalleryInVMAccessControlProfile) UnmarshalJSON

func (g *GalleryInVMAccessControlProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfile.

type GalleryInVMAccessControlProfileList

type GalleryInVMAccessControlProfileList struct {
	// REQUIRED; The GalleryInVMAccessControlProfile items on this page
	Value []*GalleryInVMAccessControlProfile

	// The link to the next page of items
	NextLink *string
}

GalleryInVMAccessControlProfileList - The List Gallery InVMAccessControlProfiles operation response.

func (GalleryInVMAccessControlProfileList) MarshalJSON

func (g GalleryInVMAccessControlProfileList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileList.

func (*GalleryInVMAccessControlProfileList) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileList.

type GalleryInVMAccessControlProfileProperties

type GalleryInVMAccessControlProfileProperties struct {
	// REQUIRED; This property allows you to specify the Endpoint type for which this profile is defining the access control for.
	// Possible values are: 'WireServer' or 'IMDS'
	ApplicableHostEndpoint *EndpointTypes

	// REQUIRED; This property allows you to specify the OS type of the VMs/VMSS for which this profile can be used against. Possible
	// values are: 'Windows' or 'Linux'
	OSType *OperatingSystemTypes

	// The description of this gallery inVMAccessControlProfile resources. This property is updatable.
	Description *string

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState
}

GalleryInVMAccessControlProfileProperties - Describes the properties of a gallery inVMAccessControlProfile.

func (GalleryInVMAccessControlProfileProperties) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileProperties.

func (*GalleryInVMAccessControlProfileProperties) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileProperties.

type GalleryInVMAccessControlProfileUpdate

type GalleryInVMAccessControlProfileUpdate struct {
	// Describes the properties of a gallery inVMAccessControlProfile.
	Properties *GalleryInVMAccessControlProfileProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryInVMAccessControlProfileUpdate - Specifies information about the gallery inVMAccessControlProfile that you want to update.

func (GalleryInVMAccessControlProfileUpdate) MarshalJSON

func (g GalleryInVMAccessControlProfileUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileUpdate.

func (*GalleryInVMAccessControlProfileUpdate) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileUpdate.

type GalleryInVMAccessControlProfileVersion

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

	// Describes the properties of an inVMAccessControlProfile version.
	Properties *GalleryInVMAccessControlProfileVersionProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryInVMAccessControlProfileVersion - Specifies information about the gallery inVMAccessControlProfile version that you want to create or update.

func (GalleryInVMAccessControlProfileVersion) MarshalJSON

func (g GalleryInVMAccessControlProfileVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileVersion.

func (*GalleryInVMAccessControlProfileVersion) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileVersion.

type GalleryInVMAccessControlProfileVersionList

type GalleryInVMAccessControlProfileVersionList struct {
	// REQUIRED; The GalleryInVMAccessControlProfileVersion items on this page
	Value []*GalleryInVMAccessControlProfileVersion

	// The link to the next page of items
	NextLink *string
}

GalleryInVMAccessControlProfileVersionList - The List Gallery InVMAccessControlProfile Versions operation response.

func (GalleryInVMAccessControlProfileVersionList) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileVersionList.

func (*GalleryInVMAccessControlProfileVersionList) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileVersionList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileVersionList.

type GalleryInVMAccessControlProfileVersionProperties

type GalleryInVMAccessControlProfileVersionProperties struct {
	// REQUIRED; This property allows you to specify if the requests will be allowed to access the host endpoints. Possible values
	// are: 'Allow', 'Deny'.
	DefaultAccess *EndpointAccess

	// REQUIRED; This property allows you to specify whether the access control rules are in Audit mode, in Enforce mode or Disabled.
	// Possible values are: 'Audit', 'Enforce' or 'Disabled'.
	Mode *AccessControlRulesMode

	// If set to true, Virtual Machines deployed from the latest version of the Resource Profile won't use this Profile version.
	ExcludeFromLatest *bool

	// This is the Access Control Rules specification for an inVMAccessControlProfile version.
	Rules *AccessControlRules

	// The target regions where the Resource Profile version is going to be replicated to. This property is updatable.
	TargetLocations []*TargetRegion

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState

	// READ-ONLY; The timestamp for when the Resource Profile Version is published.
	PublishedDate *time.Time

	// READ-ONLY; This is the replication status of the gallery image version.
	ReplicationStatus *ReplicationStatus
}

GalleryInVMAccessControlProfileVersionProperties - Describes the properties of an inVMAccessControlProfile version.

func (GalleryInVMAccessControlProfileVersionProperties) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileVersionProperties.

func (*GalleryInVMAccessControlProfileVersionProperties) UnmarshalJSON

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileVersionProperties.

type GalleryInVMAccessControlProfileVersionUpdate

type GalleryInVMAccessControlProfileVersionUpdate struct {
	// Describes the properties of an inVMAccessControlProfile version.
	Properties *GalleryInVMAccessControlProfileVersionProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryInVMAccessControlProfileVersionUpdate - Specifies information about the gallery inVMAccessControlProfile version that you want to update.

func (GalleryInVMAccessControlProfileVersionUpdate) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type GalleryInVMAccessControlProfileVersionUpdate.

func (*GalleryInVMAccessControlProfileVersionUpdate) UnmarshalJSON

func (g *GalleryInVMAccessControlProfileVersionUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryInVMAccessControlProfileVersionUpdate.

type GalleryInVMAccessControlProfileVersionsClient

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

GalleryInVMAccessControlProfileVersionsClient contains the methods for the GalleryInVMAccessControlProfileVersions group. Don't use this type directly, use NewGalleryInVMAccessControlProfileVersionsClient() instead.

func NewGalleryInVMAccessControlProfileVersionsClient

func NewGalleryInVMAccessControlProfileVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryInVMAccessControlProfileVersionsClient, error)

NewGalleryInVMAccessControlProfileVersionsClient creates a new instance of GalleryInVMAccessControlProfileVersionsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryInVMAccessControlProfileVersionsClient) BeginCreateOrUpdate

func (client *GalleryInVMAccessControlProfileVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, inVMAccessControlProfileName string, inVMAccessControlProfileVersionName string, galleryInVMAccessControlProfileVersion GalleryInVMAccessControlProfileVersion, options *GalleryInVMAccessControlProfileVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryInVMAccessControlProfileVersionsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery inVMAccessControlProfile version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • inVMAccessControlProfileVersionName - The name of the gallery inVMAccessControlProfile version to be retrieved.
  • galleryInVMAccessControlProfileVersion - Parameters supplied to the create or update gallery inVMAccessControlProfile version operation.
  • options - GalleryInVMAccessControlProfileVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfileVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", "1.0.0", armcompute.GalleryInVMAccessControlProfileVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
			ExcludeFromLatest: to.Ptr(false),
			TargetLocations: []*armcompute.TargetRegion{
				{
					Name: to.Ptr("West US"),
				},
				{
					Name: to.Ptr("South Central US"),
				}},
			DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
			Mode:          to.Ptr(armcompute.AccessControlRulesModeAudit),
			Rules: &armcompute.AccessControlRules{
				Identities: []*armcompute.AccessControlRulesIdentity{
					{
						Name:        to.Ptr("WinPA"),
						ExePath:     to.Ptr("C:\\Windows\\System32\\cscript.exe"),
						GroupName:   to.Ptr("Administrators"),
						ProcessName: to.Ptr("cscript"),
						UserName:    to.Ptr("SYSTEM"),
					}},
				Privileges: []*armcompute.AccessControlRulesPrivilege{
					{
						Name: to.Ptr("GoalState"),
						Path: to.Ptr("/machine"),
						QueryParameters: map[string]*string{
							"comp": to.Ptr("goalstate"),
						},
					}},
				RoleAssignments: []*armcompute.AccessControlRulesRoleAssignment{
					{
						Identities: []*string{
							to.Ptr("WinPA")},
						Role: to.Ptr("Provisioning"),
					}},
				Roles: []*armcompute.AccessControlRulesRole{
					{
						Name: to.Ptr("Provisioning"),
						Privileges: []*string{
							to.Ptr("GoalState")},
					}},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryInVMAccessControlProfileVersion = armcompute.GalleryInVMAccessControlProfileVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
	// 		ExcludeFromLatest: to.Ptr(false),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
	// 		TargetLocations: []*armcompute.TargetRegion{
	// 			{
	// 				Name: to.Ptr("West US"),
	// 			},
	// 			{
	// 				Name: to.Ptr("South Central US"),
	// 		}},
	// 		DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
	// 		Mode: to.Ptr(armcompute.AccessControlRulesModeAudit),
	// 		Rules: &armcompute.AccessControlRules{
	// 			Identities: []*armcompute.AccessControlRulesIdentity{
	// 				{
	// 					Name: to.Ptr("WinPA"),
	// 					ExePath: to.Ptr("C:\\Windows\\System32\\cscript.exe"),
	// 					GroupName: to.Ptr("Administrators"),
	// 					ProcessName: to.Ptr("cscript"),
	// 					UserName: to.Ptr("SYSTEM"),
	// 			}},
	// 			Privileges: []*armcompute.AccessControlRulesPrivilege{
	// 				{
	// 					Name: to.Ptr("GoalState"),
	// 					Path: to.Ptr("/machine"),
	// 					QueryParameters: map[string]*string{
	// 						"comp": to.Ptr("goalstate"),
	// 					},
	// 			}},
	// 			RoleAssignments: []*armcompute.AccessControlRulesRoleAssignment{
	// 				{
	// 					Identities: []*string{
	// 						to.Ptr("WinPA")},
	// 						Role: to.Ptr("Provisioning"),
	// 				}},
	// 				Roles: []*armcompute.AccessControlRulesRole{
	// 					{
	// 						Name: to.Ptr("Provisioning"),
	// 						Privileges: []*string{
	// 							to.Ptr("GoalState")},
	// 					}},
	// 				},
	// 			},
	// 		}
}

func (*GalleryInVMAccessControlProfileVersionsClient) BeginDelete

func (client *GalleryInVMAccessControlProfileVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, inVMAccessControlProfileName string, inVMAccessControlProfileVersionName string, options *GalleryInVMAccessControlProfileVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryInVMAccessControlProfileVersionsClientDeleteResponse], error)

BeginDelete - Delete a gallery inVMAccessControlProfile version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • inVMAccessControlProfileVersionName - The name of the gallery inVMAccessControlProfile version to be retrieved.
  • options - GalleryInVMAccessControlProfileVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfileVersionsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", "1.0.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryInVMAccessControlProfileVersionsClient) BeginUpdate

func (client *GalleryInVMAccessControlProfileVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, inVMAccessControlProfileName string, inVMAccessControlProfileVersionName string, galleryInVMAccessControlProfileVersion GalleryInVMAccessControlProfileVersionUpdate, options *GalleryInVMAccessControlProfileVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryInVMAccessControlProfileVersionsClientUpdateResponse], error)

BeginUpdate - Update a gallery inVMAccessControlProfile version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • inVMAccessControlProfileVersionName - The name of the gallery inVMAccessControlProfile version to be retrieved.
  • galleryInVMAccessControlProfileVersion - Parameters supplied to the update gallery inVMAccessControlProfile version operation.
  • options - GalleryInVMAccessControlProfileVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfileVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", "1.0.0", armcompute.GalleryInVMAccessControlProfileVersionUpdate{
		Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
			ExcludeFromLatest: to.Ptr(false),
			TargetLocations: []*armcompute.TargetRegion{
				{
					Name: to.Ptr("West US"),
				},
				{
					Name: to.Ptr("South Central US"),
				},
				{
					Name: to.Ptr("East US"),
				}},
			DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
			Mode:          to.Ptr(armcompute.AccessControlRulesModeAudit),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryInVMAccessControlProfileVersion = armcompute.GalleryInVMAccessControlProfileVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
	// 		ExcludeFromLatest: to.Ptr(false),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
	// 		TargetLocations: []*armcompute.TargetRegion{
	// 			{
	// 				Name: to.Ptr("West US"),
	// 			},
	// 			{
	// 				Name: to.Ptr("South Central US"),
	// 			},
	// 			{
	// 				Name: to.Ptr("East US"),
	// 		}},
	// 		DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
	// 		Mode: to.Ptr(armcompute.AccessControlRulesModeAudit),
	// 		Rules: &armcompute.AccessControlRules{
	// 			Identities: []*armcompute.AccessControlRulesIdentity{
	// 				{
	// 					Name: to.Ptr("WinPA"),
	// 					ExePath: to.Ptr("C:\\Windows\\System32\\cscript.exe"),
	// 					GroupName: to.Ptr("Administrators"),
	// 					ProcessName: to.Ptr("cscript"),
	// 					UserName: to.Ptr("SYSTEM"),
	// 			}},
	// 			Privileges: []*armcompute.AccessControlRulesPrivilege{
	// 				{
	// 					Name: to.Ptr("GoalState"),
	// 					Path: to.Ptr("/machine"),
	// 					QueryParameters: map[string]*string{
	// 						"comp": to.Ptr("goalstate"),
	// 					},
	// 			}},
	// 			RoleAssignments: []*armcompute.AccessControlRulesRoleAssignment{
	// 				{
	// 					Identities: []*string{
	// 						to.Ptr("WinPA")},
	// 						Role: to.Ptr("Provisioning"),
	// 				}},
	// 				Roles: []*armcompute.AccessControlRulesRole{
	// 					{
	// 						Name: to.Ptr("Provisioning"),
	// 						Privileges: []*string{
	// 							to.Ptr("GoalState")},
	// 					}},
	// 				},
	// 			},
	// 		}
}

func (*GalleryInVMAccessControlProfileVersionsClient) Get

func (client *GalleryInVMAccessControlProfileVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, inVMAccessControlProfileName string, inVMAccessControlProfileVersionName string, options *GalleryInVMAccessControlProfileVersionsClientGetOptions) (GalleryInVMAccessControlProfileVersionsClientGetResponse, error)

Get - Retrieves information about a gallery inVMAccessControlProfile version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • inVMAccessControlProfileVersionName - The name of the gallery inVMAccessControlProfile version to be retrieved.
  • options - GalleryInVMAccessControlProfileVersionsClientGetOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryInVMAccessControlProfileVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", "1.0.0", 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.GalleryInVMAccessControlProfileVersion = armcompute.GalleryInVMAccessControlProfileVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
	// 		ExcludeFromLatest: to.Ptr(false),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
	// 		TargetLocations: []*armcompute.TargetRegion{
	// 			{
	// 				Name: to.Ptr("West US"),
	// 			},
	// 			{
	// 				Name: to.Ptr("South Central US"),
	// 			},
	// 			{
	// 				Name: to.Ptr("East US"),
	// 		}},
	// 		DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
	// 		Mode: to.Ptr(armcompute.AccessControlRulesModeAudit),
	// 		Rules: &armcompute.AccessControlRules{
	// 			Identities: []*armcompute.AccessControlRulesIdentity{
	// 				{
	// 					Name: to.Ptr("WinPA"),
	// 					ExePath: to.Ptr("C:\\Windows\\System32\\cscript.exe"),
	// 					GroupName: to.Ptr("Administrators"),
	// 					ProcessName: to.Ptr("cscript"),
	// 					UserName: to.Ptr("SYSTEM"),
	// 			}},
	// 			Privileges: []*armcompute.AccessControlRulesPrivilege{
	// 				{
	// 					Name: to.Ptr("GoalState"),
	// 					Path: to.Ptr("/machine"),
	// 					QueryParameters: map[string]*string{
	// 						"comp": to.Ptr("goalstate"),
	// 					},
	// 			}},
	// 			RoleAssignments: []*armcompute.AccessControlRulesRoleAssignment{
	// 				{
	// 					Identities: []*string{
	// 						to.Ptr("WinPA")},
	// 						Role: to.Ptr("Provisioning"),
	// 				}},
	// 				Roles: []*armcompute.AccessControlRulesRole{
	// 					{
	// 						Name: to.Ptr("Provisioning"),
	// 						Privileges: []*string{
	// 							to.Ptr("GoalState")},
	// 					}},
	// 				},
	// 			},
	// 		}
}

func (*GalleryInVMAccessControlProfileVersionsClient) NewListByGalleryInVMAccessControlProfilePager

NewListByGalleryInVMAccessControlProfilePager - List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • options - GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.NewListByGalleryInVMAccessControlProfilePager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryInVMAccessControlProfileVersionsClient().NewListByGalleryInVMAccessControlProfilePager("myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", 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.GalleryInVMAccessControlProfileVersionList = armcompute.GalleryInVMAccessControlProfileVersionList{
		// 	Value: []*armcompute.GalleryInVMAccessControlProfileVersion{
		// 		{
		// 			Name: to.Ptr("1.0.0"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName/versions/1.0.0"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryInVMAccessControlProfileVersionProperties{
		// 				ExcludeFromLatest: to.Ptr(false),
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
		// 				TargetLocations: []*armcompute.TargetRegion{
		// 					{
		// 						Name: to.Ptr("West US"),
		// 					},
		// 					{
		// 						Name: to.Ptr("South Central US"),
		// 					},
		// 					{
		// 						Name: to.Ptr("East US"),
		// 				}},
		// 				DefaultAccess: to.Ptr(armcompute.EndpointAccessAllow),
		// 				Mode: to.Ptr(armcompute.AccessControlRulesModeAudit),
		// 				Rules: &armcompute.AccessControlRules{
		// 					Identities: []*armcompute.AccessControlRulesIdentity{
		// 						{
		// 							Name: to.Ptr("WinPA"),
		// 							ExePath: to.Ptr("C:\\Windows\\System32\\cscript.exe"),
		// 							GroupName: to.Ptr("Administrators"),
		// 							ProcessName: to.Ptr("cscript"),
		// 							UserName: to.Ptr("SYSTEM"),
		// 					}},
		// 					Privileges: []*armcompute.AccessControlRulesPrivilege{
		// 						{
		// 							Name: to.Ptr("GoalState"),
		// 							Path: to.Ptr("/machine"),
		// 							QueryParameters: map[string]*string{
		// 								"comp": to.Ptr("goalstate"),
		// 							},
		// 					}},
		// 					RoleAssignments: []*armcompute.AccessControlRulesRoleAssignment{
		// 						{
		// 							Identities: []*string{
		// 								to.Ptr("WinPA")},
		// 								Role: to.Ptr("Provisioning"),
		// 						}},
		// 						Roles: []*armcompute.AccessControlRulesRole{
		// 							{
		// 								Name: to.Ptr("Provisioning"),
		// 								Privileges: []*string{
		// 									to.Ptr("GoalState")},
		// 							}},
		// 						},
		// 					},
		// 			}},
		// 		}
	}
}

type GalleryInVMAccessControlProfileVersionsClientBeginCreateOrUpdateOptions

type GalleryInVMAccessControlProfileVersionsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfileVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginCreateOrUpdate method.

type GalleryInVMAccessControlProfileVersionsClientBeginDeleteOptions

type GalleryInVMAccessControlProfileVersionsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfileVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginDelete method.

type GalleryInVMAccessControlProfileVersionsClientBeginUpdateOptions

type GalleryInVMAccessControlProfileVersionsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfileVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.BeginUpdate method.

type GalleryInVMAccessControlProfileVersionsClientCreateOrUpdateResponse

type GalleryInVMAccessControlProfileVersionsClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile version that you want to create or update.
	GalleryInVMAccessControlProfileVersion
}

GalleryInVMAccessControlProfileVersionsClientCreateOrUpdateResponse contains the response from method GalleryInVMAccessControlProfileVersionsClient.BeginCreateOrUpdate.

type GalleryInVMAccessControlProfileVersionsClientDeleteResponse

type GalleryInVMAccessControlProfileVersionsClientDeleteResponse struct {
}

GalleryInVMAccessControlProfileVersionsClientDeleteResponse contains the response from method GalleryInVMAccessControlProfileVersionsClient.BeginDelete.

type GalleryInVMAccessControlProfileVersionsClientGetOptions

type GalleryInVMAccessControlProfileVersionsClientGetOptions struct {
}

GalleryInVMAccessControlProfileVersionsClientGetOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.Get method.

type GalleryInVMAccessControlProfileVersionsClientGetResponse

type GalleryInVMAccessControlProfileVersionsClientGetResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile version that you want to create or update.
	GalleryInVMAccessControlProfileVersion
}

GalleryInVMAccessControlProfileVersionsClientGetResponse contains the response from method GalleryInVMAccessControlProfileVersionsClient.Get.

type GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileOptions

type GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileOptions struct {
}

GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileOptions contains the optional parameters for the GalleryInVMAccessControlProfileVersionsClient.NewListByGalleryInVMAccessControlProfilePager method.

type GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileResponse

type GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileResponse struct {
	// The List Gallery InVMAccessControlProfile Versions operation response.
	GalleryInVMAccessControlProfileVersionList
}

GalleryInVMAccessControlProfileVersionsClientListByGalleryInVMAccessControlProfileResponse contains the response from method GalleryInVMAccessControlProfileVersionsClient.NewListByGalleryInVMAccessControlProfilePager.

type GalleryInVMAccessControlProfileVersionsClientUpdateResponse

type GalleryInVMAccessControlProfileVersionsClientUpdateResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile version that you want to create or update.
	GalleryInVMAccessControlProfileVersion
}

GalleryInVMAccessControlProfileVersionsClientUpdateResponse contains the response from method GalleryInVMAccessControlProfileVersionsClient.BeginUpdate.

type GalleryInVMAccessControlProfilesClient

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

GalleryInVMAccessControlProfilesClient contains the methods for the GalleryInVMAccessControlProfiles group. Don't use this type directly, use NewGalleryInVMAccessControlProfilesClient() instead.

func NewGalleryInVMAccessControlProfilesClient

func NewGalleryInVMAccessControlProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryInVMAccessControlProfilesClient, error)

NewGalleryInVMAccessControlProfilesClient creates a new instance of GalleryInVMAccessControlProfilesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryInVMAccessControlProfilesClient) BeginCreateOrUpdate

func (client *GalleryInVMAccessControlProfilesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, inVMAccessControlProfileName string, galleryInVMAccessControlProfile GalleryInVMAccessControlProfile, options *GalleryInVMAccessControlProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryInVMAccessControlProfilesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery inVMAccessControlProfile. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • galleryInVMAccessControlProfile - Parameters supplied to the create or update gallery inVMAccessControlProfile operation.
  • options - GalleryInVMAccessControlProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfilesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", armcompute.GalleryInVMAccessControlProfile{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
			ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
			OSType:                 to.Ptr(armcompute.OperatingSystemTypesLinux),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryInVMAccessControlProfile = armcompute.GalleryInVMAccessControlProfile{
	// 	Name: to.Ptr("myInVMAccessControlProfileName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 	},
	// }
}

func (*GalleryInVMAccessControlProfilesClient) BeginDelete

BeginDelete - Delete a gallery inVMAccessControlProfile. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • options - GalleryInVMAccessControlProfilesClientBeginDeleteOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfilesClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryInVMAccessControlProfilesClient) BeginUpdate

BeginUpdate - Update a gallery inVMAccessControlProfile. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • galleryInVMAccessControlProfile - Parameters supplied to the update gallery inVMAccessControlProfile operation.
  • options - GalleryInVMAccessControlProfilesClientBeginUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryInVMAccessControlProfilesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", armcompute.GalleryInVMAccessControlProfileUpdate{
		Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
			ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
			OSType:                 to.Ptr(armcompute.OperatingSystemTypesLinux),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryInVMAccessControlProfile = armcompute.GalleryInVMAccessControlProfile{
	// 	Name: to.Ptr("myInVMAccessControlProfileName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 	},
	// }
}

func (*GalleryInVMAccessControlProfilesClient) Get

Get - Retrieves information about a gallery inVMAccessControlProfile. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • inVMAccessControlProfileName - The name of the gallery inVMAccessControlProfile to be retrieved.
  • options - GalleryInVMAccessControlProfilesClientGetOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryInVMAccessControlProfilesClient().Get(ctx, "myResourceGroup", "myGalleryName", "myInVMAccessControlProfileName", 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.GalleryInVMAccessControlProfile = armcompute.GalleryInVMAccessControlProfile{
	// 	Name: to.Ptr("myInVMAccessControlProfileName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
	// 		OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 	},
	// }
}

func (*GalleryInVMAccessControlProfilesClient) NewListByGalleryPager

NewListByGalleryPager - List gallery inVMAccessControlProfiles in a gallery.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleryInVMAccessControlProfilesClientListByGalleryOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.NewListByGalleryPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryInVMAccessControlProfilesClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", 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.GalleryInVMAccessControlProfileList = armcompute.GalleryInVMAccessControlProfileList{
		// 	Value: []*armcompute.GalleryInVMAccessControlProfile{
		// 		{
		// 			Name: to.Ptr("myInVMAccessControlProfileName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/inVMAccessControlProfiles/myInVMAccessControlProfileName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryInVMAccessControlProfileProperties{
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				ApplicableHostEndpoint: to.Ptr(armcompute.EndpointTypesWireServer),
		// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
		// 			},
		// 	}},
		// }
	}
}

type GalleryInVMAccessControlProfilesClientBeginCreateOrUpdateOptions

type GalleryInVMAccessControlProfilesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginCreateOrUpdate method.

type GalleryInVMAccessControlProfilesClientBeginDeleteOptions

type GalleryInVMAccessControlProfilesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfilesClientBeginDeleteOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginDelete method.

type GalleryInVMAccessControlProfilesClientBeginUpdateOptions

type GalleryInVMAccessControlProfilesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryInVMAccessControlProfilesClientBeginUpdateOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.BeginUpdate method.

type GalleryInVMAccessControlProfilesClientCreateOrUpdateResponse

type GalleryInVMAccessControlProfilesClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile that you want to create or update.
	GalleryInVMAccessControlProfile
}

GalleryInVMAccessControlProfilesClientCreateOrUpdateResponse contains the response from method GalleryInVMAccessControlProfilesClient.BeginCreateOrUpdate.

type GalleryInVMAccessControlProfilesClientDeleteResponse

type GalleryInVMAccessControlProfilesClientDeleteResponse struct {
}

GalleryInVMAccessControlProfilesClientDeleteResponse contains the response from method GalleryInVMAccessControlProfilesClient.BeginDelete.

type GalleryInVMAccessControlProfilesClientGetOptions

type GalleryInVMAccessControlProfilesClientGetOptions struct {
}

GalleryInVMAccessControlProfilesClientGetOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.Get method.

type GalleryInVMAccessControlProfilesClientGetResponse

type GalleryInVMAccessControlProfilesClientGetResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile that you want to create or update.
	GalleryInVMAccessControlProfile
}

GalleryInVMAccessControlProfilesClientGetResponse contains the response from method GalleryInVMAccessControlProfilesClient.Get.

type GalleryInVMAccessControlProfilesClientListByGalleryOptions

type GalleryInVMAccessControlProfilesClientListByGalleryOptions struct {
}

GalleryInVMAccessControlProfilesClientListByGalleryOptions contains the optional parameters for the GalleryInVMAccessControlProfilesClient.NewListByGalleryPager method.

type GalleryInVMAccessControlProfilesClientListByGalleryResponse

type GalleryInVMAccessControlProfilesClientListByGalleryResponse struct {
	// The List Gallery InVMAccessControlProfiles operation response.
	GalleryInVMAccessControlProfileList
}

GalleryInVMAccessControlProfilesClientListByGalleryResponse contains the response from method GalleryInVMAccessControlProfilesClient.NewListByGalleryPager.

type GalleryInVMAccessControlProfilesClientUpdateResponse

type GalleryInVMAccessControlProfilesClientUpdateResponse struct {
	// Specifies information about the gallery inVMAccessControlProfile that you want to create or update.
	GalleryInVMAccessControlProfile
}

GalleryInVMAccessControlProfilesClientUpdateResponse contains the response from method GalleryInVMAccessControlProfilesClient.BeginUpdate.

type GalleryList

type GalleryList struct {
	// REQUIRED; A list of galleries.
	Value []*Gallery

	// The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries.
	NextLink *string

	// The security profile of a gallery image version
	SecurityProfile *ImageVersionSecurityProfile
}

GalleryList - The List Galleries operation response.

func (GalleryList) MarshalJSON

func (g GalleryList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryList.

func (*GalleryList) UnmarshalJSON

func (g *GalleryList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryList.

type GalleryOSDiskImage

type GalleryOSDiskImage struct {
	// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'
	HostCaching *HostCaching

	// The source for the disk image.
	Source *GalleryDiskImageSource

	// READ-ONLY; This property indicates the size of the VHD to be created.
	SizeInGB *int32
}

GalleryOSDiskImage - This is the OS disk image.

func (GalleryOSDiskImage) MarshalJSON

func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage.

func (*GalleryOSDiskImage) UnmarshalJSON

func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage.

type GalleryProperties

type GalleryProperties struct {
	// The description of this Shared Image Gallery resource. This property is updatable.
	Description *string

	// Describes the gallery unique name.
	Identifier *GalleryIdentifier

	// Profile for gallery sharing to subscription or tenant
	SharingProfile *SharingProfile

	// Contains information about the soft deletion policy of the gallery.
	SoftDeletePolicy *SoftDeletePolicy

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState

	// READ-ONLY; Sharing status of current gallery.
	SharingStatus *SharingStatus
}

GalleryProperties - Describes the properties of a Shared Image Gallery.

func (GalleryProperties) MarshalJSON

func (g GalleryProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryProperties.

func (*GalleryProperties) UnmarshalJSON

func (g *GalleryProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryProperties.

type GalleryProvisioningState

type GalleryProvisioningState string

GalleryProvisioningState - The provisioning state, which only appears in the response.

const (
	GalleryProvisioningStateCreating  GalleryProvisioningState = "Creating"
	GalleryProvisioningStateDeleting  GalleryProvisioningState = "Deleting"
	GalleryProvisioningStateFailed    GalleryProvisioningState = "Failed"
	GalleryProvisioningStateMigrating GalleryProvisioningState = "Migrating"
	GalleryProvisioningStateSucceeded GalleryProvisioningState = "Succeeded"
	GalleryProvisioningStateUpdating  GalleryProvisioningState = "Updating"
)

func PossibleGalleryProvisioningStateValues

func PossibleGalleryProvisioningStateValues() []GalleryProvisioningState

PossibleGalleryProvisioningStateValues returns the possible values for the GalleryProvisioningState const type.

type GalleryScript added in v7.3.0

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

	// Describes the properties of a gallery Script Definition.
	Properties *GalleryScriptProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryScript - Specifies information about the gallery Script Definition that you want to create or update.

func (GalleryScript) MarshalJSON added in v7.3.0

func (g GalleryScript) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScript.

func (*GalleryScript) UnmarshalJSON added in v7.3.0

func (g *GalleryScript) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScript.

type GalleryScriptList added in v7.3.0

type GalleryScriptList struct {
	// REQUIRED; The GalleryScript items on this page
	Value []*GalleryScript

	// The link to the next page of items
	NextLink *string
}

GalleryScriptList - The List Gallery Script operation response.

func (GalleryScriptList) MarshalJSON added in v7.3.0

func (g GalleryScriptList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptList.

func (*GalleryScriptList) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptList.

type GalleryScriptParameter added in v7.3.0

type GalleryScriptParameter struct {
	// REQUIRED; The name of the parameter.
	Name *string

	// The default value of the parameter, only applies to string types.
	DefaultValue *string

	// A description to help users understand what this parameter means
	Description *string

	// A list of permissible values. Only applicable values are from 'enum' values defined in 'GalleryScriptParameter'.
	EnumValues []*string

	// The minimum value of parameter.
	MaxValue *string

	// The minimum value of parameter.
	MinValue *string

	// Indicates whether this parameter must be passed.
	Required *bool

	// Specifies the type of the Gallery Script parameter. Possible values are: String, Int, Double, Boolean, Enum
	Type *GalleryScriptParameterType
}

GalleryScriptParameter - The definition of a parameter that can be passed to a script of a Gallery Script Version.

func (GalleryScriptParameter) MarshalJSON added in v7.3.0

func (g GalleryScriptParameter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptParameter.

func (*GalleryScriptParameter) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptParameter.

type GalleryScriptParameterType added in v7.3.0

type GalleryScriptParameterType string

GalleryScriptParameterType - Specifies the type of the Gallery Script parameter. Possible values are: String, Int, Double, Boolean, Enum

const (
	// GalleryScriptParameterTypeBoolean - Boolean gallery script parameter type
	GalleryScriptParameterTypeBoolean GalleryScriptParameterType = "Boolean"
	// GalleryScriptParameterTypeDouble - Double gallery script parameter type
	GalleryScriptParameterTypeDouble GalleryScriptParameterType = "Double"
	// GalleryScriptParameterTypeEnum - Enum gallery script parameter type
	GalleryScriptParameterTypeEnum GalleryScriptParameterType = "Enum"
	// GalleryScriptParameterTypeInt - Int gallery script parameter type
	GalleryScriptParameterTypeInt GalleryScriptParameterType = "Int"
	// GalleryScriptParameterTypeString - String gallery script parameter type
	GalleryScriptParameterTypeString GalleryScriptParameterType = "String"
)

func PossibleGalleryScriptParameterTypeValues added in v7.3.0

func PossibleGalleryScriptParameterTypeValues() []GalleryScriptParameterType

PossibleGalleryScriptParameterTypeValues returns the possible values for the GalleryScriptParameterType const type.

type GalleryScriptProperties added in v7.3.0

type GalleryScriptProperties struct {
	// REQUIRED; This property allows you to specify the supported type of the OS that application is built for. Possible values
	// are: Windows, Linux.
	SupportedOSType *OperatingSystemTypes

	// The description of this gallery script definition resource. This property is updatable.
	Description *string

	// The end of life date of the gallery Script Definition. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// The Eula agreement (End User License Agreement) for the gallery Script Definition.
	Eula *string

	// The privacy statement uri.
	PrivacyStatementURI *string

	// The release note uri.
	ReleaseNoteURI *string

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState
}

GalleryScriptProperties - Describes the properties of a gallery script definition.

func (GalleryScriptProperties) MarshalJSON added in v7.3.0

func (g GalleryScriptProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptProperties.

func (*GalleryScriptProperties) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptProperties.

type GalleryScriptUpdate added in v7.3.0

type GalleryScriptUpdate struct {
	// Gallery script definition properties to update.
	Properties *GalleryScriptProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryScriptUpdate - Specifies information about the gallery Script Definition that you want to update.

func (GalleryScriptUpdate) MarshalJSON added in v7.3.0

func (g GalleryScriptUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptUpdate.

func (*GalleryScriptUpdate) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptUpdate.

type GalleryScriptVersion added in v7.3.0

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

	// Describes the properties of a gallery Script Version.
	Properties *GalleryScriptVersionProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GalleryScriptVersion - Concrete tracked resource types can be created by aliasing this type using a specific property type.

func (GalleryScriptVersion) MarshalJSON added in v7.3.0

func (g GalleryScriptVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersion.

func (*GalleryScriptVersion) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersion.

type GalleryScriptVersionList added in v7.3.0

type GalleryScriptVersionList struct {
	// REQUIRED; The GalleryScriptVersion items on this page
	Value []*GalleryScriptVersion

	// The link to the next page of items
	NextLink *string
}

GalleryScriptVersionList - Paged collection of GalleryScriptVersion items

func (GalleryScriptVersionList) MarshalJSON added in v7.3.0

func (g GalleryScriptVersionList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersionList.

func (*GalleryScriptVersionList) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersionList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersionList.

type GalleryScriptVersionProperties added in v7.3.0

type GalleryScriptVersionProperties struct {
	// REQUIRED; The publishing profile of a gallery image version.
	PublishingProfile *GalleryScriptVersionPublishingProfile

	// The safety profile of the Gallery Script Version.
	SafetyProfile *GalleryScriptVersionSafetyProfile

	// READ-ONLY; The provisioning state, which only appears in the response.
	ProvisioningState *GalleryProvisioningState

	// READ-ONLY; This is the replication status of the gallery image version.
	ReplicationStatus *ReplicationStatus
}

GalleryScriptVersionProperties - Describes the properties of a gallery script version.

func (GalleryScriptVersionProperties) MarshalJSON added in v7.3.0

func (g GalleryScriptVersionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersionProperties.

func (*GalleryScriptVersionProperties) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersionProperties.

type GalleryScriptVersionPublishingProfile added in v7.3.0

type GalleryScriptVersionPublishingProfile struct {
	// REQUIRED; The source script from which the Script Version is going to be created.
	Source *ScriptSource

	// The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property
	// is updatable.
	EndOfLifeDate *time.Time

	// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.
	ExcludeFromLatest *bool

	// The number of replicas of the Image Version to be created per region. This property would take effect for a region when
	// regionalReplicaCount is not specified. This property is updatable.
	ReplicaCount *int32

	// Optional parameter which specifies the mode to be used for replication. This property is not updatable.
	ReplicationMode *ReplicationMode

	// Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType,
	// but can be overridden per region by specifying
	// targetRegions[].storageAccountType. This property is not updatable.
	StorageAccountStrategy *StorageAccountStrategy

	// Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy.
	// This property is not updatable.
	StorageAccountType *StorageAccountType

	// The target extended locations where the Image Version is going to be replicated to. This property is updatable.
	TargetExtendedLocations []*GalleryTargetExtendedLocation

	// The target regions where the Image Version is going to be replicated to. This property is updatable.
	TargetRegions []*TargetRegion

	// READ-ONLY; The timestamp for when the gallery image version is published.
	PublishedDate *time.Time
}

GalleryScriptVersionPublishingProfile - The publishing profile of a gallery image version.

func (GalleryScriptVersionPublishingProfile) MarshalJSON added in v7.3.0

func (g GalleryScriptVersionPublishingProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersionPublishingProfile.

func (*GalleryScriptVersionPublishingProfile) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersionPublishingProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersionPublishingProfile.

type GalleryScriptVersionSafetyProfile added in v7.3.0

type GalleryScriptVersionSafetyProfile struct {
	// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed.
	AllowDeletionOfReplicatedLocations *bool
}

GalleryScriptVersionSafetyProfile - The safety profile of the Gallery Script Version.

func (GalleryScriptVersionSafetyProfile) MarshalJSON added in v7.3.0

func (g GalleryScriptVersionSafetyProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersionSafetyProfile.

func (*GalleryScriptVersionSafetyProfile) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersionSafetyProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersionSafetyProfile.

type GalleryScriptVersionUpdate added in v7.3.0

type GalleryScriptVersionUpdate struct {
	// Gallery script version properties to update.
	Properties *GalleryScriptVersionProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryScriptVersionUpdate - Specifies information about the gallery Script Version that you want to update.

func (GalleryScriptVersionUpdate) MarshalJSON added in v7.3.0

func (g GalleryScriptVersionUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryScriptVersionUpdate.

func (*GalleryScriptVersionUpdate) UnmarshalJSON added in v7.3.0

func (g *GalleryScriptVersionUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryScriptVersionUpdate.

type GalleryScriptVersionsClient added in v7.3.0

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

GalleryScriptVersionsClient contains the methods for the GalleryScriptVersions group. Don't use this type directly, use NewGalleryScriptVersionsClient() instead.

func NewGalleryScriptVersionsClient added in v7.3.0

func NewGalleryScriptVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryScriptVersionsClient, error)

NewGalleryScriptVersionsClient creates a new instance of GalleryScriptVersionsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryScriptVersionsClient) BeginCreateOrUpdate added in v7.3.0

func (client *GalleryScriptVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScriptVersionName string, galleryScriptVersion GalleryScriptVersion, options *GalleryScriptVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryScriptVersionsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a gallery Script Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScriptVersionName - The name of the gallery Script Version to be retrieved.
  • galleryScriptVersion - Parameters supplied to the create or update gallery Script Version operation.
  • options - GalleryScriptVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_Create.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryScriptName", "1.0.0", armcompute.GalleryScriptVersion{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryScriptVersionProperties{
			PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
				EndOfLifeDate:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t }()),
				ReplicaCount:       to.Ptr[int32](2),
				StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardLRS),
					}},
				Source: &armcompute.ScriptSource{
					Parameters: []*armcompute.GalleryScriptParameter{
						{
							Name:         to.Ptr("location"),
							DefaultValue: to.Ptr("westus"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("myGalleryScriptParameter1"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("myGalleryScriptParameter2"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("numberOfUnits"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("3"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeInt),
							MaxValue:     to.Ptr("5"),
							MinValue:     to.Ptr("1"),
						},
						{
							Name:         to.Ptr("weightOfUnit"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("0.6"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
							MaxValue:     to.Ptr("2"),
							MinValue:     to.Ptr("0.1"),
						},
						{
							Name:         to.Ptr("typeOfProduct"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("Fruit"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
							EnumValues: []*string{
								to.Ptr("Fruit"),
								to.Ptr("Vegetable"),
								to.Ptr("Greens"),
								to.Ptr("Nuts")},
						}},
					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1?{sasKey}"),
				},
			},
			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryScriptVersion = armcompute.GalleryScriptVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/scripts/versions"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScript/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			Source: &armcompute.ScriptSource{
	// 				Parameters: []*armcompute.GalleryScriptParameter{
	// 					{
	// 						Name: to.Ptr("location"),
	// 						DefaultValue: to.Ptr("westus"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter1"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter2"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("numberOfUnits"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("3"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeInt),
	// 						MaxValue: to.Ptr("5"),
	// 						MinValue: to.Ptr("1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("weightOfUnit"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("0.6"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
	// 						MaxValue: to.Ptr("2"),
	// 						MinValue: to.Ptr("0.1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("typeOfProduct"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("Fruit"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
	// 						EnumValues: []*string{
	// 							to.Ptr("Fruit"),
	// 							to.Ptr("Vegetable"),
	// 							to.Ptr("Greens"),
	// 							to.Ptr("Nuts")},
	// 					}},
	// 					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1"),
	// 				},
	// 			},
	// 			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
	// 				AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			},
	// 		},
	// 	}
}

func (*GalleryScriptVersionsClient) BeginDelete added in v7.3.0

func (client *GalleryScriptVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScriptVersionName string, options *GalleryScriptVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryScriptVersionsClientDeleteResponse], error)

BeginDelete - Delete a gallery Script Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScriptVersionName - The name of the gallery Script Version to be retrieved.
  • options - GalleryScriptVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptVersionsClient().BeginDelete(ctx, "myResourceGroupName", "myGalleryName", "myGalleryScriptName", "1.0.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryScriptVersionsClient) BeginUpdate added in v7.3.0

func (client *GalleryScriptVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScriptVersionName string, galleryScriptVersion GalleryScriptVersionUpdate, options *GalleryScriptVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryScriptVersionsClientUpdateResponse], error)

BeginUpdate - Update a gallery Script Version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScriptVersionName - The name of the gallery Script Version to be retrieved.
  • galleryScriptVersion - Parameters supplied to the update gallery Script Version operation.
  • options - GalleryScriptVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_Update.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptVersionsClient().BeginUpdate(ctx, "myResourceGroupName", "myGalleryName", "myGalleryScriptName", "1.0.0", armcompute.GalleryScriptVersionUpdate{
		Properties: &armcompute.GalleryScriptVersionProperties{
			PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
				EndOfLifeDate:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t }()),
				ReplicaCount:       to.Ptr[int32](2),
				StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
				TargetRegions: []*armcompute.TargetRegion{
					{
						Name:                 to.Ptr("West US"),
						ExcludeFromLatest:    to.Ptr(false),
						RegionalReplicaCount: to.Ptr[int32](2),
						StorageAccountType:   to.Ptr(armcompute.StorageAccountTypeStandardLRS),
					}},
				Source: &armcompute.ScriptSource{
					Parameters: []*armcompute.GalleryScriptParameter{
						{
							Name:         to.Ptr("location"),
							DefaultValue: to.Ptr("westus"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("myGalleryScriptParameter1"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("myGalleryScriptParameter2"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("default value of parameter"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeString),
						},
						{
							Name:         to.Ptr("numberOfUnits"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("3"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeInt),
							MaxValue:     to.Ptr("5"),
							MinValue:     to.Ptr("1"),
						},
						{
							Name:         to.Ptr("weightOfUnit"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("0.6"),
							Required:     to.Ptr(true),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
							MaxValue:     to.Ptr("2"),
							MinValue:     to.Ptr("0.1"),
						},
						{
							Name:         to.Ptr("typeOfProduct"),
							Description:  to.Ptr("description of the parameter"),
							DefaultValue: to.Ptr("Fruit"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
							EnumValues: []*string{
								to.Ptr("Fruit"),
								to.Ptr("Vegetable"),
								to.Ptr("Greens"),
								to.Ptr("Nuts")},
						}},
					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1?{sasKey}"),
				},
			},
			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
				AllowDeletionOfReplicatedLocations: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryScriptVersion = armcompute.GalleryScriptVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/scripts/versions"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			Source: &armcompute.ScriptSource{
	// 				Parameters: []*armcompute.GalleryScriptParameter{
	// 					{
	// 						Name: to.Ptr("location"),
	// 						DefaultValue: to.Ptr("westus"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter1"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter2"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("numberOfUnits"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("3"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeInt),
	// 						MaxValue: to.Ptr("5"),
	// 						MinValue: to.Ptr("1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("weightOfUnit"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("0.6"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
	// 						MaxValue: to.Ptr("2"),
	// 						MinValue: to.Ptr("0.1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("typeOfProduct"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("Fruit"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
	// 						EnumValues: []*string{
	// 							to.Ptr("Fruit"),
	// 							to.Ptr("Vegetable"),
	// 							to.Ptr("Greens"),
	// 							to.Ptr("Nuts")},
	// 					}},
	// 					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1"),
	// 				},
	// 			},
	// 			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
	// 				AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			},
	// 		},
	// 	}
}

func (*GalleryScriptVersionsClient) Get added in v7.3.0

func (client *GalleryScriptVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScriptVersionName string, options *GalleryScriptVersionsClientGetOptions) (GalleryScriptVersionsClientGetResponse, error)

Get - Custom ArmResourceRead operation template with CloudError as Error If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScriptVersionName - The name of the gallery Script Version to be retrieved.
  • options - GalleryScriptVersionsClientGetOptions contains the optional parameters for the GalleryScriptVersionsClient.Get method.
Example (GetAGalleryScriptVersion)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryScriptVersionsClient().Get(ctx, "myResourceGroupName", "myGalleryName", "myGalleryScriptName", "1.0.0", 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.GalleryScriptVersion = armcompute.GalleryScriptVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries/scripts/versions"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			Source: &armcompute.ScriptSource{
	// 				Parameters: []*armcompute.GalleryScriptParameter{
	// 					{
	// 						Name: to.Ptr("location"),
	// 						DefaultValue: to.Ptr("westus"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter1"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter2"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("numberOfUnits"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("3"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeInt),
	// 						MaxValue: to.Ptr("5"),
	// 						MinValue: to.Ptr("1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("weightOfUnit"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("0.6"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
	// 						MaxValue: to.Ptr("2"),
	// 						MinValue: to.Ptr("0.1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("typeOfProduct"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("Fruit"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
	// 						EnumValues: []*string{
	// 							to.Ptr("Fruit"),
	// 							to.Ptr("Vegetable"),
	// 							to.Ptr("Greens"),
	// 							to.Ptr("Nuts")},
	// 					}},
	// 					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1"),
	// 				},
	// 			},
	// 			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
	// 				AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			},
	// 		},
	// 	}
}
Example (GetAGalleryScriptVersionWithReplicationStatus)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_Get_WithReplicationStatus.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryScriptVersionsClient().Get(ctx, "myResourceGroupName", "myGalleryName", "myGalleryScriptName", "1.0.0", 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.GalleryScriptVersion = armcompute.GalleryScriptVersion{
	// 	Name: to.Ptr("1.0.0"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptVersionProperties{
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
	// 			EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
	// 			ExcludeFromLatest: to.Ptr(false),
	// 			PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			TargetRegions: []*armcompute.TargetRegion{
	// 				{
	// 					Name: to.Ptr("West US"),
	// 					ExcludeFromLatest: to.Ptr(false),
	// 					RegionalReplicaCount: to.Ptr[int32](2),
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
	// 			}},
	// 			Source: &armcompute.ScriptSource{
	// 				Parameters: []*armcompute.GalleryScriptParameter{
	// 					{
	// 						Name: to.Ptr("location"),
	// 						DefaultValue: to.Ptr("westus"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter1"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("myGalleryScriptParameter2"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("default value of parameter"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
	// 					},
	// 					{
	// 						Name: to.Ptr("numberOfUnits"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("3"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeInt),
	// 						MaxValue: to.Ptr("5"),
	// 						MinValue: to.Ptr("1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("weightOfUnit"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("0.6"),
	// 						Required: to.Ptr(true),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
	// 						MaxValue: to.Ptr("2"),
	// 						MinValue: to.Ptr("0.1"),
	// 					},
	// 					{
	// 						Name: to.Ptr("typeOfProduct"),
	// 						Description: to.Ptr("description of the parameter"),
	// 						DefaultValue: to.Ptr("Fruit"),
	// 						Required: to.Ptr(false),
	// 						Type: to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
	// 						EnumValues: []*string{
	// 							to.Ptr("Fruit"),
	// 							to.Ptr("Vegetable"),
	// 							to.Ptr("Greens"),
	// 							to.Ptr("Nuts")},
	// 					}},
	// 					ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1"),
	// 				},
	// 			},
	// 			ReplicationStatus: &armcompute.ReplicationStatus{
	// 				AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted),
	// 				Summary: []*armcompute.RegionalReplicationStatus{
	// 					{
	// 						Progress: to.Ptr[int32](100),
	// 						Region: to.Ptr("West US"),
	// 						State: to.Ptr(armcompute.ReplicationStateCompleted),
	// 						Details: to.Ptr(""),
	// 				}},
	// 			},
	// 			SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
	// 				AllowDeletionOfReplicatedLocations: to.Ptr(false),
	// 			},
	// 		},
	// 	}
}

func (*GalleryScriptVersionsClient) NewListByGalleryScriptPager added in v7.3.0

func (client *GalleryScriptVersionsClient) NewListByGalleryScriptPager(resourceGroupName string, galleryName string, galleryScriptName string, options *GalleryScriptVersionsClientListByGalleryScriptOptions) *runtime.Pager[GalleryScriptVersionsClientListByGalleryScriptResponse]

NewListByGalleryScriptPager - List gallery Script Versions in a gallery Script Definition.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • options - GalleryScriptVersionsClientListByGalleryScriptOptions contains the optional parameters for the GalleryScriptVersionsClient.NewListByGalleryScriptPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScriptVersion_ListByGalleryScript.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryScriptVersionsClient().NewListByGalleryScriptPager("myResourceGroupName", "myGalleryName", "myGalleryScriptName", 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.GalleryScriptVersionList = armcompute.GalleryScriptVersionList{
		// 	Value: []*armcompute.GalleryScriptVersion{
		// 		{
		// 			Name: to.Ptr("1.0.0"),
		// 			Type: to.Ptr("Microsoft.Compute/galleries/script/versions"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryScriptVersionProperties{
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
		// 					EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
		// 					ExcludeFromLatest: to.Ptr(false),
		// 					PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
		// 					ReplicaCount: to.Ptr[int32](2),
		// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					TargetRegions: []*armcompute.TargetRegion{
		// 						{
		// 							Name: to.Ptr("West US"),
		// 							ExcludeFromLatest: to.Ptr(false),
		// 							RegionalReplicaCount: to.Ptr[int32](2),
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 					}},
		// 					Source: &armcompute.ScriptSource{
		// 						Parameters: []*armcompute.GalleryScriptParameter{
		// 							{
		// 								Name: to.Ptr("location"),
		// 								DefaultValue: to.Ptr("westus"),
		// 								Required: to.Ptr(true),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
		// 							},
		// 							{
		// 								Name: to.Ptr("myGalleryScriptParameter1"),
		// 								Description: to.Ptr("description of the parameter"),
		// 								DefaultValue: to.Ptr("default value of parameter"),
		// 								Required: to.Ptr(true),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
		// 							},
		// 							{
		// 								Name: to.Ptr("myGalleryScriptParameter2"),
		// 								Description: to.Ptr("description of the parameter"),
		// 								DefaultValue: to.Ptr("default value of parameter"),
		// 								Required: to.Ptr(false),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
		// 							},
		// 							{
		// 								Name: to.Ptr("numberOfUnits"),
		// 								Description: to.Ptr("description of the parameter"),
		// 								DefaultValue: to.Ptr("3"),
		// 								Required: to.Ptr(true),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeInt),
		// 								MaxValue: to.Ptr("5"),
		// 								MinValue: to.Ptr("1"),
		// 							},
		// 							{
		// 								Name: to.Ptr("weightOfUnit"),
		// 								Description: to.Ptr("description of the parameter"),
		// 								DefaultValue: to.Ptr("0.6"),
		// 								Required: to.Ptr(true),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeDouble),
		// 								MaxValue: to.Ptr("2"),
		// 								MinValue: to.Ptr("0.1"),
		// 							},
		// 							{
		// 								Name: to.Ptr("typeOfProduct"),
		// 								Description: to.Ptr("description of the parameter"),
		// 								DefaultValue: to.Ptr("Fruit"),
		// 								Required: to.Ptr(false),
		// 								Type: to.Ptr(armcompute.GalleryScriptParameterTypeEnum),
		// 								EnumValues: []*string{
		// 									to.Ptr("Fruit"),
		// 									to.Ptr("Vegetable"),
		// 									to.Ptr("Greens"),
		// 									to.Ptr("Nuts")},
		// 							}},
		// 							ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript1.ps1"),
		// 						},
		// 					},
		// 					SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
		// 						AllowDeletionOfReplicatedLocations: to.Ptr(false),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("1.0.1"),
		// 				Type: to.Ptr("Microsoft.Compute/galleries/script/versions"),
		// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.1"),
		// 				Location: to.Ptr("West US"),
		// 				Properties: &armcompute.GalleryScriptVersionProperties{
		// 					ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 					PublishingProfile: &armcompute.GalleryScriptVersionPublishingProfile{
		// 						EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2027-07-01T07:00:00.000Z"); return t}()),
		// 						ExcludeFromLatest: to.Ptr(false),
		// 						PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-21T17:13:57.597Z"); return t}()),
		// 						ReplicaCount: to.Ptr[int32](2),
		// 						StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 						TargetRegions: []*armcompute.TargetRegion{
		// 							{
		// 								Name: to.Ptr("West US"),
		// 								ExcludeFromLatest: to.Ptr(false),
		// 								RegionalReplicaCount: to.Ptr[int32](2),
		// 								StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
		// 						}},
		// 						Source: &armcompute.ScriptSource{
		// 							Parameters: []*armcompute.GalleryScriptParameter{
		// 								{
		// 									Name: to.Ptr("myGalleryScriptParameter1"),
		// 									Description: to.Ptr("description of the parameter"),
		// 									DefaultValue: to.Ptr("default value of parameter"),
		// 									Required: to.Ptr(true),
		// 									Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
		// 								},
		// 								{
		// 									Name: to.Ptr("myGalleryScriptParameter2"),
		// 									Description: to.Ptr("description of the parameter"),
		// 									DefaultValue: to.Ptr("default value of parameter"),
		// 									Required: to.Ptr(false),
		// 									Type: to.Ptr(armcompute.GalleryScriptParameterTypeString),
		// 							}},
		// 							ScriptLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/myScript2.ps1"),
		// 						},
		// 					},
		// 					SafetyProfile: &armcompute.GalleryScriptVersionSafetyProfile{
		// 						AllowDeletionOfReplicatedLocations: to.Ptr(false),
		// 					},
		// 				},
		// 		}},
		// 	}
	}
}

type GalleryScriptVersionsClientBeginCreateOrUpdateOptions added in v7.3.0

type GalleryScriptVersionsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginCreateOrUpdate method.

type GalleryScriptVersionsClientBeginDeleteOptions added in v7.3.0

type GalleryScriptVersionsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginDelete method.

type GalleryScriptVersionsClientBeginUpdateOptions added in v7.3.0

type GalleryScriptVersionsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryScriptVersionsClient.BeginUpdate method.

type GalleryScriptVersionsClientCreateOrUpdateResponse added in v7.3.0

type GalleryScriptVersionsClientCreateOrUpdateResponse struct {
	// Concrete tracked resource types can be created by aliasing this type using a specific property type.
	GalleryScriptVersion
}

GalleryScriptVersionsClientCreateOrUpdateResponse contains the response from method GalleryScriptVersionsClient.BeginCreateOrUpdate.

type GalleryScriptVersionsClientDeleteResponse added in v7.3.0

type GalleryScriptVersionsClientDeleteResponse struct {
}

GalleryScriptVersionsClientDeleteResponse contains the response from method GalleryScriptVersionsClient.BeginDelete.

type GalleryScriptVersionsClientGetOptions added in v7.3.0

type GalleryScriptVersionsClientGetOptions struct {
}

GalleryScriptVersionsClientGetOptions contains the optional parameters for the GalleryScriptVersionsClient.Get method.

type GalleryScriptVersionsClientGetResponse added in v7.3.0

type GalleryScriptVersionsClientGetResponse struct {
	// Concrete tracked resource types can be created by aliasing this type using a specific property type.
	GalleryScriptVersion
}

GalleryScriptVersionsClientGetResponse contains the response from method GalleryScriptVersionsClient.Get.

type GalleryScriptVersionsClientListByGalleryScriptOptions added in v7.3.0

type GalleryScriptVersionsClientListByGalleryScriptOptions struct {
}

GalleryScriptVersionsClientListByGalleryScriptOptions contains the optional parameters for the GalleryScriptVersionsClient.NewListByGalleryScriptPager method.

type GalleryScriptVersionsClientListByGalleryScriptResponse added in v7.3.0

type GalleryScriptVersionsClientListByGalleryScriptResponse struct {
	// Paged collection of GalleryScriptVersion items
	GalleryScriptVersionList
}

GalleryScriptVersionsClientListByGalleryScriptResponse contains the response from method GalleryScriptVersionsClient.NewListByGalleryScriptPager.

type GalleryScriptVersionsClientUpdateResponse added in v7.3.0

type GalleryScriptVersionsClientUpdateResponse struct {
	// Concrete tracked resource types can be created by aliasing this type using a specific property type.
	GalleryScriptVersion
}

GalleryScriptVersionsClientUpdateResponse contains the response from method GalleryScriptVersionsClient.BeginUpdate.

type GalleryScriptsClient added in v7.3.0

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

GalleryScriptsClient contains the methods for the GalleryScripts group. Don't use this type directly, use NewGalleryScriptsClient() instead.

func NewGalleryScriptsClient added in v7.3.0

func NewGalleryScriptsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryScriptsClient, error)

NewGalleryScriptsClient creates a new instance of GalleryScriptsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GalleryScriptsClient) BeginCreateOrUpdate added in v7.3.0

func (client *GalleryScriptsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScript GalleryScript, options *GalleryScriptsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryScriptsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a Gallery Script Definition. Gallery scripts allow the storage, sharing and reuse of common scripts If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScript - Parameters supplied to the create or update gallery Script operation.
  • options - GalleryScriptsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryScriptsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScript_Create.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryScriptName", armcompute.GalleryScript{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryScriptProperties{
			Description:         to.Ptr("This is the gallery script description."),
			Eula:                to.Ptr("This is the gallery script EULA."),
			PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("{myReleaseNoteUri}"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryScript = armcompute.GalleryScript{
	// 	Name: to.Ptr("myGalleryScriptName"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptProperties{
	// 		Description: to.Ptr("This is the gallery script description."),
	// 		Eula: to.Ptr("This is the gallery script EULA."),
	// 		PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		ReleaseNoteURI: to.Ptr("{myReleaseNoteUri}"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryScriptsClient) BeginDelete added in v7.3.0

func (client *GalleryScriptsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, options *GalleryScriptsClientBeginDeleteOptions) (*runtime.Poller[GalleryScriptsClientDeleteResponse], error)

BeginDelete - Delete a gallery Script Definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • options - GalleryScriptsClientBeginDeleteOptions contains the optional parameters for the GalleryScriptsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScript_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryScriptName", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*GalleryScriptsClient) BeginUpdate added in v7.3.0

func (client *GalleryScriptsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, galleryScript GalleryScriptUpdate, options *GalleryScriptsClientBeginUpdateOptions) (*runtime.Poller[GalleryScriptsClientUpdateResponse], error)

BeginUpdate - Update a gallery Script Definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • galleryScript - Parameters supplied to the update gallery Script operation.
  • options - GalleryScriptsClientBeginUpdateOptions contains the optional parameters for the GalleryScriptsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScript_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryScriptsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryScriptName", armcompute.GalleryScriptUpdate{
		Properties: &armcompute.GalleryScriptProperties{
			Description:         to.Ptr("This is the gallery script description."),
			Eula:                to.Ptr("This is the gallery script EULA."),
			PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("{myReleaseNoteUri}"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.GalleryScript = armcompute.GalleryScript{
	// 	Name: to.Ptr("myGalleryScriptName"),
	// 	Type: to.Ptr("Microsoft.Compute/galleries"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptProperties{
	// 		Description: to.Ptr("This is the gallery script description."),
	// 		Eula: to.Ptr("This is the gallery script EULA."),
	// 		PrivacyStatementURI: to.Ptr("myPrivacyStatementUri"),
	// 		ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryScriptsClient) Get added in v7.3.0

func (client *GalleryScriptsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryScriptName string, options *GalleryScriptsClientGetOptions) (GalleryScriptsClientGetResponse, error)

Get - Retrieves information about a gallery script definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • galleryScriptName - The name of the gallery Script Definition to be retrieved.
  • options - GalleryScriptsClientGetOptions contains the optional parameters for the GalleryScriptsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScript_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryScriptsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryScriptName", 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.GalleryScript = armcompute.GalleryScript{
	// 	Name: to.Ptr("myGalleryScriptName"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.GalleryScriptProperties{
	// 		Description: to.Ptr("This is the gallery script description."),
	// 		Eula: to.Ptr("This is the gallery script EULA."),
	// 		PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
	// 		ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
	// 		ReleaseNoteURI: to.Ptr("{myReleaseNoteUri}"),
	// 		SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 	},
	// }
}

func (*GalleryScriptsClient) NewListByGalleryPager added in v7.3.0

func (client *GalleryScriptsClient) NewListByGalleryPager(resourceGroupName string, galleryName string, options *GalleryScriptsClientListByGalleryOptions) *runtime.Pager[GalleryScriptsClientListByGalleryResponse]

NewListByGalleryPager - List gallery Script Definitions in a gallery.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • options - GalleryScriptsClientListByGalleryOptions contains the optional parameters for the GalleryScriptsClient.NewListByGalleryPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryScriptExamples/GalleryScript_ListByGallery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryScriptsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", 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.GalleryScriptList = armcompute.GalleryScriptList{
		// 	Value: []*armcompute.GalleryScript{
		// 		{
		// 			Name: to.Ptr("myGalleryScriptName"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryScriptProperties{
		// 				Description: to.Ptr("This is the gallery script description."),
		// 				Eula: to.Ptr("This is the gallery script EULA."),
		// 				PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				ReleaseNoteURI: to.Ptr("{myReleaseNoteUri}"),
		// 				SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myGalleryScriptName2"),
		// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName2"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.GalleryScriptProperties{
		// 				Description: to.Ptr("This is the gallery script description."),
		// 				Eula: to.Ptr("This is the gallery script EULA."),
		// 				PrivacyStatementURI: to.Ptr("{myPrivacyStatementUri}"),
		// 				ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
		// 				ReleaseNoteURI: to.Ptr("{myReleaseNoteUri}"),
		// 				SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 			},
		// 	}},
		// }
	}
}

type GalleryScriptsClientBeginCreateOrUpdateOptions added in v7.3.0

type GalleryScriptsClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryScriptsClient.BeginCreateOrUpdate method.

type GalleryScriptsClientBeginDeleteOptions added in v7.3.0

type GalleryScriptsClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptsClientBeginDeleteOptions contains the optional parameters for the GalleryScriptsClient.BeginDelete method.

type GalleryScriptsClientBeginUpdateOptions added in v7.3.0

type GalleryScriptsClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GalleryScriptsClientBeginUpdateOptions contains the optional parameters for the GalleryScriptsClient.BeginUpdate method.

type GalleryScriptsClientCreateOrUpdateResponse added in v7.3.0

type GalleryScriptsClientCreateOrUpdateResponse struct {
	// Specifies information about the gallery Script Definition that you want to create or update.
	GalleryScript
}

GalleryScriptsClientCreateOrUpdateResponse contains the response from method GalleryScriptsClient.BeginCreateOrUpdate.

type GalleryScriptsClientDeleteResponse added in v7.3.0

type GalleryScriptsClientDeleteResponse struct {
}

GalleryScriptsClientDeleteResponse contains the response from method GalleryScriptsClient.BeginDelete.

type GalleryScriptsClientGetOptions added in v7.3.0

type GalleryScriptsClientGetOptions struct {
}

GalleryScriptsClientGetOptions contains the optional parameters for the GalleryScriptsClient.Get method.

type GalleryScriptsClientGetResponse added in v7.3.0

type GalleryScriptsClientGetResponse struct {
	// Specifies information about the gallery Script Definition that you want to create or update.
	GalleryScript
}

GalleryScriptsClientGetResponse contains the response from method GalleryScriptsClient.Get.

type GalleryScriptsClientListByGalleryOptions added in v7.3.0

type GalleryScriptsClientListByGalleryOptions struct {
}

GalleryScriptsClientListByGalleryOptions contains the optional parameters for the GalleryScriptsClient.NewListByGalleryPager method.

type GalleryScriptsClientListByGalleryResponse added in v7.3.0

type GalleryScriptsClientListByGalleryResponse struct {
	// The List Gallery Script operation response.
	GalleryScriptList
}

GalleryScriptsClientListByGalleryResponse contains the response from method GalleryScriptsClient.NewListByGalleryPager.

type GalleryScriptsClientUpdateResponse added in v7.3.0

type GalleryScriptsClientUpdateResponse struct {
	// Specifies information about the gallery Script Definition that you want to create or update.
	GalleryScript
}

GalleryScriptsClientUpdateResponse contains the response from method GalleryScriptsClient.BeginUpdate.

type GallerySharingPermissionTypes

type GallerySharingPermissionTypes string

GallerySharingPermissionTypes - This property allows you to specify the permission of sharing gallery. Possible values are: Private, Groups, Community.

const (
	GallerySharingPermissionTypesCommunity GallerySharingPermissionTypes = "Community"
	GallerySharingPermissionTypesGroups    GallerySharingPermissionTypes = "Groups"
	GallerySharingPermissionTypesPrivate   GallerySharingPermissionTypes = "Private"
)

func PossibleGallerySharingPermissionTypesValues

func PossibleGallerySharingPermissionTypesValues() []GallerySharingPermissionTypes

PossibleGallerySharingPermissionTypesValues returns the possible values for the GallerySharingPermissionTypes const type.

type GallerySharingProfileClient

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

GallerySharingProfileClient contains the methods for the GallerySharingProfile group. Don't use this type directly, use NewGallerySharingProfileClient() instead.

func NewGallerySharingProfileClient

func NewGallerySharingProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GallerySharingProfileClient, error)

NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GallerySharingProfileClient) BeginUpdate

BeginUpdate - Update sharing profile of a gallery. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-03-03

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • galleryName - The name of the Shared Image Gallery.
  • sharingUpdate - Parameters supplied to the update gallery sharing profile.
  • options - GallerySharingProfileClientBeginUpdateOptions contains the optional parameters for the GallerySharingProfileClient.BeginUpdate method.
Example (AddSharingIdToTheSharingProfileOfAGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
		Groups: []*armcompute.SharingProfileGroup{
			{
				Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
				IDs: []*string{
					to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
					to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
			},
			{
				Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
				IDs: []*string{
					to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
			}},
		OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.SharingUpdate = armcompute.SharingUpdate{
	// 	Groups: []*armcompute.SharingProfileGroup{
	// 		{
	// 			Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
	// 			IDs: []*string{
	// 				to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
	// 				to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
	// 			},
	// 			{
	// 				Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
	// 				IDs: []*string{
	// 					to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
	// 			}},
	// 			OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd),
	// 		}
}
Example (ResetSharingProfileOfAGallery)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
		OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.SharingUpdate = armcompute.SharingUpdate{
	// 	OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset),
	// }
}
Example (ShareAGalleryToCommunity)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
		OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.SharingUpdate = armcompute.SharingUpdate{
	// 	OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity),
	// }
}

type GallerySharingProfileClientBeginUpdateOptions

type GallerySharingProfileClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

GallerySharingProfileClientBeginUpdateOptions contains the optional parameters for the GallerySharingProfileClient.BeginUpdate method.

type GallerySharingProfileClientUpdateResponse

type GallerySharingProfileClientUpdateResponse struct {
	// Specifies information about the gallery sharing profile update.
	SharingUpdate
}

GallerySharingProfileClientUpdateResponse contains the response from method GallerySharingProfileClient.BeginUpdate.

type GallerySoftDeletedResource

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

	// Describes the properties of a soft-deleted resource.
	Properties *GallerySoftDeletedResourceProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

GallerySoftDeletedResource - The details information of soft-deleted resource.

func (GallerySoftDeletedResource) MarshalJSON

func (g GallerySoftDeletedResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GallerySoftDeletedResource.

func (*GallerySoftDeletedResource) UnmarshalJSON

func (g *GallerySoftDeletedResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GallerySoftDeletedResource.

type GallerySoftDeletedResourceList

type GallerySoftDeletedResourceList struct {
	// REQUIRED; The GallerySoftDeletedResource items on this page
	Value []*GallerySoftDeletedResource

	// The link to the next page of items
	NextLink *string
}

GallerySoftDeletedResourceList - The List Soft-deleted Resources operation response.

func (GallerySoftDeletedResourceList) MarshalJSON

func (g GallerySoftDeletedResourceList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GallerySoftDeletedResourceList.

func (*GallerySoftDeletedResourceList) UnmarshalJSON

func (g *GallerySoftDeletedResourceList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GallerySoftDeletedResourceList.

type GallerySoftDeletedResourceProperties

type GallerySoftDeletedResourceProperties struct {
	// arm id of the soft-deleted resource
	ResourceArmID *string

	// artifact type of the soft-deleted resource
	SoftDeletedArtifactType *SoftDeletedArtifactTypes

	// The timestamp for when the resource is soft-deleted. In dateTime offset format.
	SoftDeletedTime *string
}

GallerySoftDeletedResourceProperties - Describes the properties of a soft-deleted resource.

func (GallerySoftDeletedResourceProperties) MarshalJSON

func (g GallerySoftDeletedResourceProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GallerySoftDeletedResourceProperties.

func (*GallerySoftDeletedResourceProperties) UnmarshalJSON

func (g *GallerySoftDeletedResourceProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GallerySoftDeletedResourceProperties.

type GalleryTargetExtendedLocation

type GalleryTargetExtendedLocation struct {
	// Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact.
	Encryption *EncryptionImages

	// The name of the extended location.
	ExtendedLocation *GalleryExtendedLocation

	// The number of replicas of the Image Version to be created per extended location. This property is updatable.
	ExtendedLocationReplicaCount *int32

	// The name of the region.
	Name *string

	// Specifies the storage account type to be used to store the image. This property is not updatable.
	StorageAccountType *EdgeZoneStorageAccountType
}

func (GalleryTargetExtendedLocation) MarshalJSON

func (g GalleryTargetExtendedLocation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryTargetExtendedLocation.

func (*GalleryTargetExtendedLocation) UnmarshalJSON

func (g *GalleryTargetExtendedLocation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryTargetExtendedLocation.

type GalleryUpdate

type GalleryUpdate struct {
	// The identity of the gallery, if configured.
	Identity *GalleryIdentity

	// Describes the properties of a Shared Image Gallery.
	Properties *GalleryProperties

	// Resource tags
	Tags map[string]*string

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

GalleryUpdate - Specifies information about the Shared Image Gallery that you want to update.

func (GalleryUpdate) MarshalJSON

func (g GalleryUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GalleryUpdate.

func (*GalleryUpdate) UnmarshalJSON

func (g *GalleryUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GalleryUpdate.

type GrantAccessData

type GrantAccessData struct {
	// REQUIRED; The Access Level, accepted values include None, Read, Write.
	Access *AccessLevel

	// REQUIRED; Time duration in seconds until the SAS access expires.
	DurationInSeconds *int32

	// Used to specify the file format when making request for SAS on a VHDX file format snapshot
	FileFormat *FileFormat

	// Set this flag to true to get additional SAS for VM guest state
	GetSecureVMGuestStateSAS *bool
}

GrantAccessData - Data used for requesting a SAS.

func (GrantAccessData) MarshalJSON

func (g GrantAccessData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GrantAccessData.

func (*GrantAccessData) UnmarshalJSON

func (g *GrantAccessData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GrantAccessData.

type HardwareProfile

type HardwareProfile struct {
	// Specifies the size of the virtual machine. The enum data type is currently deprecated and will be removed by December 23rd
	// 2023. The recommended way to get the list of available sizes is using these
	// APIs: List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes],
	// List all available virtual machine sizes in a
	// region [https://docs.microsoft.com/rest/api/compute/resourceskus/list], List all available virtual machine sizes for resizing
	// [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. For more information about virtual machine
	// sizes, see Sizes for virtual machines
	// [https://docs.microsoft.com/azure/virtual-machines/sizes]. The available VM sizes depend on region and availability set.
	VMSize *VirtualMachineSizeTypes

	// Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. This feature
	// is still in preview mode and is not supported for VirtualMachineScaleSet. Please
	// follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details.
	VMSizeProperties *VMSizeProperties
}

HardwareProfile - Specifies the hardware settings for the virtual machine.

func (HardwareProfile) MarshalJSON

func (h HardwareProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type HardwareProfile.

func (*HardwareProfile) UnmarshalJSON

func (h *HardwareProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfile.

type HighSpeedInterconnectPlacement added in v7.1.0

type HighSpeedInterconnectPlacement string

HighSpeedInterconnectPlacement - Specifies the high speed interconnect placement for the virtual machine scale set.

const (
	// HighSpeedInterconnectPlacementNone - No high speed interconnect placement
	HighSpeedInterconnectPlacementNone HighSpeedInterconnectPlacement = "None"
	// HighSpeedInterconnectPlacementTrunk - Trunk high speed interconnect placement
	HighSpeedInterconnectPlacementTrunk HighSpeedInterconnectPlacement = "Trunk"
)

func PossibleHighSpeedInterconnectPlacementValues added in v7.1.0

func PossibleHighSpeedInterconnectPlacementValues() []HighSpeedInterconnectPlacement

PossibleHighSpeedInterconnectPlacementValues returns the possible values for the HighSpeedInterconnectPlacement const type.

type HostCaching

type HostCaching string

HostCaching - The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'

const (
	HostCachingNone      HostCaching = "None"
	HostCachingReadOnly  HostCaching = "ReadOnly"
	HostCachingReadWrite HostCaching = "ReadWrite"
)

func PossibleHostCachingValues

func PossibleHostCachingValues() []HostCaching

PossibleHostCachingValues returns the possible values for the HostCaching const type.

type HostEndpointSettings

type HostEndpointSettings struct {
	// Specifies the InVMAccessControlProfileVersion resource id in the format of
	// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}
	InVMAccessControlProfileReferenceID *string

	// Specifies the execution mode. In Audit mode, the system acts as if it is enforcing the access control policy, including
	// emitting access denial entries in the logs but it does not actually deny any
	// requests to host endpoints. In Enforce mode, the system will enforce the access control and it is the recommended mode
	// of operation.
	Mode *Modes
}

HostEndpointSettings - Specifies particular host endpoint settings.

func (HostEndpointSettings) MarshalJSON

func (h HostEndpointSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type HostEndpointSettings.

func (*HostEndpointSettings) UnmarshalJSON

func (h *HostEndpointSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type HostEndpointSettings.

type HyperVGeneration

type HyperVGeneration string

HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

const (
	HyperVGenerationV1 HyperVGeneration = "V1"
	HyperVGenerationV2 HyperVGeneration = "V2"
)

func PossibleHyperVGenerationValues

func PossibleHyperVGenerationValues() []HyperVGeneration

PossibleHyperVGenerationValues returns the possible values for the HyperVGeneration const type.

type HyperVGenerationType

type HyperVGenerationType string

HyperVGenerationType - Specifies the HyperVGeneration Type associated with a resource

const (
	HyperVGenerationTypeV1 HyperVGenerationType = "V1"
	HyperVGenerationTypeV2 HyperVGenerationType = "V2"
)

func PossibleHyperVGenerationTypeValues

func PossibleHyperVGenerationTypeValues() []HyperVGenerationType

PossibleHyperVGenerationTypeValues returns the possible values for the HyperVGenerationType const type.

type HyperVGenerationTypes

type HyperVGenerationTypes string

HyperVGenerationTypes - Specifies the HyperVGeneration Type

const (
	HyperVGenerationTypesV1 HyperVGenerationTypes = "V1"
	HyperVGenerationTypesV2 HyperVGenerationTypes = "V2"
)

func PossibleHyperVGenerationTypesValues

func PossibleHyperVGenerationTypesValues() []HyperVGenerationTypes

PossibleHyperVGenerationTypesValues returns the possible values for the HyperVGenerationTypes const type.

type IPVersion

type IPVersion string

IPVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.

const (
	IPVersionIPv4 IPVersion = "IPv4"
	IPVersionIPv6 IPVersion = "IPv6"
)

func PossibleIPVersionValues

func PossibleIPVersionValues() []IPVersion

PossibleIPVersionValues returns the possible values for the IPVersion const type.

type IPVersions

type IPVersions string

IPVersions - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.

const (
	IPVersionsIPv4 IPVersions = "IPv4"
	IPVersionsIPv6 IPVersions = "IPv6"
)

func PossibleIPVersionsValues

func PossibleIPVersionsValues() []IPVersions

PossibleIPVersionsValues returns the possible values for the IPVersions const type.

type Image

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

	// The extended location of the Image.
	ExtendedLocation *ExtendedLocation

	// Describes the properties of an Image.
	Properties *ImageProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /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
}

Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.

func (Image) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Image.

func (*Image) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Image.

type ImageDataDisk

type ImageDataDisk struct {
	// REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and
	// therefore must be unique for each data disk attached to a VM.
	Lun *int32

	// The Virtual Hard Disk.
	BlobURI *string

	// Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard
	// storage. ReadOnly for Premium storage.
	Caching *CachingTypes

	// Specifies the customer managed disk encryption set resource id for the managed image disk.
	DiskEncryptionSet *DiskEncryptionSetParameters

	// Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual
	// machine image. This value cannot be larger than 1023 GB.
	DiskSizeGB *int32

	// The managedDisk.
	ManagedDisk *SubResource

	// The snapshot.
	Snapshot *SubResource

	// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot
	// be used with OS Disk.
	StorageAccountType *StorageAccountTypes
}

ImageDataDisk - Describes a data disk.

func (ImageDataDisk) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageDataDisk.

func (*ImageDataDisk) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageDataDisk.

type ImageDeprecationStatus

type ImageDeprecationStatus struct {
	// Describes the alternative option specified by the Publisher for this image when this image is deprecated.
	AlternativeOption *AlternativeOption

	// Describes the state of the image.
	ImageState *ImageState

	// The time, in future, at which this image will be marked as deprecated. This scheduled time is chosen by the Publisher.
	ScheduledDeprecationTime *time.Time
}

ImageDeprecationStatus - Describes image deprecation status properties on the image.

func (ImageDeprecationStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageDeprecationStatus.

func (*ImageDeprecationStatus) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageDeprecationStatus.

type ImageDiskReference

type ImageDiskReference struct {
	// A relative uri containing a community Azure Compute Gallery image reference.
	CommunityGalleryImageID *string

	// A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference.
	ID *string

	// If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image
	// to use. For OS disks, this field is null.
	Lun *int32

	// A relative uri containing a direct shared Azure Compute Gallery image reference.
	SharedGalleryImageID *string
}

ImageDiskReference - The source image used for creating the disk.

func (ImageDiskReference) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageDiskReference.

func (*ImageDiskReference) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageDiskReference.

type ImageListResult

type ImageListResult struct {
	// REQUIRED; The list of Images
	Value []*Image

	// The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images.
	NextLink *string
}

ImageListResult - The List Image operation response.

func (ImageListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageListResult.

func (*ImageListResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageListResult.

type ImageOSDisk

type ImageOSDisk struct {
	// REQUIRED; The OS State. For managed images, use Generalized.
	OSState *OperatingSystemStateTypes

	// REQUIRED; This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom
	// image. Possible values are: Windows, Linux.
	OSType *OperatingSystemTypes

	// The Virtual Hard Disk.
	BlobURI *string

	// Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard
	// storage. ReadOnly for Premium storage.
	Caching *CachingTypes

	// Specifies the customer managed disk encryption set resource id for the managed image disk.
	DiskEncryptionSet *DiskEncryptionSetParameters

	// Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual
	// machine image. This value cannot be larger than 1023 GB.
	DiskSizeGB *int32

	// The managedDisk.
	ManagedDisk *SubResource

	// The snapshot.
	Snapshot *SubResource

	// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot
	// be used with OS Disk.
	StorageAccountType *StorageAccountTypes
}

ImageOSDisk - Describes an Operating System disk.

func (ImageOSDisk) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageOSDisk.

func (*ImageOSDisk) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageOSDisk.

type ImageProperties

type ImageProperties struct {
	// Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image
	// source is a blob, then we need the user to specify the value, if the source is
	// managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the
	// source managed resource.
	HyperVGeneration *HyperVGenerationTypes

	// The source virtual machine from which Image is created.
	SourceVirtualMachine *SubResource

	// Specifies the storage settings for the virtual machine disks.
	StorageProfile *ImageStorageProfile

	// READ-ONLY; The provisioning state.
	ProvisioningState *string
}

ImageProperties - Describes the properties of an Image.

func (ImageProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageProperties.

func (*ImageProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageProperties.

type ImagePurchasePlan

type ImagePurchasePlan struct {
	// The plan ID.
	Name *string

	// The product ID.
	Product *string

	// The publisher ID.
	Publisher *string
}

ImagePurchasePlan - Describes the gallery image definition purchase plan. This is used by marketplace images.

func (ImagePurchasePlan) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImagePurchasePlan.

func (*ImagePurchasePlan) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImagePurchasePlan.

type ImageReference

type ImageReference struct {
	// Specified the community gallery image unique id for vm deployment. This can be fetched from community gallery image GET
	// call.
	CommunityGalleryImageID *string

	// Resource Id
	ID *string

	// Specifies the offer of the platform image or marketplace image used to create the virtual machine.
	Offer *string

	// The image publisher.
	Publisher *string

	// The image SKU.
	SKU *string

	// Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call.
	SharedGalleryImageID *string

	// Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats
	// are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers.
	// Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image
	// will not automatically update after deploy time even if a new version becomes
	// available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for
	// deployment, to use 'latest' version of gallery image, just set
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}'
	// in the 'id' field without version input.
	Version *string

	// READ-ONLY; Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual
	// machine. This readonly field differs from 'version', only if the value specified in
	// 'version' field is 'latest'.
	ExactVersion *string
}

ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set.

func (ImageReference) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageReference.

func (*ImageReference) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference.

type ImageState

type ImageState string

ImageState - Describes the state of the image.

const (
	ImageStateActive                  ImageState = "Active"
	ImageStateDeprecated              ImageState = "Deprecated"
	ImageStateScheduledForDeprecation ImageState = "ScheduledForDeprecation"
)

func PossibleImageStateValues

func PossibleImageStateValues() []ImageState

PossibleImageStateValues returns the possible values for the ImageState const type.

type ImageStorageProfile

type ImageStorageProfile struct {
	// Specifies the parameters that are used to add a data disk to a virtual machine.
	// For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview].
	DataDisks []*ImageDataDisk

	// Specifies information about the operating system disk used by the virtual machine.
	// For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview].
	OSDisk *ImageOSDisk

	// Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions
	// that provide Zone Redundant Storage (ZRS).
	ZoneResilient *bool
}

ImageStorageProfile - Describes a storage profile.

func (ImageStorageProfile) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageStorageProfile.

func (*ImageStorageProfile) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageStorageProfile.

type ImageUpdate

type ImageUpdate struct {
	// Describes the properties of an Image.
	Properties *ImageProperties

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

ImageUpdate - The source user image virtual hard disk. Only tags may be updated.

func (ImageUpdate) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageUpdate.

func (*ImageUpdate) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdate.

type ImageVersionSecurityProfile

type ImageVersionSecurityProfile struct {
	// Contains UEFI settings for the image version.
	UefiSettings *GalleryImageVersionUefiSettings
}

ImageVersionSecurityProfile - The security profile of a gallery image version

func (ImageVersionSecurityProfile) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ImageVersionSecurityProfile.

func (*ImageVersionSecurityProfile) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionSecurityProfile.

type ImagesClient

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

ImagesClient contains the methods for the Images group. Don't use this type directly, use NewImagesClient() instead.

func NewImagesClient

func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImagesClient, error)

NewImagesClient creates a new instance of ImagesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*ImagesClient) BeginCreateOrUpdate

func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ImagesClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update an image. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • imageName - The name of the image.
  • parameters - Parameters supplied to the Create Image operation.
  • options - ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method.
Example (CreateAVirtualMachineImageFromABlob)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlob.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(true),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromABlobWithDiskEncryptionSetResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
					DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromAManagedDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDisk.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					ManagedDisk: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(true),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(true),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
					},
					Snapshot: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
	// 				},
	// 				Snapshot: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromASnapshot)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshot.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					Snapshot: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				Snapshot: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(false),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				OSDisk: &armcompute.ImageOSDisk{
					DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
						ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
					},
					ManagedDisk: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
	// 				},
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageFromAnExistingVirtualMachine)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAVM.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			SourceVirtualMachine: &armcompute.SubResource{
				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		SourceVirtualMachine: &armcompute.SubResource{
	// 			ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
	// 		},
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 			},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myVM_OsDisk_1_6dc293b7d811433196903acf92665022"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(false),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageThatIncludesADataDiskFromABlob)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				DataDisks: []*armcompute.ImageDataDisk{
					{
						BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
						Lun:     to.Ptr[int32](1),
					}},
				OSDisk: &armcompute.ImageOSDisk{
					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 				{
	// 					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(false),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				DataDisks: []*armcompute.ImageDataDisk{
					{
						ManagedDisk: &armcompute.SubResource{
							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
						},
						Lun: to.Ptr[int32](1),
					}},
				OSDisk: &armcompute.ImageOSDisk{
					ManagedDisk: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(false),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 				{
	// 					ManagedDisk: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(false),
	// 		},
	// 	},
	// }
}
Example (CreateAVirtualMachineImageThatIncludesADataDiskFromASnapshot)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
		Location: to.Ptr("West US"),
		Properties: &armcompute.ImageProperties{
			StorageProfile: &armcompute.ImageStorageProfile{
				DataDisks: []*armcompute.ImageDataDisk{
					{
						Snapshot: &armcompute.SubResource{
							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
						},
						Lun: to.Ptr[int32](1),
					}},
				OSDisk: &armcompute.ImageOSDisk{
					Snapshot: &armcompute.SubResource{
						ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
					},
					OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
					OSType:  to.Ptr(armcompute.OperatingSystemTypesLinux),
				},
				ZoneResilient: to.Ptr(true),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("westus"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 				{
	// 					Snapshot: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
	// 					},
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				Caching: to.Ptr(armcompute.CachingTypesReadWrite),
	// 				Snapshot: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
	// 				},
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
	// 			},
	// 			ZoneResilient: to.Ptr(true),
	// 		},
	// 	},
	// }
}

func (*ImagesClient) BeginDelete

func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*runtime.Poller[ImagesClientDeleteResponse], error)

BeginDelete - Deletes an Image. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • imageName - The name of the image.
  • options - ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method.
Example (ImageDeleteMaximumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Example (ImageDeleteMinimumSetGen)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}

func (*ImagesClient) BeginUpdate

func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*runtime.Poller[ImagesClientUpdateResponse], error)

BeginUpdate - Update an image. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • imageName - The name of the image.
  • parameters - Parameters supplied to the Update Image operation.
  • options - ImagesClientBeginUpdateOptions contains the optional parameters for the ImagesClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Update.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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImagesClient().BeginUpdate(ctx, "myResourceGroup", "myImage", armcompute.ImageUpdate{
		Tags: map[string]*string{
			"department": to.Ptr("HR"),
		},
		Properties: &armcompute.ImageProperties{
			HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1),
			SourceVirtualMachine: &armcompute.SubResource{
				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("West US"),
	// 	Tags: map[string]*string{
	// 		"department": to.Ptr("HR"),
	// 	},
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 				{
	// 					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
	// 					ManagedDisk: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
	// 					},
	// 					Snapshot: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
	// 					},
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 				DiskSizeGB: to.Ptr[int32](20),
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
	// 				},
	// 				Snapshot: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
	// 				},
	// 				StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 			},
	// 			ZoneResilient: to.Ptr(true),
	// 		},
	// 	},
	// }
}

func (*ImagesClient) Get

func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientGetOptions) (ImagesClientGetResponse, error)

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

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • imageName - The name of the image.
  • options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewImagesClient().Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: 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.Image = armcompute.Image{
	// 	Name: to.Ptr("myImage"),
	// 	Type: to.Ptr("Microsoft.Compute/images"),
	// 	ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"),
	// 	Location: to.Ptr("West US"),
	// 	Properties: &armcompute.ImageProperties{
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		StorageProfile: &armcompute.ImageStorageProfile{
	// 			DataDisks: []*armcompute.ImageDataDisk{
	// 				{
	// 					BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
	// 					ManagedDisk: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
	// 					},
	// 					Snapshot: &armcompute.SubResource{
	// 						ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
	// 					},
	// 					StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
	// 					Lun: to.Ptr[int32](1),
	// 			}},
	// 			OSDisk: &armcompute.ImageOSDisk{
	// 				BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
	// 				DiskSizeGB: to.Ptr[int32](20),
	// 				ManagedDisk: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
	// 				},
	// 				Snapshot: &armcompute.SubResource{
	// 					ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
	// 				},
	// 				StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
	// 				OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
	// 				OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 			},
	// 			ZoneResilient: to.Ptr(true),
	// 		},
	// 	},
	// }
}

func (*ImagesClient) NewListByResourceGroupPager

func (client *ImagesClient) NewListByResourceGroupPager(resourceGroupName string, options *ImagesClientListByResourceGroupOptions) *runtime.Pager[ImagesClientListByResourceGroupResponse]

NewListByResourceGroupPager - Gets the list of images under a resource group. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images.

Generated from API version 2025-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewImagesClient().NewListByResourceGroupPager("myResourceGroup", 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.ImageListResult = armcompute.ImageListResult{
		// 	Value: []*armcompute.Image{
		// 		{
		// 			Name: to.Ptr("myImage"),
		// 			Type: to.Ptr("Microsoft.Compute/images"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.ImageProperties{
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				StorageProfile: &armcompute.ImageStorageProfile{
		// 					DataDisks: []*armcompute.ImageDataDisk{
		// 						{
		// 							BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
		// 							ManagedDisk: &armcompute.SubResource{
		// 								ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
		// 							},
		// 							Snapshot: &armcompute.SubResource{
		// 								ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
		// 							},
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
		// 							Lun: to.Ptr[int32](1),
		// 					}},
		// 					OSDisk: &armcompute.ImageOSDisk{
		// 						BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
		// 						ManagedDisk: &armcompute.SubResource{
		// 							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
		// 						},
		// 						Snapshot: &armcompute.SubResource{
		// 							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
		// 						},
		// 						StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
		// 						OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
		// 						OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 					},
		// 				},
		// 			},
		// 	}},
		// }
	}
}

func (*ImagesClient) NewListPager

NewListPager - Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images.

Generated from API version 2025-04-01

  • options - ImagesClientListOptions contains the optional parameters for the ImagesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewImagesClient().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.ImageListResult = armcompute.ImageListResult{
		// 	Value: []*armcompute.Image{
		// 		{
		// 			Name: to.Ptr("myImage"),
		// 			Type: to.Ptr("Microsoft.Compute/images"),
		// 			ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"),
		// 			Location: to.Ptr("West US"),
		// 			Properties: &armcompute.ImageProperties{
		// 				ProvisioningState: to.Ptr("Succeeded"),
		// 				StorageProfile: &armcompute.ImageStorageProfile{
		// 					DataDisks: []*armcompute.ImageDataDisk{
		// 						{
		// 							BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
		// 							ManagedDisk: &armcompute.SubResource{
		// 								ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
		// 							},
		// 							Snapshot: &armcompute.SubResource{
		// 								ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
		// 							},
		// 							StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
		// 							Lun: to.Ptr[int32](1),
		// 					}},
		// 					OSDisk: &armcompute.ImageOSDisk{
		// 						BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
		// 						ManagedDisk: &armcompute.SubResource{
		// 							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"),
		// 						},
		// 						Snapshot: &armcompute.SubResource{
		// 							ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
		// 						},
		// 						StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
		// 						OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
		// 						OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 					},
		// 				},
		// 			},
		// 	}},
		// }
	}
}

type ImagesClientBeginCreateOrUpdateOptions

type ImagesClientBeginCreateOrUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method.

type ImagesClientBeginDeleteOptions

type ImagesClientBeginDeleteOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method.

type ImagesClientBeginUpdateOptions

type ImagesClientBeginUpdateOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

ImagesClientBeginUpdateOptions contains the optional parameters for the ImagesClient.BeginUpdate method.

type ImagesClientCreateOrUpdateResponse

type ImagesClientCreateOrUpdateResponse struct {
	// The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine.
	// If SourceImage is provided, the destination virtual hard drive must not exist.
	Image
}

ImagesClientCreateOrUpdateResponse contains the response from method ImagesClient.BeginCreateOrUpdate.

type ImagesClientDeleteResponse

type ImagesClientDeleteResponse struct {
}

ImagesClientDeleteResponse contains the response from method ImagesClient.BeginDelete.

type ImagesClientGetOptions

type ImagesClientGetOptions struct {
	// The expand expression to apply on the operation.
	Expand *string
}

ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method.

type ImagesClientGetResponse

type ImagesClientGetResponse struct {
	// The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine.
	// If SourceImage is provided, the destination virtual hard drive must not exist.
	Image
}

ImagesClientGetResponse contains the response from method ImagesClient.Get.

type ImagesClientListByResourceGroupOptions

type ImagesClientListByResourceGroupOptions struct {
}

ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.NewListByResourceGroupPager method.

type ImagesClientListByResourceGroupResponse

type ImagesClientListByResourceGroupResponse struct {
	// The List Image operation response.
	ImageListResult
}

ImagesClientListByResourceGroupResponse contains the response from method ImagesClient.NewListByResourceGroupPager.

type ImagesClientListOptions

type ImagesClientListOptions struct {
}

ImagesClientListOptions contains the optional parameters for the ImagesClient.NewListPager method.

type ImagesClientListResponse

type ImagesClientListResponse struct {
	// The List Image operation response.
	ImageListResult
}

ImagesClientListResponse contains the response from method ImagesClient.NewListPager.

type ImagesClientUpdateResponse

type ImagesClientUpdateResponse struct {
	// The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine.
	// If SourceImage is provided, the destination virtual hard drive must not exist.
	Image
}

ImagesClientUpdateResponse contains the response from method ImagesClient.BeginUpdate.

type InnerError

type InnerError struct {
	// The internal error message or exception dump.
	Errordetail *string

	// The exception type.
	Exceptiontype *string
}

InnerError - Inner error details.

func (InnerError) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type InnerError.

func (*InnerError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type InnerError.

type InstanceSKU

type InstanceSKU struct {
	// READ-ONLY; The sku name.
	Name *string

	// READ-ONLY; The tier of the cloud service role instance.
	Tier *string
}

InstanceSKU - The role instance SKU.

func (InstanceSKU) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type InstanceSKU.

func (*InstanceSKU) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type InstanceSKU.

type InstanceViewStatus

type InstanceViewStatus struct {
	// The status code.
	Code *string

	// The short localizable label for the status.
	DisplayStatus *string

	// The level code.
	Level *StatusLevelTypes

	// The detailed status message, including for alerts and error messages.
	Message *string

	// The time of the status.
	Time *time.Time
}

InstanceViewStatus - Instance view status.

func (InstanceViewStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus.

func (*InstanceViewStatus) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatus.

type InstanceViewStatusesSummary

type InstanceViewStatusesSummary struct {
	// READ-ONLY; The summary.
	StatusesSummary []*StatusCodeCount
}

InstanceViewStatusesSummary - Instance view statuses.

func (InstanceViewStatusesSummary) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type InstanceViewStatusesSummary.

func (*InstanceViewStatusesSummary) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatusesSummary.

type InstanceViewTypes

type InstanceViewTypes string
const (
	InstanceViewTypesInstanceView   InstanceViewTypes = "instanceView"
	InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView"
	InstanceViewTypesUserData       InstanceViewTypes = "userData"
)

func PossibleInstanceViewTypesValues

func PossibleInstanceViewTypesValues() []InstanceViewTypes

PossibleInstanceViewTypesValues returns the possible values for the InstanceViewTypes const type.

type IntervalInMins

type IntervalInMins string

IntervalInMins - Interval value in minutes used to create LogAnalytics call rate logs.

const (
	IntervalInMinsFiveMins   IntervalInMins = "FiveMins"
	IntervalInMinsSixtyMins  IntervalInMins = "SixtyMins"
	IntervalInMinsThirtyMins IntervalInMins = "ThirtyMins"
	IntervalInMinsThreeMins  IntervalInMins = "ThreeMins"
)

func PossibleIntervalInMinsValues

func PossibleIntervalInMinsValues() []IntervalInMins

PossibleIntervalInMinsValues returns the possible values for the IntervalInMins const type.

type KeyForDiskEncryptionSet

type KeyForDiskEncryptionSet struct {
	// REQUIRED; Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled
	// value.
	KeyURL *string

	// Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault
	// subscription is not the same as the Disk Encryption Set subscription.
	SourceVault *SourceVault
}

KeyForDiskEncryptionSet - Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots

func (KeyForDiskEncryptionSet) MarshalJSON

func (k KeyForDiskEncryptionSet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyForDiskEncryptionSet.

func (*KeyForDiskEncryptionSet) UnmarshalJSON

func (k *KeyForDiskEncryptionSet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyForDiskEncryptionSet.

type KeyVaultAndKeyReference

type KeyVaultAndKeyReference struct {
	// REQUIRED; Url pointing to a key or secret in KeyVault
	KeyURL *string

	// REQUIRED; Resource id of the KeyVault containing the key or secret
	SourceVault *SourceVault
}

KeyVaultAndKeyReference - Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey

func (KeyVaultAndKeyReference) MarshalJSON

func (k KeyVaultAndKeyReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyVaultAndKeyReference.

func (*KeyVaultAndKeyReference) UnmarshalJSON

func (k *KeyVaultAndKeyReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultAndKeyReference.

type KeyVaultAndSecretReference

type KeyVaultAndSecretReference struct {
	// REQUIRED; Url pointing to a key or secret in KeyVault
	SecretURL *string

	// REQUIRED; Resource id of the KeyVault containing the key or secret
	SourceVault *SourceVault
}

KeyVaultAndSecretReference - Key Vault Secret Url and vault id of the encryption key

func (KeyVaultAndSecretReference) MarshalJSON

func (k KeyVaultAndSecretReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyVaultAndSecretReference.

func (*KeyVaultAndSecretReference) UnmarshalJSON

func (k *KeyVaultAndSecretReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultAndSecretReference.

type KeyVaultKeyReference

type KeyVaultKeyReference struct {
	// REQUIRED; The URL referencing a key encryption key in Key Vault.
	KeyURL *string

	// REQUIRED; The relative URL of the Key Vault containing the key.
	SourceVault *SubResource
}

KeyVaultKeyReference - Describes a reference to Key Vault Key

func (KeyVaultKeyReference) MarshalJSON

func (k KeyVaultKeyReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyVaultKeyReference.

func (*KeyVaultKeyReference) UnmarshalJSON

func (k *KeyVaultKeyReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultKeyReference.

type KeyVaultSecretReference

type KeyVaultSecretReference struct {
	// REQUIRED; The URL referencing a secret in a Key Vault.
	SecretURL *string

	// REQUIRED; The relative URL of the Key Vault containing the secret.
	SourceVault *SubResource
}

KeyVaultSecretReference - Describes a reference to Key Vault Secret

func (KeyVaultSecretReference) MarshalJSON

func (k KeyVaultSecretReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyVaultSecretReference.

func (*KeyVaultSecretReference) UnmarshalJSON

func (k *KeyVaultSecretReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretReference.

type LastPatchInstallationSummary

type LastPatchInstallationSummary struct {
	// READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them.
	Error *APIError

	// READ-ONLY; The number of all available patches but excluded explicitly by a customer-specified exclusion list match.
	ExcludedPatchCount *int32

	// READ-ONLY; The count of patches that failed installation.
	FailedPatchCount *int32

	// READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension
	// logs.
	InstallationActivityID *string

	// READ-ONLY; The count of patches that successfully installed.
	InstalledPatchCount *int32

	// READ-ONLY; The UTC timestamp when the operation began.
	LastModifiedTime *time.Time

	// READ-ONLY; Describes whether the operation ran out of time before it completed all its intended actions
	MaintenanceWindowExceeded *bool

	// READ-ONLY; The number of all available patches but not going to be installed because it didn't match a classification or
	// inclusion list entry.
	NotSelectedPatchCount *int32

	// READ-ONLY; The number of all available patches expected to be installed over the course of the patch installation operation.
	PendingPatchCount *int32

	// READ-ONLY; The UTC timestamp when the operation began.
	StartTime *time.Time

	// READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes.
	// At that point it will become "Unknown", "Failed", "Succeeded", or
	// "CompletedWithWarnings."
	Status *PatchOperationStatus
}

LastPatchInstallationSummary - Describes the properties of the last installed patch summary.

func (LastPatchInstallationSummary) MarshalJSON

func (l LastPatchInstallationSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LastPatchInstallationSummary.

func (*LastPatchInstallationSummary) UnmarshalJSON

func (l *LastPatchInstallationSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LastPatchInstallationSummary.

type LinuxConfiguration

type LinuxConfiguration struct {
	// Specifies whether password authentication should be disabled.
	DisablePasswordAuthentication *bool

	// Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default value is false.
	EnableVMAgentPlatformUpdates *bool

	// [Preview Feature] Specifies settings related to VM Guest Patching on Linux.
	PatchSettings *LinuxPatchSettings

	// Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified
	// in the request body, default behavior is to set it to true. This will ensure
	// that VM Agent is installed on the VM so that extensions can be added to the VM later.
	ProvisionVMAgent *bool

	// Specifies the ssh key configuration for a Linux OS.
	SSH *SSHConfiguration
}

LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros].

func (LinuxConfiguration) MarshalJSON

func (l LinuxConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LinuxConfiguration.

func (*LinuxConfiguration) UnmarshalJSON

func (l *LinuxConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LinuxConfiguration.

type LinuxParameters

type LinuxParameters struct {
	// The update classifications to select when installing patches for Linux.
	ClassificationsToInclude []*VMGuestPatchClassificationLinux

	// This is used as a maintenance run identifier for Auto VM Guest Patching in Linux.
	MaintenanceRunID *string

	// packages to exclude in the patch operation. Format: packageName_packageVersion
	PackageNameMasksToExclude []*string

	// packages to include in the patch operation. Format: packageName_packageVersion
	PackageNameMasksToInclude []*string
}

LinuxParameters - Input for InstallPatches on a Linux VM, as directly received by the API

func (LinuxParameters) MarshalJSON

func (l LinuxParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LinuxParameters.

func (*LinuxParameters) UnmarshalJSON

func (l *LinuxParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LinuxParameters.

type LinuxPatchAssessmentMode

type LinuxPatchAssessmentMode string

LinuxPatchAssessmentMode - Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. Possible values are: ImageDefault - You control the timing of patch assessments on a virtual machine. AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true.

const (
	LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform"
	LinuxPatchAssessmentModeImageDefault        LinuxPatchAssessmentMode = "ImageDefault"
)

func PossibleLinuxPatchAssessmentModeValues

func PossibleLinuxPatchAssessmentModeValues() []LinuxPatchAssessmentMode

PossibleLinuxPatchAssessmentModeValues returns the possible values for the LinuxPatchAssessmentMode const type.

type LinuxPatchSettings

type LinuxPatchSettings struct {
	// Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.
	// Possible values are:
	// ImageDefault - You control the timing of patch assessments on a virtual machine.
	// AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true.
	AssessmentMode *LinuxPatchAssessmentMode

	// Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux.
	AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings

	// Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale
	// set with OrchestrationMode as Flexible.
	// Possible values are:
	// ImageDefault - The virtual machine's default patching configuration is used.
	// AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent
	// must be true
	PatchMode *LinuxVMGuestPatchMode
}

LinuxPatchSettings - Specifies settings related to VM Guest Patching on Linux.

func (LinuxPatchSettings) MarshalJSON

func (l LinuxPatchSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LinuxPatchSettings.

func (*LinuxPatchSettings) UnmarshalJSON

func (l *LinuxPatchSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LinuxPatchSettings.

type LinuxVMGuestPatchAutomaticByPlatformRebootSetting

type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string

LinuxVMGuestPatchAutomaticByPlatformRebootSetting - Specifies the reboot setting for all AutomaticByPlatform patch installation operations.

const (
	LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways     LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always"
	LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired"
	LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever      LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never"
	LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown    LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown"
)

func PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues

func PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues() []LinuxVMGuestPatchAutomaticByPlatformRebootSetting

PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues returns the possible values for the LinuxVMGuestPatchAutomaticByPlatformRebootSetting const type.

type LinuxVMGuestPatchAutomaticByPlatformSettings

type LinuxVMGuestPatchAutomaticByPlatformSettings struct {
	// Enables customer to schedule patching without accidental upgrades
	BypassPlatformSafetyChecksOnUserSchedule *bool

	// Specifies the reboot setting for all AutomaticByPlatform patch installation operations.
	RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting
}

LinuxVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Linux patch settings.

func (LinuxVMGuestPatchAutomaticByPlatformSettings) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings.

func (*LinuxVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON

func (l *LinuxVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings.

type LinuxVMGuestPatchMode

type LinuxVMGuestPatchMode string

LinuxVMGuestPatchMode - Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible. Possible values are: ImageDefault - The virtual machine's default patching configuration is used. AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent must be true

const (
	LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform"
	LinuxVMGuestPatchModeImageDefault        LinuxVMGuestPatchMode = "ImageDefault"
)

func PossibleLinuxVMGuestPatchModeValues

func PossibleLinuxVMGuestPatchModeValues() []LinuxVMGuestPatchMode

PossibleLinuxVMGuestPatchModeValues returns the possible values for the LinuxVMGuestPatchMode const type.

type ListUsagesResult

type ListUsagesResult struct {
	// REQUIRED; The list of compute resource usages.
	Value []*Usage

	// The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page
	// of compute resource usage information.
	NextLink *string
}

ListUsagesResult - The List Usages operation response.

func (ListUsagesResult) MarshalJSON

func (l ListUsagesResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ListUsagesResult.

func (*ListUsagesResult) UnmarshalJSON

func (l *ListUsagesResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ListUsagesResult.

type LoadBalancerConfiguration

type LoadBalancerConfiguration struct {
	// REQUIRED; The name of the Load balancer
	Name *string

	// REQUIRED; Properties of the load balancer configuration.
	Properties *LoadBalancerConfigurationProperties

	// Resource Id
	ID *string
}

LoadBalancerConfiguration - Describes the load balancer configuration.

func (LoadBalancerConfiguration) MarshalJSON

func (l LoadBalancerConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfiguration.

func (*LoadBalancerConfiguration) UnmarshalJSON

func (l *LoadBalancerConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerConfiguration.

type LoadBalancerConfigurationProperties

type LoadBalancerConfigurationProperties struct {
	// REQUIRED; Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each
	// load balancer configuration must have exactly one frontend IP configuration.
	FrontendIPConfigurations []*LoadBalancerFrontendIPConfiguration
}

LoadBalancerConfigurationProperties - Describes the properties of the load balancer configuration.

func (LoadBalancerConfigurationProperties) MarshalJSON

func (l LoadBalancerConfigurationProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfigurationProperties.

func (*LoadBalancerConfigurationProperties) UnmarshalJSON

func (l *LoadBalancerConfigurationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerConfigurationProperties.

type LoadBalancerFrontendIPConfiguration

type LoadBalancerFrontendIPConfiguration struct {
	// REQUIRED; The name of the resource that is unique within the set of frontend IP configurations used by the load balancer.
	// This name can be used to access the resource.
	Name *string

	// REQUIRED; Properties of load balancer frontend ip configuration.
	Properties *LoadBalancerFrontendIPConfigurationProperties
}

LoadBalancerFrontendIPConfiguration - Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration.

func (LoadBalancerFrontendIPConfiguration) MarshalJSON

func (l LoadBalancerFrontendIPConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LoadBalancerFrontendIPConfiguration.

func (*LoadBalancerFrontendIPConfiguration) UnmarshalJSON

func (l *LoadBalancerFrontendIPConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerFrontendIPConfiguration.

type LoadBalancerFrontendIPConfigurationProperties

type LoadBalancerFrontendIPConfigurationProperties struct {
	// The virtual network private IP address of the IP configuration.
	PrivateIPAddress *string

	// The reference to the public ip address resource.
	PublicIPAddress *SubResource

	// The reference to the virtual network subnet resource.
	Subnet *SubResource
}

LoadBalancerFrontendIPConfigurationProperties - Describes a cloud service IP Configuration

func (LoadBalancerFrontendIPConfigurationProperties) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type LoadBalancerFrontendIPConfigurationProperties.

func (*LoadBalancerFrontendIPConfigurationProperties) UnmarshalJSON

func (l *LoadBalancerFrontendIPConfigurationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerFrontendIPConfigurationProperties.

type LogAnalyticsClient

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

LogAnalyticsClient contains the methods for the LogAnalytics group. Don't use this type directly, use NewLogAnalyticsClient() instead.

func NewLogAnalyticsClient

func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogAnalyticsClient, error)

NewLogAnalyticsClient creates a new instance of LogAnalyticsClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*LogAnalyticsClient) BeginExportRequestRateByInterval

BeginExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to show throttling activities. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • location - The name of Azure region.
  • parameters - Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
  • options - LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewLogAnalyticsClient().BeginExportRequestRateByInterval(ctx, "westus", armcompute.RequestRateByIntervalInput{
		BlobContainerSasURI: to.Ptr("https://somesasuri"),
		FromTime:            to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862Z"); return t }()),
		GroupByResourceName: to.Ptr(true),
		ToTime:              to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862Z"); return t }()),
		IntervalLength:      to.Ptr(armcompute.IntervalInMinsFiveMins),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{
	// 	Properties: &armcompute.LogAnalyticsOutput{
	

func (*LogAnalyticsClient) BeginExportThrottledRequests

BeginExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-04-01

  • location - The name of Azure region.
  • parameters - The request body
  • options - LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ccea12be6cd5e64743499d46f7a9c8b60df52db1/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json

package main

import (
	"context"
	"log"

	"time"

	"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/compute/armcompute/v7"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewLogAnalyticsClient().BeginExportThrottledRequests(ctx, "westus", armcompute.ThrottledRequestsInput{
		BlobContainerSasURI:        to.Ptr("https://somesasuri"),
		FromTime:                   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862Z"); return t }()),
		GroupByClientApplicationID: to.Ptr(false),
		GroupByOperationName:       to.Ptr(true),
		GroupByResourceName:        to.Ptr(false),
		GroupByUserAgent:           to.Ptr(false),
		ToTime:                     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862Z"); return t }()),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %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.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{
	// 	Properties: &armcompute.LogAnalyticsOutput{
	

type LogAnalyticsClientBeginExportRequestRateByIntervalOptions

type LogAnalyticsClientBeginExportRequestRateByIntervalOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval method.

type LogAnalyticsClientBeginExportThrottledRequestsOptions

type LogAnalyticsClientBeginExportThrottledRequestsOptions struct {
	// Resumes the long-running operation from the provided token.
	ResumeToken string
}

LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests method.

type LogAnalyticsClientExportRequestRateByIntervalResponse

type LogAnalyticsClientExportRequestRateByIntervalResponse struct {
	// LogAnalytics operation status response
	LogAnalyticsOperationResult
}

LogAnalyticsClientExportRequestRateByIntervalResponse contains the response from method LogAnalyticsClient.BeginExportRequestRateByInterval.

type LogAnalyticsClientExportThrottledRequestsResponse

type LogAnalyticsClientExportThrottledRequestsResponse struct {
	// LogAnalytics operation status response
	LogAnalyticsOperationResult
}

LogAnalyticsClientExportThrottledRequestsResponse contains the response from method LogAnalyticsClient.BeginExportThrottledRequests.

type LogAnalyticsOperationResult

type LogAnalyticsOperationResult struct {
	// READ-ONLY; LogAnalyticsOutput
	Properties *LogAnalyticsOutput
}

LogAnalyticsOperationResult - LogAnalytics operation status response

func (LogAnalyticsOperationResult) MarshalJSON

func (l LogAnalyticsOperationResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAnalyticsOperationResult.

func (*LogAnalyticsOperationResult) UnmarshalJSON

func (l *LogAnalyticsOperationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsOperationResult.

type LogAnalyticsOutput

type LogAnalyticsOutput struct {
	// READ-ONLY; Output file Uri path to blob container.
	Output *string
}

LogAnalyticsOutput - LogAnalytics output properties

func (LogAnalyticsOutput) MarshalJSON

func (l LogAnalyticsOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAnalyticsOutput.

func (*LogAnalyticsOutput) UnmarshalJSON

func (l *LogAnalyticsOutput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsOutput.

type MaintenanceOperationResultCodeTypes

type MaintenanceOperationResultCodeTypes string

MaintenanceOperationResultCodeTypes - The Last Maintenance Operation Result Code.

const (
	MaintenanceOperationResultCodeTypesMaintenanceAborted   MaintenanceOperationResultCodeTypes = "MaintenanceAborted"
	MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted"
	MaintenanceOperationResultCodeTypesNone                 MaintenanceOperationResultCodeTypes = "None"
	MaintenanceOperationResultCodeTypesRetryLater           MaintenanceOperationResultCodeTypes = "RetryLater"
)

func PossibleMaintenanceOperationResultCodeTypesValues

func PossibleMaintenanceOperationResultCodeTypesValues() []MaintenanceOperationResultCodeTypes

PossibleMaintenanceOperationResultCodeTypesValues returns the possible values for the MaintenanceOperationResultCodeTypes const type.

type MaintenanceRedeployStatus

type MaintenanceRedeployStatus struct {
	// True, if customer is allowed to perform Maintenance.
	IsCustomerInitiatedMaintenanceAllowed *bool

	// Message returned for the last Maintenance Operation.
	LastOperationMessage *string

	// The Last Maintenance Operation Result Code.
	LastOperationResultCode *MaintenanceOperationResultCodeTypes

	// End Time for the Maintenance Window.
	MaintenanceWindowEndTime *time.Time

	// Start Time for the Maintenance Window.
	MaintenanceWindowStartTime *time.Time

	// End Time for the Pre Maintenance Window.
	PreMaintenanceWindowEndTime *time.Time

	// Start Time for the Pre Maintenance Window.
	PreMaintenanceWindowStartTime *time.Time
}

MaintenanceRedeployStatus - Maintenance Operation Status.

func (MaintenanceRedeployStatus) MarshalJSON

func (m MaintenanceRedeployStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MaintenanceRedeployStatus.

func (*MaintenanceRedeployStatus) UnmarshalJSON

func (m *MaintenanceRedeployStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceRedeployStatus.

type ManagedDiskParameters

type ManagedDiskParameters struct {
	// Specifies the customer managed disk encryption set resource id for the managed disk.
	DiskEncryptionSet *DiskEncryptionSetParameters

	// Resource Id
	ID *string

	// Specifies the security profile for the managed disk.
	SecurityProfile *VMDiskSecurityProfile

	// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot
	// be used with OS Disk.
	StorageAccountType *StorageAccountTypes
}

ManagedDiskParameters - The parameters of a managed disk.

func (ManagedDiskParameters) MarshalJSON

func (m ManagedDiskParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ManagedDiskParameters.

func (*ManagedDiskParameters) UnmarshalJSON

func (m *ManagedDiskParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDiskParameters.

type MaxInstancePercentPerZonePolicy added in v7.1.0

type MaxInstancePercentPerZonePolicy struct {
	// Specifies whether maxInstancePercentPerZonePolicy should be enabled on the virtual machine scale set.
	Enabled *bool

	// Limit on the number of instances in each zone as a percentage of the total capacity of the virtual machine scale set.
	Value *int32
}

MaxInstancePercentPerZonePolicy - The configuration parameters used to limit the number of virtual machines per availability zone in the virtual machine scale set.

func (MaxInstancePercentPerZonePolicy) MarshalJSON added in v7.1.0

func (m MaxInstancePercentPerZonePolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MaxInstancePercentPerZonePolicy.

func (*MaxInstancePercentPerZonePolicy) UnmarshalJSON added in v7.1.0

func (m *MaxInstancePercentPerZonePolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MaxInstancePercentPerZonePolicy.

type MigrateToVirtualMachineScaleSetInput

type MigrateToVirtualMachineScaleSetInput struct {
	// REQUIRED; Specifies information about the Virtual Machine Scale Set that the Availability Set should be migrated to. Minimum
	// api‐version: 2024‐11‐01.
	VirtualMachineScaleSetFlexible *SubResource
}

MigrateToVirtualMachineScaleSetInput - Describes the Virtual Machine Scale Set to migrate from Availability Set.

func (MigrateToVirtualMachineScaleSetInput) MarshalJSON

func (m MigrateToVirtualMachineScaleSetInput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MigrateToVirtualMachineScaleSetInput.

func (*MigrateToVirtualMachineScaleSetInput) UnmarshalJSON

func (m *MigrateToVirtualMachineScaleSetInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MigrateToVirtualMachineScaleSetInput.

type MigrateVMToVirtualMachineScaleSetInput

type MigrateVMToVirtualMachineScaleSetInput struct {
	// The target compute fault domain of VM migration to Flexible Virtual Machine Scale Set.
	TargetFaultDomain *int32

	// The target Virtual Machine size of VM migration to Flexible Virtual Machine Scale Set.
	TargetVMSize *string

	// The target zone of VM migration to Flexible Virtual Machine Scale Set.
	TargetZone *string
}

MigrateVMToVirtualMachineScaleSetInput - The input of virtual machine migration from Availability Set to Flexible Virtual Machine Scale Set.

func (MigrateVMToVirtualMachineScaleSetInput) MarshalJSON

func (m MigrateVMToVirtualMachineScaleSetInput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MigrateVMToVirtualMachineScaleSetInput.

func (*MigrateVMToVirtualMachineScaleSetInput) UnmarshalJSON

func (m *MigrateVMToVirtualMachineScaleSetInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MigrateVMToVirtualMachineScaleSetInput.

type Mode

type Mode string

Mode - Specifies the mode that ProxyAgent will execute on if the feature is enabled. ProxyAgent will start to audit or monitor but not enforce access control over requests to host endpoints in Audit mode, while in Enforce mode it will enforce access control. The default value is Enforce mode.

const (
	ModeAudit   Mode = "Audit"
	ModeEnforce Mode = "Enforce"
)

func PossibleModeValues

func PossibleModeValues() []Mode

PossibleModeValues returns the possible values for the Mode const type.

type Modes

type Modes string

Modes - Specifies the execution mode. In Audit mode, the system acts as if it is enforcing the access control policy, including emitting access denial entries in the logs but it does not actually deny any requests to host endpoints. In Enforce mode, the system will enforce the access control and it is the recommended mode of operation.

const (
	ModesAudit    Modes = "Audit"
	ModesDisabled Modes = "Disabled"
	ModesEnforce  Modes = "Enforce"
)

func PossibleModesValues

func PossibleModesValues() []Modes

PossibleModesValues returns the possible values for the Modes const type.

type NetworkAPIVersion

type NetworkAPIVersion string

NetworkAPIVersion - specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations

const (
	NetworkAPIVersionTwoThousandTwenty1101    NetworkAPIVersion = "2020-11-01"
	NetworkAPIVersionTwoThousandTwentyTwo1101 NetworkAPIVersion = "2022-11-01"
)

func PossibleNetworkAPIVersionValues

func PossibleNetworkAPIVersionValues() []NetworkAPIVersion

PossibleNetworkAPIVersionValues returns the possible values for the NetworkAPIVersion const type.

type NetworkAccessPolicy

type NetworkAccessPolicy string

NetworkAccessPolicy - Policy for accessing the disk via network.

const (
	// NetworkAccessPolicyAllowAll - The disk can be exported or uploaded to from any network.
	NetworkAccessPolicyAllowAll NetworkAccessPolicy = "AllowAll"
	// NetworkAccessPolicyAllowPrivate - The disk can be exported or uploaded to using a DiskAccess resource's private endpoints.
	NetworkAccessPolicyAllowPrivate NetworkAccessPolicy = "AllowPrivate"
	// NetworkAccessPolicyDenyAll - The disk cannot be exported.
	NetworkAccessPolicyDenyAll NetworkAccessPolicy = "DenyAll"
)

func PossibleNetworkAccessPolicyValues

func PossibleNetworkAccessPolicyValues() []NetworkAccessPolicy

PossibleNetworkAccessPolicyValues returns the possible values for the NetworkAccessPolicy const type.

type NetworkInterfaceAuxiliaryMode

type NetworkInterfaceAuxiliaryMode string

NetworkInterfaceAuxiliaryMode - Specifies whether the Auxiliary mode is enabled for the Network Interface resource.

const (
	NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections"
	NetworkInterfaceAuxiliaryModeFloating               NetworkInterfaceAuxiliaryMode = "Floating"
	NetworkInterfaceAuxiliaryModeNone                   NetworkInterfaceAuxiliaryMode = "None"
)

func PossibleNetworkInterfaceAuxiliaryModeValues

func PossibleNetworkInterfaceAuxiliaryModeValues() []NetworkInterfaceAuxiliaryMode

PossibleNetworkInterfaceAuxiliaryModeValues returns the possible values for the NetworkInterfaceAuxiliaryMode const type.

type NetworkInterfaceAuxiliarySKU

type NetworkInterfaceAuxiliarySKU string

NetworkInterfaceAuxiliarySKU - Specifies whether the Auxiliary sku is enabled for the Network Interface resource.

const (
	NetworkInterfaceAuxiliarySKUA1   NetworkInterfaceAuxiliarySKU = "A1"
	NetworkInterfaceAuxiliarySKUA2   NetworkInterfaceAuxiliarySKU = "A2"
	NetworkInterfaceAuxiliarySKUA4   NetworkInterfaceAuxiliarySKU = "A4"
	NetworkInterfaceAuxiliarySKUA8   NetworkInterfaceAuxiliarySKU = "A8"
	NetworkInterfaceAuxiliarySKUNone NetworkInterfaceAuxiliarySKU = "None"
)

func PossibleNetworkInterfaceAuxiliarySKUValues

func PossibleNetworkInterfaceAuxiliarySKUValues() []NetworkInterfaceAuxiliarySKU

PossibleNetworkInterfaceAuxiliarySKUValues returns the possible values for the NetworkInterfaceAuxiliarySKU const type.

type NetworkInterfaceReference

type NetworkInterfaceReference struct {
	// Resource Id
	ID *string

	// Describes a network interface reference properties.
	Properties *NetworkInterfaceReferenceProperties
}

NetworkInterfaceReference - Describes a network interface reference.

func (NetworkInterfaceReference) MarshalJSON

func (n NetworkInterfaceReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceReference.

func (*NetworkInterfaceReference) UnmarshalJSON

func (n *NetworkInterfaceReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceReference.

type NetworkInterfaceReferenceProperties

type NetworkInterfaceReferenceProperties struct {
	// Specify what happens to the network interface when the VM is deleted
	DeleteOption *DeleteOptions

	// Specifies the primary network interface in case the virtual machine has more than 1 network interface.
	Primary *bool
}

NetworkInterfaceReferenceProperties - Describes a network interface reference properties.

func (NetworkInterfaceReferenceProperties) MarshalJSON

func (n NetworkInterfaceReferenceProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceReferenceProperties.

func (*NetworkInterfaceReferenceProperties) UnmarshalJSON

func (n *NetworkInterfaceReferenceProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceReferenceProperties.

type NetworkProfile

type NetworkProfile struct {
	// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations
	NetworkAPIVersion *NetworkAPIVersion

	// Specifies the networking configurations that will be used to create the virtual machine networking resources.
	NetworkInterfaceConfigurations []*VirtualMachineNetworkInterfaceConfiguration

	// Specifies the list of resource Ids for the network interfaces associated with the virtual machine.
	NetworkInterfaces []*NetworkInterfaceReference
}

NetworkProfile - Specifies the network interfaces or the networking configuration of the virtual machine.

func (NetworkProfile) MarshalJSON

func (n NetworkProfile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type NetworkProfile.

func (*NetworkProfile) UnmarshalJSON

func (n *NetworkProfile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile.

type OSDisk

type OSDisk struct {
	// REQUIRED; Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when
	// you are using a specialized disk to create the virtual machine. FromImage: This value is
	// used when you are using an image to create the virtual machine. If you are using a platform image, you should also use
	// the imageReference element described above. If you are using a marketplace image,
	// you should also use the plan element previously described.
	CreateOption *DiskCreateOptionTypes

	// Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for
	// Standard storage. ReadOnly for Premium storage.
	Caching *CachingTypes

	// Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is
	// used, the OS disk is deleted when VM is deleted. Detach. If this value is used,
	// the os disk is retained after VM is deleted. The default value is set to Detach. For an ephemeral OS Disk, the default
	// value is set to Delete. The user cannot change the delete option for an ephemeral
	// OS Disk.
	DeleteOption *DiskDeleteOptionTypes

	// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.
	DiffDiskSettings *DiffDiskSettings

	// Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a
	// virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3
	// for the disk and the value cannot be larger than 1023.
	DiskSizeGB *int32

	// Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15.
	EncryptionSettings *DiskEncryptionSettings

	// The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine.
	// If SourceImage is provided, the destination virtual hard drive must not
	// exist.
	Image *VirtualHardDisk

	// The managed disk parameters.
	ManagedDisk *ManagedDiskParameters

	// The disk name.
	Name *string

	// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or
	// a specialized VHD. Possible values are: Windows, Linux.
	OSType *OperatingSystemTypes

	// The virtual hard disk.
	Vhd *VirtualHardDisk

	// Specifies whether writeAccelerator should be enabled or disabled on the disk.
	WriteAcceleratorEnabled *bool
}

OSDisk - Specifies information about the operating system disk used by the virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview].

func (OSDisk) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSDisk.

func (*OSDisk) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OSDisk.

type OSDiskImage

type OSDiskImage struct {
	// REQUIRED; The operating system of the osDiskImage.
	OperatingSystem *OperatingSystemTypes
}

OSDiskImage - Contains the os disk image information.

func (OSDiskImage) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSDiskImage.

func (*OSDiskImage) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImage.

type OSDiskImageEncryption

type OSDiskImageEncryption struct {
	// A relative URI containing the resource ID of the disk encryption set.
	DiskEncryptionSetID *string

	// This property specifies the security profile of an OS disk image.
	SecurityProfile *OSDiskImageSecurityProfile
}

OSDiskImageEncryption - Contains encryption settings for an OS disk image.

func (OSDiskImageEncryption) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSDiskImageEncryption.

func (*OSDiskImageEncryption) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImageEncryption.

type OSDiskImageSecurityProfile

type OSDiskImageSecurityProfile struct {
	// confidential VM encryption types
	ConfidentialVMEncryptionType *ConfidentialVMEncryptionType

	// secure VM disk encryption set id
	SecureVMDiskEncryptionSetID *string
}

OSDiskImageSecurityProfile - Contains security profile for an OS disk image.

func (OSDiskImageSecurityProfile) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSDiskImageSecurityProfile.

func (*OSDiskImageSecurityProfile) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImageSecurityProfile.

type OSFamily

type OSFamily struct {
	// OS family properties.
	Properties *OSFamilyProperties

	// READ-ONLY; Resource Id.
	ID *string

	// READ-ONLY; Resource location.
	Location *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

OSFamily - Describes a cloud service OS family.

func (OSFamily) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSFamily.

func (*OSFamily) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OSFamily.

type OSFamilyListResult

type OSFamilyListResult struct {
	// REQUIRED; The list of resources.
	Value []*OSFamily

	// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null
	// to fetch all the resources.
	NextLink *string
}

OSFamilyListResult - The list operation result.

func (OSFamilyListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OSFamilyListResult.