armsubscriptions

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 13 Imported by: 0

README

Azure Subscriptions Module for Go

The armsubscriptions module provides operations for working with Azure Subscriptions.

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 Subscriptions module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions/v2

Authorization

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

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.

See creating a fake for a complete example.

Provide Feedback

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

type ActionType string

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

const (
	// ActionTypeInternal - Actions are for internal-only APIs.
	ActionTypeInternal ActionType = "Internal"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type AvailabilityZoneMappings

type AvailabilityZoneMappings struct {
	// READ-ONLY; The logical zone id for the availability zone
	LogicalZone *string

	// READ-ONLY; The fully qualified physical zone id of availability zone to which logical zone id is mapped to
	PhysicalZone *string
}

AvailabilityZoneMappings - Availability zone mappings for the region

func (AvailabilityZoneMappings) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AvailabilityZoneMappings.

func (*AvailabilityZoneMappings) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityZoneMappings.

type AvailabilityZonePeers

type AvailabilityZonePeers struct {
	// Details of shared availability zone.
	Peers []*Peers

	// READ-ONLY; The availabilityZone.
	AvailabilityZone *string
}

AvailabilityZonePeers - List of availability zones shared by the subscriptions.

func (AvailabilityZonePeers) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AvailabilityZonePeers.

func (*AvailabilityZonePeers) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityZonePeers.

type CheckResourceNameResult

type CheckResourceNameResult struct {
	// Name of Resource
	Name *string

	// Is the resource name Allowed or Reserved
	Status *ResourceNameStatus

	// Type of Resource
	Type *string
}

CheckResourceNameResult - Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word

func (CheckResourceNameResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CheckResourceNameResult.

func (*CheckResourceNameResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckResourceNameResult.

type CheckZonePeersRequest

type CheckZonePeersRequest struct {
	// The Microsoft location.
	Location *string

	// The peer Microsoft Azure subscription ID.
	SubscriptionIDs []*string
}

CheckZonePeersRequest - Check zone peers request parameters.

func (CheckZonePeersRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CheckZonePeersRequest.

func (*CheckZonePeersRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckZonePeersRequest.

type CheckZonePeersResult

type CheckZonePeersResult struct {
	// The Availability Zones shared by the subscriptions.
	AvailabilityZonePeers []*AvailabilityZonePeers

	// the location of the subscription.
	Location *string

	// READ-ONLY; The subscription ID.
	SubscriptionID *string
}

CheckZonePeersResult - Result of the Check zone peers operation.

func (CheckZonePeersResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CheckZonePeersResult.

func (*CheckZonePeersResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckZonePeersResult.

type Client

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

Client contains the methods for the service. Don't use this type directly, use NewClient() instead.

Generated from API version 2022-12-01

func NewClient

func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)

NewClient creates a new instance of Client with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*Client) CheckZonePeers

func (client *Client) CheckZonePeers(ctx context.Context, subscriptionID string, parameters CheckZonePeersRequest, options *ClientCheckZonePeersOptions) (ClientCheckZonePeersResponse, error)

CheckZonePeers - Compares a subscriptions logical zone mapping If the operation fails it returns an *azcore.ResponseError type.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • parameters - The request body
  • options - ClientCheckZonePeersOptions contains the optional parameters for the Client.CheckZonePeers method.
Example

Generated from example definition: 2022-12-01/PostCheckZonePeers.json

package main

import (
	"context"
	"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/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CheckZonePeers(ctx, "8d65815f-a5b6-402f-9298-045155da7d74", armsubscriptions.CheckZonePeersRequest{
		Location: to.Ptr("eastus"),
		SubscriptionIDs: []*string{
			to.Ptr("subscriptions/11111111-1111-1111-1111-111111111111"),
		},
	}, 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 = armsubscriptions.ClientCheckZonePeersResponse{
	// 	CheckZonePeersResult: armsubscriptions.CheckZonePeersResult{
	// 		AvailabilityZonePeers: []*armsubscriptions.AvailabilityZonePeers{
	// 			{
	// 				AvailabilityZone: to.Ptr("1"),
	// 				Peers: []*armsubscriptions.Peers{
	// 					{
	// 						AvailabilityZone: to.Ptr("3"),
	// 						SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				AvailabilityZone: to.Ptr("2"),
	// 				Peers: []*armsubscriptions.Peers{
	// 					{
	// 						AvailabilityZone: to.Ptr("2"),
	// 						SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"),
	// 					},
	// 				},
	// 			},
	// 			{
	// 				AvailabilityZone: to.Ptr("3"),
	// 				Peers: []*armsubscriptions.Peers{
	// 					{
	// 						AvailabilityZone: to.Ptr("1"),
	// 						SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"),
	// 					},
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("eastus2"),
	// 		SubscriptionID: to.Ptr("8d65815f-a5b6-402f-9298-045155da7d74"),
	// 	},
	// }
}

func (*Client) Get

func (client *Client) Get(ctx context.Context, subscriptionID string, options *ClientGetOptions) (ClientGetResponse, error)

Get - Gets details about a specified subscription. If the operation fails it returns an *azcore.ResponseError type.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • options - ClientGetOptions contains the optional parameters for the Client.Get method.
Example

Generated from example definition: 2022-12-01/GetSubscription.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Get(ctx, "291bba3f-e0a5-47bc-a099-3bdcb2a50a05", 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 = armsubscriptions.ClientGetResponse{
	// 	Subscription: armsubscriptions.Subscription{
	// 		AuthorizationSource: to.Ptr("Bypassed"),
	// 		DisplayName: to.Ptr("Example Subscription"),
	// 		ID: to.Ptr("/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
	// 		ManagedByTenants: []*armsubscriptions.ManagedByTenant{
	// 			{
	// 				TenantID: to.Ptr("8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7"),
	// 			},
	// 		},
	// 		State: to.Ptr(armsubscriptions.SubscriptionStateEnabled),
	// 		SubscriptionID: to.Ptr("291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
	// 		SubscriptionPolicies: &armsubscriptions.SubscriptionPolicies{
	// 			LocationPlacementID: to.Ptr("Internal_2014-09-01"),
	// 			QuotaID: to.Ptr("Internal_2014-09-01"),
	// 			SpendingLimit: to.Ptr(armsubscriptions.SpendingLimitOff),
	// 		},
	// 		Tags: map[string]*string{
	// 			"tagKey1": to.Ptr("tagValue1"),
	// 			"tagKey2": to.Ptr("tagValue2"),
	// 		},
	// 		TenantID: to.Ptr("31c75423-32d6-4322-88b7-c478bdde4858"),
	// 	},
	// }
}

func (*Client) NewListLocationsPager

func (client *Client) NewListLocationsPager(subscriptionID string, options *ClientListLocationsOptions) *runtime.Pager[ClientListLocationsResponse]

NewListLocationsPager - Gets all available geo-locations.

This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • options - ClientListLocationsOptions contains the optional parameters for the Client.NewListLocationsPager method.
Example (GetLocationsWithASubscriptionId)

Generated from example definition: 2022-12-01/GetLocations.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListLocationsPager("a1ffc958-d2c7-493e-9f1e-125a0477f536", 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 = armsubscriptions.ClientListLocationsResponse{
		// 	LocationListResult: armsubscriptions.LocationListResult{
		// 		Value: []*armsubscriptions.Location{
		// 			{
		// 				Name: to.Ptr("eastus"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeRegion),
		// 				AvailabilityZoneMappings: []*armsubscriptions.AvailabilityZoneMappings{
		// 					{
		// 						LogicalZone: to.Ptr("1"),
		// 						PhysicalZone: to.Ptr("eastus-az1"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("2"),
		// 						PhysicalZone: to.Ptr("eastus-az3"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("3"),
		// 						PhysicalZone: to.Ptr("eastus-az2"),
		// 					},
		// 				},
		// 				DisplayName: to.Ptr("East US"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/eastus"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("37.3719"),
		// 					Longitude: to.Ptr("-79.8164"),
		// 					PairedRegion: []*armsubscriptions.PairedRegion{
		// 						{
		// 							Name: to.Ptr("westus"),
		// 							ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/westus"),
		// 						},
		// 					},
		// 					PhysicalLocation: to.Ptr("Virginia"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryRecommended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) East US"),
		// 			},
		// 			{
		// 				Name: to.Ptr("eastus2"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeRegion),
		// 				AvailabilityZoneMappings: []*armsubscriptions.AvailabilityZoneMappings{
		// 					{
		// 						LogicalZone: to.Ptr("1"),
		// 						PhysicalZone: to.Ptr("eastus2-az1"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("2"),
		// 						PhysicalZone: to.Ptr("eastus2-az3"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("3"),
		// 						PhysicalZone: to.Ptr("eastus2-az2"),
		// 					},
		// 				},
		// 				DisplayName: to.Ptr("East US 2"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/eastus2"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("36.6681"),
		// 					Longitude: to.Ptr("-78.3889"),
		// 					PairedRegion: []*armsubscriptions.PairedRegion{
		// 						{
		// 							Name: to.Ptr("centralus"),
		// 							ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/centralus"),
		// 						},
		// 					},
		// 					PhysicalLocation: to.Ptr("Virginia"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryRecommended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) East US 2"),
		// 			},
		// 		},
		// 	},
		// }
	}
}
Example (GetLocationsWithExtendedLocations)

Generated from example definition: 2022-12-01/GetLocationsWithExtendedLocations.json

package main

import (
	"context"
	"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/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListLocationsPager("a1ffc958-d2c7-493e-9f1e-125a0477f536", &armsubscriptions.ClientListLocationsOptions{
		IncludeExtendedLocations: to.Ptr(true)})
	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 = armsubscriptions.ClientListLocationsResponse{
		// 	LocationListResult: armsubscriptions.LocationListResult{
		// 		Value: []*armsubscriptions.Location{
		// 			{
		// 				Name: to.Ptr("eastus"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeRegion),
		// 				AvailabilityZoneMappings: []*armsubscriptions.AvailabilityZoneMappings{
		// 					{
		// 						LogicalZone: to.Ptr("1"),
		// 						PhysicalZone: to.Ptr("eastus-az1"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("2"),
		// 						PhysicalZone: to.Ptr("eastus-az3"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("3"),
		// 						PhysicalZone: to.Ptr("eastus-az2"),
		// 					},
		// 				},
		// 				DisplayName: to.Ptr("East US"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/eastus"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("37.3719"),
		// 					Longitude: to.Ptr("-79.8164"),
		// 					PairedRegion: []*armsubscriptions.PairedRegion{
		// 						{
		// 							Name: to.Ptr("westus"),
		// 							ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/westus"),
		// 						},
		// 					},
		// 					PhysicalLocation: to.Ptr("Virginia"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryRecommended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) East US"),
		// 			},
		// 			{
		// 				Name: to.Ptr("eastus2"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeRegion),
		// 				AvailabilityZoneMappings: []*armsubscriptions.AvailabilityZoneMappings{
		// 					{
		// 						LogicalZone: to.Ptr("1"),
		// 						PhysicalZone: to.Ptr("eastus2-az1"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("2"),
		// 						PhysicalZone: to.Ptr("eastus2-az3"),
		// 					},
		// 					{
		// 						LogicalZone: to.Ptr("3"),
		// 						PhysicalZone: to.Ptr("eastus2-az2"),
		// 					},
		// 				},
		// 				DisplayName: to.Ptr("East US 2"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/eastus2"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("36.6681"),
		// 					Longitude: to.Ptr("-78.3889"),
		// 					PairedRegion: []*armsubscriptions.PairedRegion{
		// 						{
		// 							Name: to.Ptr("centralus"),
		// 							ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/centralus"),
		// 						},
		// 					},
		// 					PhysicalLocation: to.Ptr("Virginia"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryRecommended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) East US 2"),
		// 			},
		// 			{
		// 				Name: to.Ptr("ezecustomerlabboston1"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeEdgeZone),
		// 				DisplayName: to.Ptr("EZE Customer Lab Boston 1"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/eastus/edgeZones/ezecustomerlabboston1"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("42.301218"),
		// 					Longitude: to.Ptr("-71.219038"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryExtended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) EZE Customer Lab Boston 1"),
		// 			},
		// 			{
		// 				Name: to.Ptr("ezecustomerlabhouston1"),
		// 				Type: to.Ptr(armsubscriptions.LocationTypeEdgeZone),
		// 				DisplayName: to.Ptr("EZE Customer Lab Houston 1"),
		// 				ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/locations/southcentralus/edgeZones/ezecustomerlabhouston1"),
		// 				Metadata: &armsubscriptions.LocationMetadata{
		// 					Geography: to.Ptr("United States"),
		// 					GeographyGroup: to.Ptr("US"),
		// 					Latitude: to.Ptr("29.9411"),
		// 					Longitude: to.Ptr("-95.41452"),
		// 					RegionCategory: to.Ptr(armsubscriptions.RegionCategoryExtended),
		// 					RegionType: to.Ptr(armsubscriptions.RegionTypePhysical),
		// 				},
		// 				RegionalDisplayName: to.Ptr("(US) EZE Customer Lab Houston 1"),
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) NewListPager

func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse]

NewListPager - Gets all subscriptions for a tenant.

  • options - ClientListOptions contains the optional parameters for the Client.NewListPager method.
Example

Generated from example definition: 2022-12-01/GetSubscriptions.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().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 = armsubscriptions.ClientListResponse{
		// 	SubscriptionListResult: armsubscriptions.SubscriptionListResult{
		// 		NextLink: to.Ptr("http://nextlink"),
		// 		Value: []*armsubscriptions.Subscription{
		// 			{
		// 				AuthorizationSource: to.Ptr("RoleBased"),
		// 				DisplayName: to.Ptr("Example Subscription"),
		// 				ID: to.Ptr("/subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
		// 				ManagedByTenants: []*armsubscriptions.ManagedByTenant{
		// 					{
		// 						TenantID: to.Ptr("8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7"),
		// 					},
		// 				},
		// 				State: to.Ptr(armsubscriptions.SubscriptionStateEnabled),
		// 				SubscriptionID: to.Ptr("291bba3f-e0a5-47bc-a099-3bdcb2a50a05"),
		// 				SubscriptionPolicies: &armsubscriptions.SubscriptionPolicies{
		// 					LocationPlacementID: to.Ptr("Internal_2014-09-01"),
		// 					QuotaID: to.Ptr("Internal_2014-09-01"),
		// 					SpendingLimit: to.Ptr(armsubscriptions.SpendingLimitOff),
		// 				},
		// 				Tags: map[string]*string{
		// 					"tagKey1": to.Ptr("tagValue1"),
		// 					"tagKey2": to.Ptr("tagValue2"),
		// 				},
		// 				TenantID: to.Ptr("31c75423-32d6-4322-88b7-c478bdde4858"),
		// 			},
		// 			{
		// 				AuthorizationSource: to.Ptr("RoleBased"),
		// 				DisplayName: to.Ptr("Example Subscription2"),
		// 				ID: to.Ptr("/subscriptions/72ac930a-f34e-42d8-b06d-dc2a9e12ed71"),
		// 				ManagedByTenants: []*armsubscriptions.ManagedByTenant{
		// 					{
		// 						TenantID: to.Ptr("8f70baf1-1f6e-46a2-a1ff-238dac1ebfb7"),
		// 					},
		// 					{
		// 						TenantID: to.Ptr("f7fb6af2-321d-47c8-9c0f-b0239eaad39a"),
		// 					},
		// 				},
		// 				State: to.Ptr(armsubscriptions.SubscriptionStateEnabled),
		// 				SubscriptionID: to.Ptr("72ac930a-f34e-42d8-b06d-dc2a9e12ed71"),
		// 				SubscriptionPolicies: &armsubscriptions.SubscriptionPolicies{
		// 					LocationPlacementID: to.Ptr("Internal_2014-09-01"),
		// 					QuotaID: to.Ptr("Internal_2014-09-01"),
		// 					SpendingLimit: to.Ptr(armsubscriptions.SpendingLimitOff),
		// 				},
		// 				Tags: map[string]*string{
		// 					"tagKey1": to.Ptr("tagValue1"),
		// 					"tagKey2": to.Ptr("tagValue2"),
		// 				},
		// 				TenantID: to.Ptr("2a0ff0de-96b2-4859-bb7c-a430d07a3e0c"),
		// 			},
		// 		},
		// 	},
		// }
	}
}

type ClientCheckZonePeersOptions

type ClientCheckZonePeersOptions struct {
}

ClientCheckZonePeersOptions contains the optional parameters for the Client.CheckZonePeers method.

type ClientCheckZonePeersResponse

type ClientCheckZonePeersResponse struct {
	// Result of the Check zone peers operation.
	CheckZonePeersResult
}

ClientCheckZonePeersResponse contains the response from method Client.CheckZonePeers.

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(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.

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

func (*ClientFactory) NewClient

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

func (*ClientFactory) NewOperationsClient

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewSubscriptionClient

func (c *ClientFactory) NewSubscriptionClient() *SubscriptionClient

NewSubscriptionClient creates a new instance of SubscriptionClient.

func (*ClientFactory) NewTenantsClient

func (c *ClientFactory) NewTenantsClient() *TenantsClient

NewTenantsClient creates a new instance of TenantsClient.

type ClientGetOptions

type ClientGetOptions struct {
}

ClientGetOptions contains the optional parameters for the Client.Get method.

type ClientGetResponse

type ClientGetResponse struct {
	// Subscription information.
	Subscription
}

ClientGetResponse contains the response from method Client.Get.

type ClientListLocationsOptions

type ClientListLocationsOptions struct {
	// Whether to include extended locations.
	IncludeExtendedLocations *bool
}

ClientListLocationsOptions contains the optional parameters for the Client.NewListLocationsPager method.

type ClientListLocationsResponse

type ClientListLocationsResponse struct {
	// Location list operation response.
	LocationListResult
}

ClientListLocationsResponse contains the response from method Client.NewListLocationsPager.

type ClientListOptions

type ClientListOptions struct {
}

ClientListOptions contains the optional parameters for the Client.NewListPager method.

type ClientListResponse

type ClientListResponse struct {
	// Subscription list operation response.
	SubscriptionListResult
}

ClientListResponse contains the response from method Client.NewListPager.

type Location

type Location struct {
	// The availability zone mappings for this region.
	AvailabilityZoneMappings []*AvailabilityZoneMappings

	// Metadata of the location, such as lat/long, paired region, and others.
	Metadata *LocationMetadata

	// READ-ONLY; The display name of the location.
	DisplayName *string

	// READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/8d65815f-a5b6-402f-9298-045155da7d74/locations/westus.
	ID *string

	// READ-ONLY; The location name.
	Name *string

	// READ-ONLY; The display name of the location and its region.
	RegionalDisplayName *string

	// READ-ONLY; The subscription ID.
	SubscriptionID *string

	// READ-ONLY; The location type.
	Type *LocationType
}

Location information.

func (Location) MarshalJSON

func (l Location) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Location.

func (*Location) UnmarshalJSON

func (l *Location) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Location.

type LocationListResult

type LocationListResult struct {
	// The URL to get the next set of results.
	NextLink *string

	// An array of locations.
	Value []*Location
}

LocationListResult - Location list operation response.

func (LocationListResult) MarshalJSON

func (l LocationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LocationListResult.

func (*LocationListResult) UnmarshalJSON

func (l *LocationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LocationListResult.

type LocationMetadata

type LocationMetadata struct {
	// The regions paired to this region.
	PairedRegion []*PairedRegion

	// READ-ONLY; The geography of the location.
	Geography *string

	// READ-ONLY; The geography group of the location.
	GeographyGroup *string

	// READ-ONLY; The home location of an edge zone.
	HomeLocation *string

	// READ-ONLY; The latitude of the location.
	Latitude *string

	// READ-ONLY; The longitude of the location.
	Longitude *string

	// READ-ONLY; The physical location of the Azure location.
	PhysicalLocation *string

	// READ-ONLY; The category of the region.
	RegionCategory *RegionCategory

	// READ-ONLY; The type of the region.
	RegionType *RegionType
}

LocationMetadata - Location metadata information

func (LocationMetadata) MarshalJSON

func (l LocationMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LocationMetadata.

func (*LocationMetadata) UnmarshalJSON

func (l *LocationMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LocationMetadata.

type LocationType

type LocationType string

LocationType - The location type.

const (
	// LocationTypeEdgeZone - EdgeZone
	LocationTypeEdgeZone LocationType = "EdgeZone"
	// LocationTypeRegion - Region
	LocationTypeRegion LocationType = "Region"
)

func PossibleLocationTypeValues

func PossibleLocationTypeValues() []LocationType

PossibleLocationTypeValues returns the possible values for the LocationType const type.

type ManagedByTenant

type ManagedByTenant struct {
	// READ-ONLY; The tenant ID of the managing tenant. This is a GUID.
	TenantID *string
}

ManagedByTenant - Information about a tenant managing the subscription.

func (ManagedByTenant) MarshalJSON

func (m ManagedByTenant) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ManagedByTenant.

func (*ManagedByTenant) UnmarshalJSON

func (m *ManagedByTenant) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ManagedByTenant.

type Operation

type Operation struct {
	// Localized display information for this particular operation.
	Display *OperationDisplay

	// READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
	ActionType *ActionType

	// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure
	// Resource Manager/control-plane operations.
	IsDataAction *bool

	// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write",
	// "Microsoft.Compute/virtualMachines/capture/action"
	Name *string

	// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
	// value is "user,system"
	Origin *Origin
}

Operation - REST API Operation

Details of a REST API operation, returned from the Resource Provider Operations API

func (Operation) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
	Description *string

	// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual
	// Machine", "Restart Virtual Machine".
	Operation *string

	// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
	// Compute".
	Provider *string

	// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
	// Schedule Collections".
	Resource *string
}

OperationDisplay - Localized display information for an operation.

func (OperationDisplay) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// REQUIRED; The Operation items on this page
	Value []*Operation

	// The link to the next page of items
	NextLink *string
}

OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.

func (OperationListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationsClient

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

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

Generated from API version 2022-12-01

func NewOperationsClient

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

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

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*OperationsClient) NewListPager

NewListPager - List the operations for the provider

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

type OperationsClientListOptions

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse

type OperationsClientListResponse struct {
	// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type Origin

type Origin string

Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"

const (
	// OriginSystem - Indicates the operation is initiated by a system.
	OriginSystem Origin = "system"
	// OriginUser - Indicates the operation is initiated by a user.
	OriginUser Origin = "user"
	// OriginUserSystem - Indicates the operation is initiated by a user or system.
	OriginUserSystem Origin = "user,system"
)

func PossibleOriginValues

func PossibleOriginValues() []Origin

PossibleOriginValues returns the possible values for the Origin const type.

type PairedRegion

type PairedRegion struct {
	// READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/8d65815f-a5b6-402f-9298-045155da7d74/locations/westus.
	ID *string

	// READ-ONLY; The name of the paired region.
	Name *string

	// READ-ONLY; The subscription ID.
	SubscriptionID *string
}

PairedRegion - Information regarding paired region.

func (PairedRegion) MarshalJSON

func (p PairedRegion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PairedRegion.

func (*PairedRegion) UnmarshalJSON

func (p *PairedRegion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PairedRegion.

type Peers

type Peers struct {
	// READ-ONLY; The availabilityZone.
	AvailabilityZone *string

	// READ-ONLY; The subscription ID.
	SubscriptionID *string
}

Peers - Information about shared availability zone.

func (Peers) MarshalJSON

func (p Peers) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Peers.

func (*Peers) UnmarshalJSON

func (p *Peers) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Peers.

type RegionCategory

type RegionCategory string

RegionCategory - The category of the region.

const (
	// RegionCategoryExtended - Extended
	RegionCategoryExtended RegionCategory = "Extended"
	// RegionCategoryOther - Other
	RegionCategoryOther RegionCategory = "Other"
	// RegionCategoryRecommended - Recommended
	RegionCategoryRecommended RegionCategory = "Recommended"
)

func PossibleRegionCategoryValues

func PossibleRegionCategoryValues() []RegionCategory

PossibleRegionCategoryValues returns the possible values for the RegionCategory const type.

type RegionType

type RegionType string

RegionType - The type of the region.

const (
	// RegionTypeLogical - Logical
	RegionTypeLogical RegionType = "Logical"
	// RegionTypePhysical - Physical
	RegionTypePhysical RegionType = "Physical"
)

func PossibleRegionTypeValues

func PossibleRegionTypeValues() []RegionType

PossibleRegionTypeValues returns the possible values for the RegionType const type.

type ResourceName

type ResourceName struct {
	// REQUIRED; Name of the resource
	Name *string

	// REQUIRED; The type of the resource
	Type *string
}

ResourceName - Name and Type of the Resource

func (ResourceName) MarshalJSON

func (r ResourceName) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceName.

func (*ResourceName) UnmarshalJSON

func (r *ResourceName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceName.

type ResourceNameStatus

type ResourceNameStatus string

ResourceNameStatus - Is the resource name Allowed or Reserved

const (
	// ResourceNameStatusAllowed - Allowed
	ResourceNameStatusAllowed ResourceNameStatus = "Allowed"
	// ResourceNameStatusReserved - Reserved
	ResourceNameStatusReserved ResourceNameStatus = "Reserved"
)

func PossibleResourceNameStatusValues

func PossibleResourceNameStatusValues() []ResourceNameStatus

PossibleResourceNameStatusValues returns the possible values for the ResourceNameStatus const type.

type SpendingLimit

type SpendingLimit string

SpendingLimit - The subscription spending limit.

const (
	// SpendingLimitCurrentPeriodOff - CurrentPeriodOff
	SpendingLimitCurrentPeriodOff SpendingLimit = "CurrentPeriodOff"
	// SpendingLimitOff - Off
	SpendingLimitOff SpendingLimit = "Off"
	// SpendingLimitOn - On
	SpendingLimitOn SpendingLimit = "On"
)

func PossibleSpendingLimitValues

func PossibleSpendingLimitValues() []SpendingLimit

PossibleSpendingLimitValues returns the possible values for the SpendingLimit const type.

type Subscription

type Subscription struct {
	// The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct
	// and Management. For example, 'Legacy, RoleBased'.
	AuthorizationSource *string

	// An array containing the tenants managing the subscription.
	ManagedByTenants []*ManagedByTenant

	// The subscription policies.
	SubscriptionPolicies *SubscriptionPolicies

	// The tags attached to the subscription.
	Tags map[string]*string

	// READ-ONLY; The subscription display name.
	DisplayName *string

	// READ-ONLY; The fully qualified ID for the subscription. For example, /subscriptions/8d65815f-a5b6-402f-9298-045155da7d74
	ID *string

	// READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
	State *SubscriptionState

	// READ-ONLY; The subscription ID.
	SubscriptionID *string

	// READ-ONLY; The subscription tenant ID.
	TenantID *string
}

Subscription information.

func (Subscription) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Subscription.

func (*Subscription) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Subscription.

type SubscriptionClient

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

SubscriptionClient contains the methods for the Subscription group. Don't use this type directly, use NewSubscriptionClient() instead.

Generated from API version 2022-12-01

func NewSubscriptionClient

func NewSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionClient, error)

NewSubscriptionClient creates a new instance of SubscriptionClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*SubscriptionClient) CheckResourceName

CheckResourceName - Checks resource name validity

A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word If the operation fails it returns an *azcore.ResponseError type.

  • options - SubscriptionClientCheckResourceNameOptions contains the optional parameters for the SubscriptionClient.CheckResourceName method.
Example

Generated from example definition: 2022-12-01/CheckResourceName.json

package main

import (
	"context"
	"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/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSubscriptionClient().CheckResourceName(ctx, &armsubscriptions.SubscriptionClientCheckResourceNameOptions{
		ResourceNameDefinition: &armsubscriptions.ResourceName{
			Name: to.Ptr("isxbox"),
			Type: to.Ptr("ResourceProviderTestHost/TestResourceType"),
		}})
	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 = armsubscriptions.SubscriptionClientCheckResourceNameResponse{
	// 	CheckResourceNameResult: armsubscriptions.CheckResourceNameResult{
	// 		Name: to.Ptr("isxbox"),
	// 		Type: to.Ptr("ResourceProviderTestHost/TestResourceType"),
	// 		Status: to.Ptr(armsubscriptions.ResourceNameStatusAllowed),
	// 	},
	// }
}

type SubscriptionClientCheckResourceNameOptions

type SubscriptionClientCheckResourceNameOptions struct {
	// The request body
	ResourceNameDefinition *ResourceName
}

SubscriptionClientCheckResourceNameOptions contains the optional parameters for the SubscriptionClient.CheckResourceName method.

type SubscriptionClientCheckResourceNameResponse

type SubscriptionClientCheckResourceNameResponse struct {
	// Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word
	CheckResourceNameResult
}

SubscriptionClientCheckResourceNameResponse contains the response from method SubscriptionClient.CheckResourceName.

type SubscriptionListResult

type SubscriptionListResult struct {
	// REQUIRED; The Subscription items on this page
	Value []*Subscription

	// The link to the next page of items
	NextLink *string
}

SubscriptionListResult - Subscription list operation response.

func (SubscriptionListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SubscriptionListResult.

func (*SubscriptionListResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionListResult.

type SubscriptionPolicies

type SubscriptionPolicies struct {
	// READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example,
	// a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions.
	LocationPlacementID *string

	// READ-ONLY; The subscription quota ID.
	QuotaID *string

	// READ-ONLY; The subscription spending limit.
	SpendingLimit *SpendingLimit
}

SubscriptionPolicies - Subscription policies.

func (SubscriptionPolicies) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SubscriptionPolicies.

func (*SubscriptionPolicies) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionPolicies.

type SubscriptionState

type SubscriptionState string

SubscriptionState - The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.

const (
	// SubscriptionStateDeleted - Deleted
	SubscriptionStateDeleted SubscriptionState = "Deleted"
	// SubscriptionStateDisabled - Disabled
	SubscriptionStateDisabled SubscriptionState = "Disabled"
	// SubscriptionStateEnabled - Enabled
	SubscriptionStateEnabled SubscriptionState = "Enabled"
	// SubscriptionStatePastDue - PastDue
	SubscriptionStatePastDue SubscriptionState = "PastDue"
	// SubscriptionStateWarned - Warned
	SubscriptionStateWarned SubscriptionState = "Warned"
)

func PossibleSubscriptionStateValues

func PossibleSubscriptionStateValues() []SubscriptionState

PossibleSubscriptionStateValues returns the possible values for the SubscriptionState const type.

type TenantCategory

type TenantCategory string

TenantCategory - Category of the tenant.

const (
	// TenantCategoryHome - Home
	TenantCategoryHome TenantCategory = "Home"
	// TenantCategoryManagedBy - ManagedBy
	TenantCategoryManagedBy TenantCategory = "ManagedBy"
	// TenantCategoryProjectedBy - ProjectedBy
	TenantCategoryProjectedBy TenantCategory = "ProjectedBy"
)

func PossibleTenantCategoryValues

func PossibleTenantCategoryValues() []TenantCategory

PossibleTenantCategoryValues returns the possible values for the TenantCategory const type.

type TenantIDDescription

type TenantIDDescription struct {
	// READ-ONLY; Country/region name of the address for the tenant.
	Country *string

	// READ-ONLY; Country/region abbreviation for the tenant.
	CountryCode *string

	// READ-ONLY; The default domain for the tenant.
	DefaultDomain *string

	// READ-ONLY; The display name of the tenant.
	DisplayName *string

	// READ-ONLY; The list of domains for the tenant.
	Domains []*string

	// READ-ONLY; The fully qualified ID of the tenant. For example, /tenants/8d65815f-a5b6-402f-9298-045155da7d74
	ID *string

	// READ-ONLY; The tenant's branding logo URL. Only available for 'Home' tenant category.
	TenantBrandingLogoURL *string

	// READ-ONLY; Category of the tenant.
	TenantCategory *TenantCategory

	// READ-ONLY; The tenant ID. For example, 8d65815f-a5b6-402f-9298-045155da7d74
	TenantID *string

	// READ-ONLY; The tenant type. Only available for 'Home' tenant category.
	TenantType *string
}

TenantIDDescription - Tenant Id information.

func (TenantIDDescription) MarshalJSON

func (t TenantIDDescription) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantIDDescription.

func (*TenantIDDescription) UnmarshalJSON

func (t *TenantIDDescription) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantIDDescription.

type TenantListResult

type TenantListResult struct {
	// REQUIRED; The TenantIdDescription items on this page
	Value []*TenantIDDescription

	// The link to the next page of items
	NextLink *string
}

TenantListResult - Tenant Ids information.

func (TenantListResult) MarshalJSON

func (t TenantListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantListResult.

func (*TenantListResult) UnmarshalJSON

func (t *TenantListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantListResult.

type TenantsClient

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

TenantsClient contains the methods for the Tenants group. Don't use this type directly, use NewTenantsClient() instead.

Generated from API version 2022-12-01

func NewTenantsClient

func NewTenantsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantsClient, error)

NewTenantsClient creates a new instance of TenantsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*TenantsClient) NewListPager

NewListPager - Gets the tenants for your account.

  • options - TenantsClientListOptions contains the optional parameters for the TenantsClient.NewListPager method.
Example

Generated from example definition: 2022-12-01/GetTenants.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions/v2"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsubscriptions.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTenantsClient().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 = armsubscriptions.TenantsClientListResponse{
		// 	TenantListResult: armsubscriptions.TenantListResult{
		// 		NextLink: to.Ptr("http://nextlink"),
		// 		Value: []*armsubscriptions.TenantIDDescription{
		// 			{
		// 				CountryCode: to.Ptr("US"),
		// 				DefaultDomain: to.Ptr("aad50.ccsctp.net"),
		// 				DisplayName: to.Ptr("Test_Test_aad50"),
		// 				Domains: []*string{
		// 					to.Ptr("aad50.ccsctp.net"),
		// 				},
		// 				ID: to.Ptr("/tenants/a70a1586-9c4a-4373-b907-1d310660dbd1"),
		// 				TenantCategory: to.Ptr(armsubscriptions.TenantCategoryManagedBy),
		// 				TenantID: to.Ptr("a70a1586-9c4a-4373-b907-1d310660dbd1"),
		// 				TenantType: to.Ptr("AAD"),
		// 			},
		// 			{
		// 				CountryCode: to.Ptr("US"),
		// 				DefaultDomain: to.Ptr("auxteststagemanual.ccsctp.net"),
		// 				DisplayName: to.Ptr("Contoso Corp."),
		// 				Domains: []*string{
		// 					to.Ptr("auxteststagemanual.ccsctp.net"),
		// 				},
		// 				ID: to.Ptr("/tenants/83abe5cd-bcc3-441a-bd86-e6a75360cecc"),
		// 				TenantCategory: to.Ptr(armsubscriptions.TenantCategoryHome),
		// 				TenantID: to.Ptr("83abe5cd-bcc3-441a-bd86-e6a75360cecc"),
		// 				TenantType: to.Ptr("AAD"),
		// 			},
		// 			{
		// 				CountryCode: to.Ptr("US"),
		// 				DefaultDomain: to.Ptr("rdvmohoro.ccsctp.net"),
		// 				DisplayName: to.Ptr("TEST_TEST_RDV"),
		// 				Domains: []*string{
		// 					to.Ptr("rdvmohoro.ccsctp.net"),
		// 					to.Ptr("rdvmohoro.mail.ccsctp.net"),
		// 					to.Ptr("rdvmohoro.com"),
		// 				},
		// 				ID: to.Ptr("/tenants/daea2e9b-847b-4c93-850d-2aa6f2d7af33"),
		// 				TenantBrandingLogoURL: to.Ptr("logo1.logo.rdvmohoro.com"),
		// 				TenantCategory: to.Ptr(armsubscriptions.TenantCategoryProjectedBy),
		// 				TenantID: to.Ptr("daea2e9b-847b-4c93-850d-2aa6f2d7af33"),
		// 				TenantType: to.Ptr("AAD"),
		// 			},
		// 		},
		// 	},
		// }
	}
}

type TenantsClientListOptions

type TenantsClientListOptions struct {
}

TenantsClientListOptions contains the optional parameters for the TenantsClient.NewListPager method.

type TenantsClientListResponse

type TenantsClientListResponse struct {
	// Tenant Ids information.
	TenantListResult
}

TenantsClientListResponse contains the response from method TenantsClient.NewListPager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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