armsubscriptions

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 13 Imported by: 31

README

Azure Subscriptions Module for Go

PkgGoDev

The armsubscriptions module provides operations for working with Azure Subscriptions.

Source code

Getting started

Prerequisites

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

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Subscriptions module:

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

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(<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 := armsubscriptions.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.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 added in v1.2.0

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 added in v1.2.0

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type AvailabilityZoneMappings added in v1.2.0

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 added in v1.2.0

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

MarshalJSON implements the json.Marshaller interface for type AvailabilityZoneMappings.

func (*AvailabilityZoneMappings) UnmarshalJSON added in v1.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityZoneMappings.

type AvailabilityZonePeers added in v0.2.0

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 added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type AvailabilityZonePeers.

func (*AvailabilityZonePeers) UnmarshalJSON added in v1.1.0

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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type CheckResourceNameResult.

func (*CheckResourceNameResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckResourceNameResult.

type CheckZonePeersRequest added in v0.2.0

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 added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type CheckZonePeersRequest.

func (*CheckZonePeersRequest) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckZonePeersRequest.

type CheckZonePeersResult added in v0.2.0

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 added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type CheckZonePeersResult.

func (*CheckZonePeersResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckZonePeersResult.

type Client added in v0.2.0

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

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

func NewClient added in v0.2.0

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 - pass nil to accept the default values.

func (*Client) CheckZonePeers added in v0.2.0

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.

Generated from API version 2022-12-01

  • subscriptionID - The ID of the target subscription.
  • parameters - Parameters for checking zone peers.
  • options - ClientCheckZonePeersOptions contains the optional parameters for the Client.CheckZonePeers method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/PostCheckZonePeers.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/resources/armsubscriptions"
)

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.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"),
	// }
}
Output:

func (*Client) Get added in v0.2.0

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.

Generated from API version 2022-12-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)

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.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"),
	// }
}
Output:

func (*Client) NewListLocationsPager added in v0.4.0

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

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

Generated from API version 2022-12-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetLocations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)

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: 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.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"),
		// 	}},
		// }
	}
}
Output:

Example (GetLocationsWithExtendedLocations)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetLocationsWithExtendedLocations.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/resources/armsubscriptions"
)

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.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"),
		// 	}},
		// }
	}
}
Output:

func (*Client) NewListPager added in v0.4.0

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

NewListPager - Gets all subscriptions for a tenant.

Generated from API version 2022-12-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetSubscriptions.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)

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.SubscriptionListResult = armsubscriptions.SubscriptionListResult{
		// 	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"),
		// 	}},
		// }
	}
}
Output:

type ClientCheckZonePeersOptions added in v0.2.0

type ClientCheckZonePeersOptions struct {
}

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

type ClientCheckZonePeersResponse added in v0.2.0

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

ClientCheckZonePeersResponse contains the response from method Client.CheckZonePeers.

type ClientFactory added in v1.1.0

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

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

func NewClientFactory added in v1.1.0

func NewClientFactory(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 added in v1.1.0

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

func (*ClientFactory) NewOperationsClient added in v1.2.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewSubscriptionClient added in v1.1.0

func (c *ClientFactory) NewSubscriptionClient() *SubscriptionClient

NewSubscriptionClient creates a new instance of SubscriptionClient.

func (*ClientFactory) NewTenantsClient added in v1.1.0

func (c *ClientFactory) NewTenantsClient() *TenantsClient

NewTenantsClient creates a new instance of TenantsClient.

type ClientGetOptions added in v0.2.0

type ClientGetOptions struct {
}

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

type ClientGetResponse added in v0.2.0

type ClientGetResponse struct {
	// Subscription information.
	Subscription
}

ClientGetResponse contains the response from method Client.Get.

type ClientListLocationsOptions added in v0.2.0

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

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

type ClientListLocationsResponse added in v0.2.0

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

ClientListLocationsResponse contains the response from method Client.NewListLocationsPager.

type ClientListOptions added in v0.2.0

type ClientListOptions struct {
}

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

type ClientListResponse added in v0.2.0

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

ClientListResponse contains the response from method Client.NewListPager.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info any

	// READ-ONLY; The additional info type.
	Type *string
}

