consumption

package
v59.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package consumption implements the Azure ARM Consumption service API version 2017-12-30-preview.

Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.

Index

Constants

View Source
const (
	// DefaultBaseURI is the default URI used for the service Consumption
	DefaultBaseURI = "https://management.azure.com"
)

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

Types

type BaseClient

type BaseClient struct {
	autorest.Client
	BaseURI        string
	SubscriptionID string
	Name           string
}

BaseClient is the base client for Consumption.

func New

func New(subscriptionID string, name string) BaseClient

New creates an instance of the BaseClient client.

func NewWithBaseURI

func NewWithBaseURI(baseURI string, subscriptionID string, name string) BaseClient

NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).

type Budget

type Budget struct {
	autorest.Response `json:"-"`
	*BudgetProperties `json:"properties,omitempty"`
	// ID - READ-ONLY; Resource Id.
	ID *string `json:"id,omitempty"`
	// Name - READ-ONLY; Resource name.
	Name *string `json:"name,omitempty"`
	// Type - READ-ONLY; Resource type.
	Type *string `json:"type,omitempty"`
	// ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
	ETag *string `json:"eTag,omitempty"`
}

Budget a budget resource.

func (Budget) MarshalJSON

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

MarshalJSON is the custom marshaler for Budget.

func (*Budget) UnmarshalJSON

func (b *Budget) UnmarshalJSON(body []byte) error

UnmarshalJSON is the custom unmarshaler for Budget struct.

type BudgetProperties

type BudgetProperties struct {
	// Category - The category of the budget, whether the budget tracks cost or something else.
	Category *string `json:"category,omitempty"`
	// Amount - The total amount of cost to track with the budget
	Amount *decimal.Decimal `json:"amount,omitempty"`
	// TimeGrain - The time covered by a budget. Tracking of the amount will be reset based on the time grain. Possible values include: 'Monthly', 'Quarterly', 'Annually'
	TimeGrain TimeGrainType `json:"timeGrain,omitempty"`
	// TimePeriod - Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should  be selected within the timegrain period. There are no restrictions on the end date.
	TimePeriod *BudgetTimePeriod `json:"timePeriod,omitempty"`
	// CurrentSpend - READ-ONLY; The current amount of cost which is being tracked for a budget.
	CurrentSpend *CurrentSpend `json:"currentSpend,omitempty"`
	// Notifications - Dictionary of notifications associated with the budget. Budget can have up to five notifications.
	Notifications map[string]*Notification `json:"notifications"`
}

BudgetProperties the properties of the budget.

func (BudgetProperties) MarshalJSON

func (bp BudgetProperties) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for BudgetProperties.

type BudgetTimePeriod

type BudgetTimePeriod struct {
	// StartDate - The start date for the budget.
	StartDate *date.Time `json:"startDate,omitempty"`
	// EndDate - The end date for the budget. If not provided, we default this to 10 years from the start date.
	EndDate *date.Time `json:"endDate,omitempty"`
}

BudgetTimePeriod the start and end date for a budget.

type BudgetsClient

type BudgetsClient struct {
	BaseClient
}

BudgetsClient is the consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.

func NewBudgetsClient

func NewBudgetsClient(subscriptionID string, name string) BudgetsClient

NewBudgetsClient creates an instance of the BudgetsClient client.

func NewBudgetsClientWithBaseURI

func NewBudgetsClientWithBaseURI(baseURI string, subscriptionID string, name string) BudgetsClient

NewBudgetsClientWithBaseURI creates an instance of the BudgetsClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).

func (BudgetsClient) CreateOrUpdate

func (client BudgetsClient) CreateOrUpdate(ctx context.Context, parameters Budget) (result Budget, err error)

CreateOrUpdate the operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. Parameters: parameters - parameters supplied to the Create Budget operation.

func (BudgetsClient) CreateOrUpdatePreparer

func (client BudgetsClient) CreateOrUpdatePreparer(ctx context.Context, parameters Budget) (*http.Request, error)

CreateOrUpdatePreparer prepares the CreateOrUpdate request.

func (BudgetsClient) CreateOrUpdateResponder

func (client BudgetsClient) CreateOrUpdateResponder(resp *http.Response) (result Budget, err error)

CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always closes the http.Response Body.

func (BudgetsClient) CreateOrUpdateSender

func (client BudgetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error)

CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the http.Response Body if it receives an error.

func (BudgetsClient) Delete

func (client BudgetsClient) Delete(ctx context.Context) (result autorest.Response, err error)

Delete the operation to delete a budget.

func (BudgetsClient) DeletePreparer

func (client BudgetsClient) DeletePreparer(ctx context.Context) (*http.Request, error)

DeletePreparer prepares the Delete request.

func (BudgetsClient) DeleteResponder

func (client BudgetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error)

