armsubscriptions

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 14 Imported by: 34

README

Azure Subscriptions Module for Go

PkgGoDev

The armsubscriptions module provides operations for working with Azure Subscriptions.

Source code

Getting started

Prerequisites

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.

Clients

Azure Subscriptions modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential.

client, err := armsubscriptions.NewClient(<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,
    },
}
client, err := armsubscriptions.NewClient(<subscription ID>, cred, &options)

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

type AvailabilityZonePeers struct {
	// Details of shared availability zone.
	Peers []*Peers `json:"peers,omitempty"`

	// READ-ONLY; The availabilityZone.
	AvailabilityZone *string `json:"availabilityZone,omitempty" azure:"ro"`
}

AvailabilityZonePeers - List of availability zones shared by the subscriptions.

type CheckResourceNameResult

type CheckResourceNameResult struct {
	// Name of Resource
	Name *string `json:"name,omitempty"`

	// Is the resource name Allowed or Reserved
	Status *ResourceNameStatus `json:"status,omitempty"`

	// Type of Resource
	Type *string `json:"type,omitempty"`
}

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

type CheckZonePeersRequest added in v0.2.0

type CheckZonePeersRequest struct {
	// The Microsoft location.
	Location *string `json:"location,omitempty"`

	// The peer Microsoft Azure subscription ID.
	SubscriptionIDs []*string `json:"subscriptionIds,omitempty"`
}

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.

type CheckZonePeersResult added in v0.2.0

type CheckZonePeersResult struct {
	// The Availability Zones shared by the subscriptions.
	AvailabilityZonePeers []*AvailabilityZonePeers `json:"availabilityZonePeers,omitempty"`

	// the location of the subscription.
	Location *string `json:"location,omitempty"`

	// READ-ONLY; The subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"`
}

CheckZonePeersResult - Result of the Check zone peers operation.

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 2021-01-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/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckZonePeers(ctx,
		"00000000-0000-0000-0000-00000000000000",
		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)
	}
	// TODO: use response item
	_ = res
}
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 2021-01-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/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"291bba3f-e0a5-47bc-a099-3bdcb2a50a05",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 subscriptionID - The ID of the target subscription. options - ClientListLocationsOptions contains the optional parameters for the Client.ListLocations method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListLocationsPager("291bba3f-e0a5-47bc-a099-3bdcb2a50a05",
		&armsubscriptions.ClientListLocationsOptions{IncludeExtendedLocations: nil})
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 options - ClientListOptions contains the optional parameters for the Client.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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 {
	CheckZonePeersResult
}

ClientCheckZonePeersResponse contains the response from method Client.CheckZonePeers.

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
}

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.ListLocations method.

type ClientListLocationsResponse added in v0.2.0

type ClientListLocationsResponse struct {
	LocationListResult
}

ClientListLocationsResponse contains the response from method Client.ListLocations.

type ClientListOptions added in v0.2.0

type ClientListOptions struct {
}

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

type ClientListResponse added in v0.2.0

type ClientListResponse struct {
	SubscriptionListResult
}

ClientListResponse contains the response from method Client.List.

type CloudError

type CloudError struct {
	// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows
	// the OData error response format.)
	Error *ErrorResponse `json:"error,omitempty"`
}

CloudError - An error response for a resource management request.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info interface{} `json:"info,omitempty" azure:"ro"`

	// READ-ONLY; The additional info type.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ErrorAdditionalInfo - The resource management error additional info.

type ErrorDetail added in v0.2.0

type ErrorDetail struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; The error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; The error details.
	Details []*ErrorDetail `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; The error message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The error target.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorDetail - The error detail.

type ErrorResponse

type ErrorResponse struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; The error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; The error details.
	Details []*ErrorResponse `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; The error message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The error target.
	Target *string `json:"target,omitempty" azure:"ro"`
}

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

type ErrorResponseAutoGenerated added in v0.2.0