ErrorAdditionalInfo - The resource management error additional info.

func (ErrorAdditionalInfo) MarshalJSON added in v1.1.0

func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo.

func (*ErrorAdditionalInfo) UnmarshalJSON added in v1.1.0

func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo.

type ErrorDetail added in v0.2.0

type ErrorDetail struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo

	// READ-ONLY; The error code.
	Code *string

	// READ-ONLY; The error details.
	Details []*ErrorDetail

	// READ-ONLY; The error message.
	Message *string

	// READ-ONLY; The error target.
	Target *string
}

ErrorDetail - The error detail.

func (ErrorDetail) MarshalJSON added in v0.2.0

func (e ErrorDetail) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDetail.

func (*ErrorDetail) UnmarshalJSON added in v1.1.0

func (e *ErrorDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail.

type ErrorResponse

type ErrorResponse struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo

	// READ-ONLY; The error code.
	Code *string

	// READ-ONLY; The error details.
	Details []*ErrorResponse

	// READ-ONLY; The error message.
	Message *string

	// READ-ONLY; The error target.
	Target *string
}

ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)

func (ErrorResponse) MarshalJSON

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v1.1.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type ErrorResponseAutoGenerated added in v0.2.0

type ErrorResponseAutoGenerated struct {
	// The error object.
	Error *ErrorDetail
}

ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

func (ErrorResponseAutoGenerated) MarshalJSON added in v1.1.0

func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated.

func (*ErrorResponseAutoGenerated) UnmarshalJSON added in v1.1.0

func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated.

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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Location.

func (*Location) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Location.

type LocationListResult

type LocationListResult struct {
	// 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 added in v1.1.0

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 added in v1.1.0

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 LocationType = "EdgeZone"
	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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ManagedByTenant.

func (*ManagedByTenant) UnmarshalJSON added in v1.1.0

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; 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 ARM/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 - Details of a REST API operation, returned from the Resource Provider Operations API

func (Operation) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationAutoGenerated added in v1.2.0

type OperationAutoGenerated struct {
	// Localized display information for this particular operation.
	Display *OperationDisplayAutoGenerated

	// Operation name: {provider}/{resource}/{operation}
	Name *string

	// READ-ONLY; 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 ARM/control-plane
	// operations.
	IsDataAction *bool

	// 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
}

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

func (OperationAutoGenerated) MarshalJSON added in v1.2.0

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

MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated.

func (*OperationAutoGenerated) UnmarshalJSON added in v1.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated.

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 this particular operation.

func (OperationDisplay) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationDisplayAutoGenerated added in v1.2.0

type OperationDisplayAutoGenerated struct {
	// Description of the operation.
	Description *string

	// Operation type: Read, write, delete, etc.
	Operation *string

	// Service provider: Microsoft.Resources
	Provider *string

	// Resource on which the operation is performed: Profile, endpoint, etc.
	Resource *string
}

OperationDisplayAutoGenerated - Localized display information for this particular operation.

func (OperationDisplayAutoGenerated) MarshalJSON added in v1.2.0

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated.

func (*OperationDisplayAutoGenerated) UnmarshalJSON added in v1.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated.

type OperationListResult

type OperationListResult struct {
	// READ-ONLY; URL to get the next set of operation list results (if there are any).
	NextLink *string

	// READ-ONLY; List of operations supported by the resource provider
	Value []*Operation
}

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 added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationListResultAutoGenerated added in v1.2.0

type OperationListResultAutoGenerated struct {
	// URL to get the next set of operation list results (if there are any).
	NextLink *string

	// List of operations supported by the resource provider
	Value []*OperationAutoGenerated
}

OperationListResultAutoGenerated - 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 (OperationListResultAutoGenerated) MarshalJSON added in v1.2.0

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

MarshalJSON implements the json.Marshaller interface for type OperationListResultAutoGenerated.

func (*OperationListResultAutoGenerated) UnmarshalJSON added in v1.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResultAutoGenerated.

type OperationsClient added in v1.2.0

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

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

func NewOperationsClient added in v1.2.0

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

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

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

func (*OperationsClient) NewListPager added in v1.2.0

NewListPager - Lists all of the available Microsoft.Resources REST API operations.

Generated from API version 2022-12-01

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

type OperationsClientListOptions added in v1.2.0

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse added in v1.2.0

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 added in v1.2.0

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     Origin = "system"
	OriginUser       Origin = "user"
	OriginUserSystem Origin = "user,system"
)