DeleteResponder handles the response to the Delete request. The method always closes the http.Response Body.

func (BudgetsClient) DeleteSender

func (client BudgetsClient) DeleteSender(req *http.Request) (*http.Response, error)

DeleteSender sends the Delete request. The method will close the http.Response Body if it receives an error.

func (BudgetsClient) Get

func (client BudgetsClient) Get(ctx context.Context) (result Budget, err error)

Get gets the budget for a subscription by budget name.

func (BudgetsClient) GetPreparer

func (client BudgetsClient) GetPreparer(ctx context.Context) (*http.Request, error)

GetPreparer prepares the Get request.

func (BudgetsClient) GetResponder

func (client BudgetsClient) GetResponder(resp *http.Response) (result Budget, err error)

GetResponder handles the response to the Get request. The method always closes the http.Response Body.

func (BudgetsClient) GetSender

func (client BudgetsClient) GetSender(req *http.Request) (*http.Response, error)

GetSender sends the Get request. The method will close the http.Response Body if it receives an error.

func (BudgetsClient) List

func (client BudgetsClient) List(ctx context.Context) (result BudgetsListResult, err error)

List lists all budgets for a subscription.

func (BudgetsClient) ListPreparer

func (client BudgetsClient) ListPreparer(ctx context.Context) (*http.Request, error)

ListPreparer prepares the List request.

func (BudgetsClient) ListResponder

func (client BudgetsClient) ListResponder(resp *http.Response) (result BudgetsListResult, err error)

ListResponder handles the response to the List request. The method always closes the http.Response Body.

func (BudgetsClient) ListSender

func (client BudgetsClient) ListSender(req *http.Request) (*http.Response, error)

ListSender sends the List request. The method will close the http.Response Body if it receives an error.

type BudgetsListResult

type BudgetsListResult struct {
	autorest.Response `json:"-"`
	// Value - READ-ONLY; The list of budgets.
	Value *[]Budget `json:"value,omitempty"`
}

BudgetsListResult result of listing budgets. It contains a list of available budgets in the scope provided.

func (BudgetsListResult) MarshalJSON

func (blr BudgetsListResult) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for BudgetsListResult.

type CurrentSpend

type CurrentSpend struct {
	// Amount - READ-ONLY; The total amount of cost which is being tracked by the budget.
	Amount *decimal.Decimal `json:"amount,omitempty"`
	// Unit - READ-ONLY; The unit of measure for the budget amount.
	Unit *string `json:"unit,omitempty"`
}

CurrentSpend the current amount of cost which is being tracked for a budget.

func (CurrentSpend) MarshalJSON

func (cs CurrentSpend) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for CurrentSpend.

type ErrorDetails

type ErrorDetails struct {
	// Code - READ-ONLY; Error code.
	Code *string `json:"code,omitempty"`
	// Message - READ-ONLY; Error message indicating why the operation failed.
	Message *string `json:"message,omitempty"`
}

ErrorDetails the details of the error.

func (ErrorDetails) MarshalJSON

func (ed ErrorDetails) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for ErrorDetails.

type ErrorResponse

type ErrorResponse struct {
	// Error - The details of the error.
	Error *ErrorDetails `json:"error,omitempty"`
}

ErrorResponse error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.

type Notification

type Notification struct {
	// Enabled - The notification is enabled or not.
	Enabled *bool `json:"enabled,omitempty"`
	// Operator - The comparison operator. Possible values include: 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo'
	Operator OperatorType `json:"operator,omitempty"`
	// Threshold - Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000.
	Threshold *decimal.Decimal `json:"threshold,omitempty"`
	// ContactEmails - Email addresses to send the budget notification to when the threshold is exceeded.
	ContactEmails *[]string `json:"contactEmails,omitempty"`
	// ContactRoles - Contact roles to send the budget notification to when the threshold is exceeded.
	ContactRoles *[]string `json:"contactRoles,omitempty"`
}

Notification the notification associated with a budget.

type Operation

type Operation struct {
	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
	Name *string `json:"name,omitempty"`
	// Display - The object that represents the operation.
	Display *OperationDisplay `json:"display,omitempty"`
}

Operation a Consumption REST API operation.

func (Operation) MarshalJSON

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

MarshalJSON is the custom marshaler for Operation.

type OperationDisplay

type OperationDisplay struct {
	// Provider - READ-ONLY; Service provider: Microsoft.Consumption.
	Provider *string `json:"provider,omitempty"`
	// Resource - READ-ONLY; Resource on which the operation is performed: UsageDetail, etc.
	Resource *string `json:"resource,omitempty"`
	// Operation - READ-ONLY; Operation type: Read, write, delete, etc.
	Operation *string `json:"operation,omitempty"`
}

OperationDisplay the object that represents the operation.

func (OperationDisplay) MarshalJSON

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

