armquota

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 17 Imported by: 1

README

Azure Quota Module for Go

PkgGoDev

The armquota module provides operations for working with Azure Quota.

Source code

Getting started

Prerequisites

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Quota module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Quota. 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 Quota 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 := armquota.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 := armquota.NewClient(<subscription ID>, cred, &options)

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Quota 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 Client added in v0.2.0

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

Client contains the methods for the Quota 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) BeginCreateOrUpdate added in v0.2.0

func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update the quota limit for the specified resource with the requested value. To update the quota, follow these steps: 1. Use the GET operation for quotas and usages to determine how much quota remains for the specific resource and to calculate the new quota limit. These steps are detailed in this example [https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670]. 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of the request. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview resourceName - Resource name for a given resource provider. For example: * SKU name for Microsoft.Compute * SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. createQuotaRequest - Quota request payload. options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/putNetworkOneSkuQuotaRequest.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/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdate(ctx,
		"MinPublicIpInterNetworkPrefixLength",
		"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus",
		armquota.CurrentQuotaLimitBase{
			Properties: &armquota.Properties{
				Name: &armquota.ResourceName{
					Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"),
				},
				Limit: &armquota.LimitObject{
					LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue),
					Value:           to.Ptr[int32](10),
				},
				ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"),
			},
		},
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) BeginUpdate added in v0.2.0

func (client *Client) BeginUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginUpdateOptions) (*runtime.Poller[ClientUpdateResponse], error)

BeginUpdate - Update the quota limit for a specific resource to the specified value: 1. Use the Usages-GET and Quota-GET operations to determine the remaining quota for the specific resource and to calculate the new quota limit. These steps are detailed in this example [https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670]. 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of the request. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview resourceName - Resource name for a given resource provider. For example: * SKU name for Microsoft.Compute * SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. createQuotaRequest - Quota requests payload. options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/patchComputeQuotaRequest.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/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginUpdate(ctx,
		"standardFSv2Family",
		"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus",
		armquota.CurrentQuotaLimitBase{
			Properties: &armquota.Properties{
				Name: &armquota.ResourceName{
					Value: to.Ptr("standardFSv2Family"),
				},
				Limit: &armquota.LimitObject{
					LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue),
					Value:           to.Ptr[int32](10),
				},
			},
		},
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) Get added in v0.2.0

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

Get - Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota limit that can be submitted with a PUT request. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview resourceName - Resource name for a given resource provider. For example: * SKU name for Microsoft.Compute * SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. 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/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeOneSkuQuotaLimit.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"standardNDSFamily",
		"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) NewListPager added in v0.4.0

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

NewListPager - Get a list of current quota limits of all resources for the specified scope. The response from this GET operation can be leveraged to submit requests to update a quota. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. 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/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeQuotaLimits.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus",
		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 ClientBeginCreateOrUpdateOptions added in v0.2.0

type ClientBeginCreateOrUpdateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method.

type ClientBeginUpdateOptions added in v0.2.0

type ClientBeginUpdateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method.

type ClientCreateOrUpdateResponse added in v0.2.0

type ClientCreateOrUpdateResponse struct {
	CurrentQuotaLimitBase
}

ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate.

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 {
	CurrentQuotaLimitBase
	// ETag contains the information returned from the ETag header response.
	ETag *string
}

ClientGetResponse contains the response from method Client.Get.

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 {
	Limits
	// ETag contains the information returned from the ETag header response.
	ETag *string
}

ClientListResponse contains the response from method Client.List.

type ClientUpdateResponse added in v0.2.0

type ClientUpdateResponse struct {
	CurrentQuotaLimitBase
}

ClientUpdateResponse contains the response from method Client.Update.

type CommonResourceProperties