func PossibleOriginValues added in v1.2.0

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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type PairedRegion.

func (*PairedRegion) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type PairedRegion.

type Peers added in v0.2.0

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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Peers.

func (*Peers) UnmarshalJSON added in v1.1.0

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    RegionCategory = "Extended"
	RegionCategoryOther       RegionCategory = "Other"
	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  RegionType = "Logical"
	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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceName.

func (*ResourceName) UnmarshalJSON added in v1.1.0

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  ResourceNameStatus = "Allowed"
	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 SpendingLimit = "CurrentPeriodOff"
	SpendingLimitOff              SpendingLimit = "Off"
	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 added in v1.1.0

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 SubscriptionClient group. Don't use this type directly, use NewSubscriptionClient() instead.

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 - pass nil to accept the default values.

func (*SubscriptionClient) CheckResourceName

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

Generated from API version 2022-12-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/CheckResourceName.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)

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: 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.CheckResourceNameResult = armsubscriptions.CheckResourceNameResult{
	// 	Name: to.Ptr("isxbox"),
	// 	Type: to.Ptr("ResourceProviderTestHost/TestResourceType"),
	// 	Status: to.Ptr(armsubscriptions.ResourceNameStatusAllowed),
	// }
}
Output:

type SubscriptionClientCheckResourceNameOptions

type SubscriptionClientCheckResourceNameOptions struct {
	// Resource object with values for resource name and resource type
	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 URL to get the next set of results.
	NextLink *string

	// An array of subscriptions.
	Value []*Subscription
}

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 added in v1.1.0

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 added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type SubscriptionPolicies.

func (*SubscriptionPolicies) UnmarshalJSON added in v1.1.0

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  SubscriptionState = "Deleted"
	SubscriptionStateDisabled SubscriptionState = "Disabled"
	SubscriptionStateEnabled  SubscriptionState = "Enabled"
	SubscriptionStatePastDue  SubscriptionState = "PastDue"
	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        TenantCategory = "Home"
	TenantCategoryManagedBy   TenantCategory = "ManagedBy"
	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 added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TenantIDDescription.

type TenantListResult

type TenantListResult struct {
	// REQUIRED; The URL to use for getting the next set of results.
	NextLink *string

	// An array of tenants.
	Value []*TenantIDDescription
}

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 added in v1.1.0

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.

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 - pass nil to accept the default values.

func (*TenantsClient) NewListPager added in v0.4.0

NewListPager - Gets the tenants for your account.

Generated from API version 2022-12-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4f4073bdb028bc84bc3e6405c1cbaf8e89b83caf/specification/resources/resource-manager/Microsoft.Resources/stable/2022-12-01/examples/GetTenants.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions"
)

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.TenantListResult = armsubscriptions.TenantListResult{
		// 	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"),
		// 				}},
		// 			}
	}
}
Output:

type TenantsClientListOptions added in v0.2.0

type TenantsClientListOptions struct {
}

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

type TenantsClientListResponse added in v0.2.0

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