MarshalJSON is the custom marshaler for OperationDisplay.

type OperationListResult

type OperationListResult struct {
	autorest.Response `json:"-"`
	// Value - READ-ONLY; List of consumption operations supported by the Microsoft.Consumption resource provider.
	Value *[]Operation `json:"value,omitempty"`
	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
	NextLink *string `json:"nextLink,omitempty"`
}

OperationListResult result of listing consumption operations. It contains a list of operations and a URL link to get the next set of results.

func (OperationListResult) IsEmpty

func (olr OperationListResult) IsEmpty() bool

IsEmpty returns true if the ListResult contains no values.

func (OperationListResult) MarshalJSON

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

MarshalJSON is the custom marshaler for OperationListResult.

type OperationListResultIterator

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

OperationListResultIterator provides access to a complete listing of Operation values.

func NewOperationListResultIterator

func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator

Creates a new instance of the OperationListResultIterator type.

func (*OperationListResultIterator) Next

func (iter *OperationListResultIterator) Next() error

Next advances to the next value. If there was an error making the request the iterator does not advance and the error is returned. Deprecated: Use NextWithContext() instead.

func (*OperationListResultIterator) NextWithContext

func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next value. If there was an error making the request the iterator does not advance and the error is returned.

func (OperationListResultIterator) NotDone

func (iter OperationListResultIterator) NotDone() bool

NotDone returns true if the enumeration should be started or is not yet complete.

func (OperationListResultIterator) Response

Response returns the raw server response from the last page request.

func (OperationListResultIterator) Value

Value returns the current value or a zero-initialized value if the iterator has advanced beyond the end of the collection.

type OperationListResultPage

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

OperationListResultPage contains a page of Operation values.

func NewOperationListResultPage

func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage

Creates a new instance of the OperationListResultPage type.

func (*OperationListResultPage) Next

func (page *OperationListResultPage) Next() error

Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned. Deprecated: Use NextWithContext() instead.

func (*OperationListResultPage) NextWithContext

func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (OperationListResultPage) NotDone

func (page OperationListResultPage) NotDone() bool

NotDone returns true if the page enumeration should be started or is not yet complete.

func (OperationListResultPage) Response

Response returns the raw server response from the last page request.

func (OperationListResultPage) Values

func (page OperationListResultPage) Values() []Operation

Values returns the slice of values for the current page or nil if there are no values.

type OperationsClient

type OperationsClient struct {
	BaseClient
}

OperationsClient is the consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.

func NewOperationsClient

func NewOperationsClient(subscriptionID string, name string) OperationsClient

NewOperationsClient creates an instance of the OperationsClient client.

func NewOperationsClientWithBaseURI

func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, name string) OperationsClient

NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).

func (OperationsClient) List

func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error)

List lists all of the available consumption REST API operations.

func (OperationsClient) ListComplete

func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error)

ListComplete enumerates all values, automatically crossing page boundaries as required.

func (OperationsClient) ListPreparer

func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error)

ListPreparer prepares the List request.

func (OperationsClient) ListResponder

func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error)

ListResponder handles the response to the List request. The method always closes the http.Response Body.

func (OperationsClient) ListSender

func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error)

ListSender sends the List request. The method will close the http.Response Body if it receives an error.

type OperatorType

type OperatorType string

OperatorType enumerates the values for operator type.

const (
	// EqualTo ...
	EqualTo OperatorType = "EqualTo"
	// GreaterThan ...
	GreaterThan OperatorType = "GreaterThan"
	// GreaterThanOrEqualTo ...
	GreaterThanOrEqualTo OperatorType = "GreaterThanOrEqualTo"
)

func PossibleOperatorTypeValues

func PossibleOperatorTypeValues() []OperatorType

PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type.

type ProxyResource

type ProxyResource struct {
	// ID - READ-ONLY; Resource Id.
	ID *string `json:"id,omitempty"`
	// Name - READ-ONLY; Resource name.
	Name *string `json:"name,omitempty"`
	// Type - READ-ONLY; Resource type.
	Type *string `json:"type,omitempty"`
	// ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
	ETag *string `json:"eTag,omitempty"`
}

ProxyResource the Resource model definition.

func (ProxyResource) MarshalJSON

func (pr ProxyResource) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for ProxyResource.

type TimeGrainType

type TimeGrainType string

TimeGrainType enumerates the values for time grain type.

const (
	// Annually ...
	Annually TimeGrainType = "Annually"
	// Monthly ...
	Monthly TimeGrainType = "Monthly"
	// Quarterly ...
	Quarterly TimeGrainType = "Quarterly"
)

func PossibleTimeGrainTypeValues

func PossibleTimeGrainTypeValues() []TimeGrainType

PossibleTimeGrainTypeValues returns an array of possible values for the TimeGrainType const type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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