type ErrorResponseAutoGenerated struct {
	// The error object.
	Error *ErrorDetail `json:"error,omitempty"`
}

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

type Location

type Location struct {
	// Metadata of the location, such as lat/long, paired region, and others.
	Metadata *LocationMetadata `json:"metadata,omitempty"`

	// READ-ONLY; The display name of the location.
	DisplayName *string `json:"displayName,omitempty" azure:"ro"`

	// READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The location name.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The display name of the location and its region.
	RegionalDisplayName *string `json:"regionalDisplayName,omitempty" azure:"ro"`

	// READ-ONLY; The subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"`

	// READ-ONLY; The location type.
	Type *LocationType `json:"type,omitempty" azure:"ro"`
}

Location information.

type LocationListResult

type LocationListResult struct {
	// An array of locations.
	Value []*Location `json:"value,omitempty"`
}

LocationListResult - Location list operation response.

type LocationMetadata

type LocationMetadata struct {
	// The regions paired to this region.
	PairedRegion []*PairedRegion `json:"pairedRegion,omitempty"`

	// READ-ONLY; The geography group of the location.
	GeographyGroup *string `json:"geographyGroup,omitempty" azure:"ro"`

	// READ-ONLY; The home location of an edge zone.
	HomeLocation *string `json:"homeLocation,omitempty" azure:"ro"`

	// READ-ONLY; The latitude of the location.
	Latitude *string `json:"latitude,omitempty" azure:"ro"`

	// READ-ONLY; The longitude of the location.
	Longitude *string `json:"longitude,omitempty" azure:"ro"`

	// READ-ONLY; The physical location of the Azure location.
	PhysicalLocation *string `json:"physicalLocation,omitempty" azure:"ro"`

	// READ-ONLY; The category of the region.
	RegionCategory *RegionCategory `json:"regionCategory,omitempty" azure:"ro"`

	// READ-ONLY; The type of the region.
	RegionType *RegionType `json:"regionType,omitempty" azure:"ro"`
}

LocationMetadata - Location metadata information

type LocationType

type LocationType string

LocationType - The location type.

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

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 `json:"tenantId,omitempty" azure:"ro"`
}

ManagedByTenant - Information about a tenant managing the subscription.

type Operation

type Operation struct {
	// The object that represents the operation.
	Display *OperationDisplay `json:"display,omitempty"`

	// Operation name: {provider}/{resource}/{operation}
	Name *string `json:"name,omitempty"`
}

Operation - Microsoft.Resources operation

type OperationDisplay

type OperationDisplay struct {
	// Description of the operation.
	Description *string `json:"description,omitempty"`

	// Operation type: Read, write, delete, etc.
	Operation *string `json:"operation,omitempty"`

	// Service provider: Microsoft.Resources
	Provider *string `json:"provider,omitempty"`

	// Resource on which the operation is performed: Profile, endpoint, etc.
	Resource *string `json:"resource,omitempty"`
}

OperationDisplay - The object that represents the operation.

type OperationListResult

type OperationListResult struct {
	// URL to get the next set of operation list results if there are any.
	NextLink *string `json:"nextLink,omitempty"`

	// List of Microsoft.Resources operations.
	Value []*Operation `json:"value,omitempty"`
}

OperationListResult - Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results.

type PairedRegion

type PairedRegion struct {
	// READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the paired region.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"`
}

PairedRegion - Information regarding paired region.

type Peers added in v0.2.0

type Peers struct {
	// READ-ONLY; The availabilityZone.
	AvailabilityZone *string `json:"availabilityZone,omitempty" azure:"ro"`

	// READ-ONLY; The subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"`
}

Peers - Information about shared availability zone.

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 `json:"name,omitempty"`

	// REQUIRED; The type of the resource
	Type *string `json:"type,omitempty"`
}