type CommonResourceProperties struct {
	// READ-ONLY; Resource ID
	ID *string `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; Resource type. Example: "Microsoft.Quota/quotas"
	Type *string `json:"type,omitempty" azure:"ro"`
}

CommonResourceProperties - Resource properties.

type CreateGenericQuotaRequestParameters

type CreateGenericQuotaRequestParameters struct {
	// Quota change requests.
	Value []*CurrentQuotaLimitBase `json:"value,omitempty"`
}

CreateGenericQuotaRequestParameters - Quota change requests information.

type CurrentQuotaLimitBase

type CurrentQuotaLimitBase struct {
	// Quota properties for the specified resource, based on the API called, Quotas or Usages.
	Properties *Properties `json:"properties,omitempty"`

	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

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

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

CurrentQuotaLimitBase - Quota limit.

func (CurrentQuotaLimitBase) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimitBase.

type CurrentUsagesBase

type CurrentUsagesBase struct {
	// Usage properties for the specified resource.
	Properties *UsagesProperties `json:"properties,omitempty"`

	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

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

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

CurrentUsagesBase - Resource usage.

type ExceptionResponse

type ExceptionResponse struct {
	// API error details.
	Error *ServiceError `json:"error,omitempty"`
}

ExceptionResponse - Error.

type LimitJSONObject

type LimitJSONObject struct {
	// REQUIRED; The limit object type.
	LimitObjectType *LimitType `json:"limitObjectType,omitempty"`
}

LimitJSONObject - LimitJson abstract class.

func (*LimitJSONObject) GetLimitJSONObject

func (l *LimitJSONObject) GetLimitJSONObject() *LimitJSONObject

GetLimitJSONObject implements the LimitJSONObjectClassification interface for type LimitJSONObject.

type LimitJSONObjectClassification

type LimitJSONObjectClassification interface {
	// GetLimitJSONObject returns the LimitJSONObject content of the underlying type.
	GetLimitJSONObject() *LimitJSONObject
}

LimitJSONObjectClassification provides polymorphic access to related types. Call the interface's GetLimitJSONObject() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *LimitJSONObject, *LimitObject

type LimitObject

type LimitObject struct {
	// REQUIRED; The limit object type.
	LimitObjectType *LimitType `json:"limitObjectType,omitempty"`

	// REQUIRED; The quota/limit value
	Value *int32 `json:"value,omitempty"`

	// The quota or usages limit types.
	LimitType *QuotaLimitTypes `json:"limitType,omitempty"`
}

LimitObject - The resource quota limit value.

func (*LimitObject) GetLimitJSONObject added in v0.2.0

func (l *LimitObject) GetLimitJSONObject() *LimitJSONObject

GetLimitJSONObject implements the LimitJSONObjectClassification interface for type LimitObject.

func (LimitObject) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type LimitObject.

func (*LimitObject) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type LimitObject.

type LimitType

type LimitType string

LimitType - The limit object type.

const (
	LimitTypeLimitValue LimitType = "LimitValue"
)

func PossibleLimitTypeValues

func PossibleLimitTypeValues() []LimitType

PossibleLimitTypeValues returns the possible values for the LimitType const type.

type Limits added in v0.2.0

type Limits struct {
	// The URI used to fetch the next page of quota limits. When there are no more pages, this string is null.
	NextLink *string `json:"nextLink,omitempty"`

	// List of quota limits.
	Value []*CurrentQuotaLimitBase `json:"value,omitempty"`
}

Limits - Quota limits.

type LimitsResponse added in v0.2.0

type LimitsResponse struct {
	// The URI used to fetch the next page of quota limits. When there are no more pages, this is null.
	NextLink *string `json:"nextLink,omitempty"`

	// List of quota limits with the quota request status.
	Value []*CurrentQuotaLimitBase `json:"value,omitempty"`
}

LimitsResponse - Quota limits request response.

type OperationClient added in v0.2.0

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

OperationClient contains the methods for the QuotaOperation group. Don't use this type directly, use NewOperationClient() instead.

func NewOperationClient added in v0.2.0

func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error)

NewOperationClient creates a new instance of OperationClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*OperationClient) NewListPager added in v0.4.0

NewListPager - List all the operations supported by the Microsoft.Quota resource provider. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview options - OperationClientListOptions contains the optional parameters for the OperationClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/GetOperations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewOperationClient(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 OperationClientListOptions added in v0.2.0

type OperationClientListOptions struct {
}

OperationClientListOptions contains the optional parameters for the OperationClient.List method.

type OperationClientListResponse added in v0.2.0

type OperationClientListResponse struct {
	OperationList
}

OperationClientListResponse contains the response from method OperationClient.List.

type OperationDisplay

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

	// Operation name.
	Operation *string `json:"operation,omitempty"`

	// Provider name.
	Provider *string `json:"provider,omitempty"`

	// Resource name.
	Resource *string `json:"resource,omitempty"`
}

type OperationList

type OperationList struct {
	// URL to get the next page of items.
	NextLink *string              `json:"nextLink,omitempty"`
	Value    []*OperationResponse `json:"value,omitempty"`
}

type OperationResponse

type OperationResponse struct {
	Display *OperationDisplay `json:"display,omitempty"`
	Name    *string           `json:"name,omitempty"`
	Origin  *string           `json:"origin,omitempty"`
}

type Properties added in v0.2.0

type Properties struct {
	// Resource quota limit properties.
	Limit LimitJSONObjectClassification `json:"limit,omitempty"`

	// Resource name provided by the resource provider. Use this property name when requesting quota.
	Name *ResourceName `json:"name,omitempty"`

	// Additional properties for the specific resource provider.
	Properties interface{} `json:"properties,omitempty"`

	// Resource type name.
	ResourceType *string `json:"resourceType,omitempty"`

	// READ-ONLY; States if quota can be requested for this resource.
	IsQuotaApplicable *bool `json:"isQuotaApplicable,omitempty" azure:"ro"`

	// READ-ONLY; The time period over which the quota usage values are summarized. For example: *P1D (per one day) *PT1M (per
	// one minute) *PT1S (per one second). This parameter is optional because, for some resources
	// like compute, the period is irrelevant.
	QuotaPeriod *string `json:"quotaPeriod,omitempty" azure:"ro"`

	// READ-ONLY; The quota units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response
	// in the request body of your PUT operation.
	Unit *string `json:"unit,omitempty" azure:"ro"`
}

Properties - Quota properties for the specified resource.

func (Properties) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type Properties.

func (*Properties) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Properties.

type QuotaLimitTypes

type QuotaLimitTypes string

QuotaLimitTypes - The quota or usages limit types.

const (
	QuotaLimitTypesIndependent QuotaLimitTypes = "Independent"
	QuotaLimitTypesShared      QuotaLimitTypes = "Shared"
)

func PossibleQuotaLimitTypesValues

func PossibleQuotaLimitTypesValues() []QuotaLimitTypes

PossibleQuotaLimitTypesValues returns the possible values for the QuotaLimitTypes const type.

type QuotaRequestState

type QuotaRequestState string

QuotaRequestState - Quota request status.

const (
	QuotaRequestStateAccepted   QuotaRequestState = "Accepted"
	QuotaRequestStateFailed     QuotaRequestState = "Failed"
	QuotaRequestStateInProgress QuotaRequestState = "InProgress"
	QuotaRequestStateInvalid    QuotaRequestState = "Invalid"
	QuotaRequestStateSucceeded  QuotaRequestState = "Succeeded"
)

func PossibleQuotaRequestStateValues

func PossibleQuotaRequestStateValues() []QuotaRequestState

PossibleQuotaRequestStateValues returns the possible values for the QuotaRequestState const type.

type RequestDetails added in v0.2.0

type RequestDetails struct {
	// Quota request details.
	Properties *RequestProperties `json:"properties,omitempty"`

	// READ-ONLY; Quota request ID.
	ID *string `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; Resource type. "Microsoft.Quota/quotas".
	Type *string `json:"type,omitempty" azure:"ro"`
}