ResourceName - Name and Type of the Resource

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 (
	SpendingLimitOn               SpendingLimit = "On"
	SpendingLimitOff              SpendingLimit = "Off"
	SpendingLimitCurrentPeriodOff SpendingLimit = "CurrentPeriodOff"
)

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 `json:"authorizationSource,omitempty"`

	// An array containing the tenants managing the subscription.
	ManagedByTenants []*ManagedByTenant `json:"managedByTenants,omitempty"`

	// The subscription policies.
	SubscriptionPolicies *SubscriptionPolicies `json:"subscriptionPolicies,omitempty"`

	// The tags attached to the subscription.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; The subscription display name.
	DisplayName *string `json:"displayName,omitempty" azure:"ro"`

	// READ-ONLY; The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
	State *SubscriptionState `json:"state,omitempty" azure:"ro"`

	// READ-ONLY; The subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"`

	// READ-ONLY; The subscription tenant ID.
	TenantID *string `json:"tenantId,omitempty" azure:"ro"`
}

Subscription information.

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 2021-01-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/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewSubscriptionClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckResourceName(ctx,
		&armsubscriptions.SubscriptionClientCheckResourceNameOptions{ResourceNameDefinition: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
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 {
	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 `json:"nextLink,omitempty"`

	// An array of subscriptions.
	Value []*Subscription `json:"value,omitempty"`
}

SubscriptionListResult - Subscription list operation response.

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 `json:"locationPlacementId,omitempty" azure:"ro"`

	// READ-ONLY; The subscription quota ID.
	QuotaID *string `json:"quotaId,omitempty" azure:"ro"`

	// READ-ONLY; The subscription spending limit.
	SpendingLimit *SpendingLimit `json:"spendingLimit,omitempty" azure:"ro"`
}

SubscriptionPolicies - Subscription policies.

type SubscriptionState

type SubscriptionState string

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

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

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"
	TenantCategoryProjectedBy TenantCategory = "ProjectedBy"
	TenantCategoryManagedBy   TenantCategory = "ManagedBy"
)

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 `json:"country,omitempty" azure:"ro"`

	// READ-ONLY; Country/region abbreviation for the tenant.
	CountryCode *string `json:"countryCode,omitempty" azure:"ro"`

	// READ-ONLY; The default domain for the tenant.
	DefaultDomain *string `json:"defaultDomain,omitempty" azure:"ro"`

	// READ-ONLY; The display name of the tenant.
	DisplayName *string `json:"displayName,omitempty" azure:"ro"`

	// READ-ONLY; The list of domains for the tenant.
	Domains []*string `json:"domains,omitempty" azure:"ro"`

	// READ-ONLY; The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The tenant's branding logo URL. Only available for 'Home' tenant category.
	TenantBrandingLogoURL *string `json:"tenantBrandingLogoUrl,omitempty" azure:"ro"`

	// READ-ONLY; Category of the tenant.
	TenantCategory *TenantCategory `json:"tenantCategory,omitempty" azure:"ro"`

	// READ-ONLY; The tenant ID. For example, 00000000-0000-0000-0000-000000000000.
	TenantID *string `json:"tenantId,omitempty" azure:"ro"`

	// READ-ONLY; The tenant type. Only available for 'Home' tenant category.
	TenantType *string `json:"tenantType,omitempty" azure:"ro"`
}

TenantIDDescription - Tenant Id information.

type TenantListResult

type TenantListResult struct {
	// REQUIRED; The URL to use for getting the next set of results.
	NextLink *string `json:"nextLink,omitempty"`

	// An array of tenants.
	Value []*TenantIDDescription `json:"value,omitempty"`
}

TenantListResult - Tenant Ids information.

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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 options - TenantsClientListOptions contains the optional parameters for the TenantsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2021-01-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()
	client, err := armsubscriptions.NewTenantsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type TenantsClientListOptions added in v0.2.0

type TenantsClientListOptions struct {
}

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

type TenantsClientListResponse added in v0.2.0

type TenantsClientListResponse struct {
	TenantListResult
}

TenantsClientListResponse contains the response from method TenantsClient.List.

Jump to

Keyboard shortcuts

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