RequestDetails - List of quota requests with details.

type RequestDetailsList added in v0.2.0

type RequestDetailsList struct {
	// The URI for fetching the next page of quota limits. When there are no more pages, this string is null.
	NextLink *string `json:"nextLink,omitempty"`

	// Quota request details.
	Value []*RequestDetails `json:"value,omitempty"`
}

RequestDetailsList - Quota request information.

type RequestOneResourceProperties added in v0.2.0

type RequestOneResourceProperties struct {
	// Error details of the quota request.
	Error *ServiceErrorDetail `json:"error,omitempty"`

	// Resource quota limit properties.
	Limit *LimitObject `json:"limit,omitempty"`

	// Resource name provided by the resource provider. Use this property name when requesting quota.
	Name *ResourceName `json:"name,omitempty"`

	// Additional properties for the specific resource provider.
	Properties interface{} `json:"properties,omitempty"`

	// Resource type name.
	ResourceType *string `json:"resourceType,omitempty"`

	// The quota limit units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response
	// in the request body of your PUT operation.
	Unit *string `json:"unit,omitempty"`

	// READ-ONLY; Usage information for the current resource.
	CurrentValue *int32 `json:"currentValue,omitempty" azure:"ro"`

	// READ-ONLY; States if quota can be requested for this resource.
	IsQuotaApplicable *bool `json:"isQuotaApplicable,omitempty" azure:"ro"`

	// READ-ONLY; User-friendly status message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; Quota request status.
	ProvisioningState *QuotaRequestState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; The time period over which the quota usage values are summarized. For example: *P1D (per one day) *PT1M (per
	// one minute) *PT1S (per one second). This parameter is optional because, for some resources
	// like compute, the period is irrelevant.
	QuotaPeriod *string `json:"quotaPeriod,omitempty" azure:"ro"`

	// READ-ONLY; Quota request submission time. The date conforms to the following ISO 8601 standard format: yyyy-MM-ddTHH:mm:ssZ.
	RequestSubmitTime *time.Time `json:"requestSubmitTime,omitempty" azure:"ro"`
}

RequestOneResourceProperties - Quota request.

func (*RequestOneResourceProperties) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequestOneResourceProperties.

type RequestOneResourceSubmitResponse added in v0.2.0

type RequestOneResourceSubmitResponse struct {
	// Quota request details.
	Properties *RequestOneResourceProperties `json:"properties,omitempty"`

	// READ-ONLY; Quota request ID.
	ID *string `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; Resource type. "Microsoft.Quota/ServiceLimitRequests"
	Type *string `json:"type,omitempty" azure:"ro"`
}

RequestOneResourceSubmitResponse - Quota request response.

type RequestProperties added in v0.2.0

type RequestProperties struct {
	// Error details of the quota request.
	Error *ServiceErrorDetail `json:"error,omitempty"`

	// Quota request details.
	Value []*SubRequest `json:"value,omitempty"`

	// READ-ONLY; User-friendly status message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The quota request status.
	ProvisioningState *QuotaRequestState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; The quota request submission time. The date conforms to the following format specified by the ISO 8601 standard:
	// yyyy-MM-ddTHH:mm:ssZ
	RequestSubmitTime *time.Time `json:"requestSubmitTime,omitempty" azure:"ro"`
}

RequestProperties - Quota request properties.

func (*RequestProperties) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequestProperties.

type RequestStatusClient added in v0.2.0

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

RequestStatusClient contains the methods for the QuotaRequestStatus group. Don't use this type directly, use NewRequestStatusClient() instead.

func NewRequestStatusClient added in v0.2.0

func NewRequestStatusClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RequestStatusClient, error)

NewRequestStatusClient creates a new instance of RequestStatusClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*RequestStatusClient) Get added in v0.2.0

Get - Get the quota request details and status by quota request ID for the resources of the resource provider at a specific location. The quota request ID id is returned in the response of the PUT operation. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview id - Quota request ID. scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. options - RequestStatusClientGetOptions contains the optional parameters for the RequestStatusClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getQuotaRequestStatusFailed.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewRequestStatusClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"2B5C8515-37D8-4B6A-879B-CD641A2CF605",
		"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RequestStatusClient) NewListPager added in v0.4.0

NewListPager - For the specified scope, get the current quota requests for a one year period ending at the time is made. Use the oData filter to select quota requests. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. options - RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getQuotaRequestsHistory.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewRequestStatusClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager("subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus",
		&armquota.RequestStatusClientListOptions{Filter: nil,
			Top:       nil,
			Skiptoken: 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 RequestStatusClientGetOptions added in v0.2.0

type RequestStatusClientGetOptions struct {
}

RequestStatusClientGetOptions contains the optional parameters for the RequestStatusClient.Get method.

type RequestStatusClientGetResponse added in v0.2.0

type RequestStatusClientGetResponse struct {
	RequestDetails
}

RequestStatusClientGetResponse contains the response from method RequestStatusClient.Get.

type RequestStatusClientListOptions added in v0.2.0

type RequestStatusClientListOptions struct {
	// FIELD SUPPORTED OPERATORS
	// requestSubmitTime ge, le, eq, gt, lt
	// provisioningState eq {QuotaRequestState}
	// resourceName eq {resourceName}
	Filter *string
	// The Skiptoken parameter is used only if a previous operation returned a partial result. If a previous response contains
	// a nextLink element, its value includes a skiptoken parameter that specifies a
	// starting point to use for subsequent calls.
	Skiptoken *string
	// Number of records to return.
	Top *int32
}

RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.List method.

type RequestStatusClientListResponse added in v0.2.0

type RequestStatusClientListResponse struct {
	RequestDetailsList
}

RequestStatusClientListResponse contains the response from method RequestStatusClient.List.

type RequestStatusDetails added in v0.2.0

type RequestStatusDetails struct {
	// Resource quota limit properties.
	Limit *LimitObject `json:"limit,omitempty"`

	// Resource name provided by the resource provider. Use this property name when requesting quota.
	Name *ResourceName `json:"name,omitempty"`

	// Additional properties for the specific resource provider.
	Properties interface{} `json:"properties,omitempty"`

	// Resource type name.
	ResourceType *string `json:"resourceType,omitempty"`

	// The quota limit units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response
	// in the request body of your PUT operation.
	Unit *string `json:"unit,omitempty"`

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

	// READ-ONLY; Quota request status.
	ProvisioningState *QuotaRequestState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; The time period over which the quota usage values are summarized. For example: *P1D (per one day) *PT1M (per
	// one minute) *PT1S (per one second). This parameter is optional because, for some resources
	// like compute, the period is irrelevant.
	QuotaPeriod *string `json:"quotaPeriod,omitempty" azure:"ro"`
}

RequestStatusDetails - Quota request status details.

type RequestSubmitResponse added in v0.2.0

type RequestSubmitResponse struct {
	// Quota request details.
	Properties *RequestProperties `json:"properties,omitempty"`

	// READ-ONLY; Quota request ID.
	ID *string `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; Resource type. "Microsoft.Quota/quotas".
	Type *string `json:"type,omitempty" azure:"ro"`
}

RequestSubmitResponse - Quota request response.

type RequestSubmitResponse202 added in v0.2.0

type RequestSubmitResponse202 struct {
	// Quota request status.
	Properties *RequestStatusDetails `json:"properties,omitempty"`

	// READ-ONLY; The quota request ID. To check the request status, use the id value in a Quota Request Status [https://docs.microsoft.com/en-us/rest/api/reserved-vm-instances/quotarequeststatus/get]
	// GET operation.
	ID *string `json:"id,omitempty" azure:"ro"`

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

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

RequestSubmitResponse202 - The quota request response with the quota request ID.

type ResourceName

type ResourceName struct {
	// Resource name.
	Value *string `json:"value,omitempty"`

	// READ-ONLY; Resource display name.
	LocalizedValue *string `json:"localizedValue,omitempty" azure:"ro"`
}

ResourceName - Name of the resource provided by the resource Provider. When requesting quota, use this property name.

type ServiceError

type ServiceError struct {
	// Error code.
	Code *string `json:"code,omitempty"`

	// Error message.
	Message *string `json:"message,omitempty"`

	// READ-ONLY; List of error details.
	Details []*ServiceErrorDetail `json:"details,omitempty" azure:"ro"`
}

ServiceError - API error details.

type ServiceErrorDetail

type ServiceErrorDetail struct {
	// READ-ONLY; Error code.
	Code *string `json:"code,omitempty" azure:"ro"`

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

ServiceErrorDetail - Error details.

type SubRequest

type SubRequest struct {
	// Resource quota limit properties.
	Limit LimitJSONObjectClassification `json:"limit,omitempty"`

	// Resource name.
	Name *ResourceName `json:"name,omitempty"`

	// Quota limit units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response in the
	// request body of your PUT operation.
	Unit *string `json:"unit,omitempty"`

	// READ-ONLY; User-friendly status message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The quota request status.
	ProvisioningState *QuotaRequestState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; Resource type for which the quota properties were requested.
	ResourceType *string `json:"resourceType,omitempty" azure:"ro"`

	// READ-ONLY; Quota request ID.
	SubRequestID *string `json:"subRequestId,omitempty" azure:"ro"`
}

SubRequest - Request property.

func (*SubRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubRequest.

type UsagesClient

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

UsagesClient contains the methods for the Usages group. Don't use this type directly, use NewUsagesClient() instead.

func NewUsagesClient

func NewUsagesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error)

NewUsagesClient creates a new instance of UsagesClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*UsagesClient) Get

func (client *UsagesClient) Get(ctx context.Context, resourceName string, scope string, options *UsagesClientGetOptions) (UsagesClientGetResponse, error)

Get - Get the current usage of a resource. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview resourceName - Resource name for a given resource provider. For example: * SKU name for Microsoft.Compute * SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. options - UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeOneSkuUsages.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewUsagesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"standardNDSFamily",
		"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*UsagesClient) NewListPager added in v0.4.0

func (client *UsagesClient) NewListPager(scope string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse]

NewListPager - Get a list of current usage for all resources for the scope specified. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-03-15-preview scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. This is the target Azure resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource URI in the GET operation for the specific resource. options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeUsages.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armquota.NewUsagesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus",
		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 UsagesClientGetOptions added in v0.2.0

type UsagesClientGetOptions struct {
}

UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method.

type UsagesClientGetResponse added in v0.2.0

type UsagesClientGetResponse struct {
	CurrentUsagesBase
	// ETag contains the information returned from the ETag header response.
	ETag *string
}

UsagesClientGetResponse contains the response from method UsagesClient.Get.

type UsagesClientListOptions added in v0.2.0

type UsagesClientListOptions struct {
}

UsagesClientListOptions contains the optional parameters for the UsagesClient.List method.

type UsagesClientListResponse added in v0.2.0

type UsagesClientListResponse struct {
	UsagesLimits
	// ETag contains the information returned from the ETag header response.
	ETag *string
}

UsagesClientListResponse contains the response from method UsagesClient.List.

type UsagesLimits

type UsagesLimits struct {
	// The URI used to fetch the next page of quota limits. When there are no more pages, this is null.
	NextLink *string `json:"nextLink,omitempty"`

	// List of quota limits.
	Value []*CurrentUsagesBase `json:"value,omitempty"`
}

UsagesLimits - Quota limits.

type UsagesObject

type UsagesObject struct {
	// REQUIRED; The usages value.
	Value *int32 `json:"value,omitempty"`

	// The quota or usages limit types.
	UsagesType *UsagesTypes `json:"usagesType,omitempty"`
}

UsagesObject - The resource usages value.

type UsagesProperties

type UsagesProperties struct {
	// Resource name provided by the resource provider. Use this property name when requesting quota.
	Name *ResourceName `json:"name,omitempty"`

	// Additional properties for the specific resource provider.
	Properties interface{} `json:"properties,omitempty"`

	// The name of the resource type.
	ResourceType *string `json:"resourceType,omitempty"`

	// The quota limit properties for this resource.
	Usages *UsagesObject `json:"usages,omitempty"`

	// READ-ONLY; States if quota can be requested for this resource.
	IsQuotaApplicable *bool `json:"isQuotaApplicable,omitempty" azure:"ro"`

	// READ-ONLY; The time period for the summary of the quota usage values. For example: *P1D (per one day) *PT1M (per one minute)
	// *PT1S (per one second). This parameter is optional because it is not relevant for all
	// resources such as compute.
	QuotaPeriod *string `json:"quotaPeriod,omitempty" azure:"ro"`

	// READ-ONLY; The units for the quota usage, such as Count and Bytes. When requesting quota, use the unit value returned in
	// the GET response in the request body of your PUT operation.
	Unit *string `json:"unit,omitempty" azure:"ro"`
}

UsagesProperties - Usage properties for the specified resource.

type UsagesTypes

type UsagesTypes string

UsagesTypes - The quota or usages limit types.

const (
	UsagesTypesCombined   UsagesTypes = "Combined"
	UsagesTypesIndividual UsagesTypes = "Individual"
)

func PossibleUsagesTypesValues

func PossibleUsagesTypesValues() []UsagesTypes

PossibleUsagesTypesValues returns the possible values for the UsagesTypes const type.

Jump to

Keyboard shortcuts

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