budgets

package
v0.20241023.1122425 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MPL-2.0 Imports: 14 Imported by: 2

README

github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2021-10-01/budgets Documentation

The budgets SDK allows for interaction with Azure Resource Manager consumption (API Version 2021-10-01).

This readme covers example usages, but further information on using this SDK can be found in the project root.

Import Path

import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2021-10-01/budgets"

Client Initialization

client := budgets.NewBudgetsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: BudgetsClient.CreateOrUpdate

ctx := context.TODO()
id := budgets.NewScopedBudgetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "budgetName")

payload := budgets.Budget{
	// ...
}


read, err := client.CreateOrUpdate(ctx, id, payload)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: BudgetsClient.Delete

ctx := context.TODO()
id := budgets.NewScopedBudgetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "budgetName")

read, err := client.Delete(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: BudgetsClient.Get

ctx := context.TODO()
id := budgets.NewScopedBudgetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "budgetName")

read, err := client.Get(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: BudgetsClient.List

ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")

// alternatively `client.List(ctx, id)` can be used to do batched pagination
items, err := client.ListComplete(ctx, id)
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PossibleValuesForBudgetOperatorType

func PossibleValuesForBudgetOperatorType() []string

func PossibleValuesForCategoryType

func PossibleValuesForCategoryType() []string

func PossibleValuesForCultureCode

func PossibleValuesForCultureCode() []string

func PossibleValuesForOperatorType

func PossibleValuesForOperatorType() []string

func PossibleValuesForThresholdType

func PossibleValuesForThresholdType() []string

func PossibleValuesForTimeGrainType

func PossibleValuesForTimeGrainType() []string

func ValidateScopedBudgetID

func ValidateScopedBudgetID(input interface{}, key string) (warnings []string, errors []error)

ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID

Types

type Budget

type Budget struct {
	ETag       *string           `json:"eTag,omitempty"`
	Id         *string           `json:"id,omitempty"`
	Name       *string           `json:"name,omitempty"`
	Properties *BudgetProperties `json:"properties,omitempty"`
	Type       *string           `json:"type,omitempty"`
}

type BudgetComparisonExpression

type BudgetComparisonExpression struct {
	Name     string             `json:"name"`
	Operator BudgetOperatorType `json:"operator"`
	Values   []string           `json:"values"`
}

type BudgetFilter

type BudgetFilter struct {
	And        *[]BudgetFilterProperties   `json:"and,omitempty"`
	Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"`
	Tags       *BudgetComparisonExpression `json:"tags,omitempty"`
}

type BudgetFilterProperties

type BudgetFilterProperties struct {
	Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"`
	Tags       *BudgetComparisonExpression `json:"tags,omitempty"`
}

type BudgetOperationPredicate

type BudgetOperationPredicate struct {
	ETag *string
	Id   *string
	Name *string
	Type *string
}

func (BudgetOperationPredicate) Matches

func (p BudgetOperationPredicate) Matches(input Budget) bool

type BudgetOperatorType

type BudgetOperatorType string
const (
	BudgetOperatorTypeIn BudgetOperatorType = "In"
)

func (*BudgetOperatorType) UnmarshalJSON

func (s *BudgetOperatorType) UnmarshalJSON(bytes []byte) error

type BudgetProperties

type BudgetProperties struct {
	Amount        float64                  `json:"amount"`
	Category      CategoryType             `json:"category"`
	CurrentSpend  *CurrentSpend            `json:"currentSpend,omitempty"`
	Filter        *BudgetFilter            `json:"filter,omitempty"`
	ForecastSpend *ForecastSpend           `json:"forecastSpend,omitempty"`
	Notifications *map[string]Notification `json:"notifications,omitempty"`
	TimeGrain     TimeGrainType            `json:"timeGrain"`
	TimePeriod    BudgetTimePeriod         `json:"timePeriod"`
}

type BudgetTimePeriod

type BudgetTimePeriod struct {
	EndDate   *string `json:"endDate,omitempty"`
	StartDate string  `json:"startDate"`
}

func (*BudgetTimePeriod) GetEndDateAsTime

func (o *BudgetTimePeriod) GetEndDateAsTime() (*time.Time, error)

func (*BudgetTimePeriod) GetStartDateAsTime

func (o *BudgetTimePeriod) GetStartDateAsTime() (*time.Time, error)

func (*BudgetTimePeriod) SetEndDateAsTime

func (o *BudgetTimePeriod) SetEndDateAsTime(input time.Time)

func (*BudgetTimePeriod) SetStartDateAsTime

func (o *BudgetTimePeriod) SetStartDateAsTime(input time.Time)

type BudgetsClient

type BudgetsClient struct {
	Client *resourcemanager.Client
}

func NewBudgetsClientWithBaseURI

func NewBudgetsClientWithBaseURI(sdkApi sdkEnv.Api) (*BudgetsClient, error)

func (BudgetsClient) CreateOrUpdate

func (c BudgetsClient) CreateOrUpdate(ctx context.Context, id ScopedBudgetId, input Budget) (result CreateOrUpdateOperationResponse, err error)

CreateOrUpdate ...

func (BudgetsClient) Delete

func (c BudgetsClient) Delete(ctx context.Context, id ScopedBudgetId) (result DeleteOperationResponse, err error)

Delete ...

func (BudgetsClient) Get

Get ...

func (BudgetsClient) List

List ...

func (BudgetsClient) ListComplete

ListComplete retrieves all the results into a single object

func (BudgetsClient) ListCompleteMatchingPredicate

func (c BudgetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate BudgetOperationPredicate) (result ListCompleteResult, err error)

ListCompleteMatchingPredicate retrieves all the results and then applies the predicate

type CategoryType

type CategoryType string
const (
	CategoryTypeCost CategoryType = "Cost"
)

func (*CategoryType) UnmarshalJSON

func (s *CategoryType) UnmarshalJSON(bytes []byte) error

type CreateOrUpdateOperationResponse

type CreateOrUpdateOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Budget
}

type CultureCode

type CultureCode string
const (
	CultureCodeCsNegativecz CultureCode = "cs-cz"
	CultureCodeDaNegativedk CultureCode = "da-dk"
	CultureCodeDeNegativede CultureCode = "de-de"
	CultureCodeEnNegativegb CultureCode = "en-gb"
	CultureCodeEnNegativeus CultureCode = "en-us"
	CultureCodeEsNegativees CultureCode = "es-es"
	CultureCodeFrNegativefr CultureCode = "fr-fr"
	CultureCodeHuNegativehu CultureCode = "hu-hu"
	CultureCodeItNegativeit CultureCode = "it-it"
	CultureCodeJaNegativejp CultureCode = "ja-jp"
	CultureCodeKoNegativekr CultureCode = "ko-kr"
	CultureCodeNbNegativeno CultureCode = "nb-no"
	CultureCodeNlNegativenl CultureCode = "nl-nl"
	CultureCodePlNegativepl CultureCode = "pl-pl"
	CultureCodePtNegativebr CultureCode = "pt-br"
	CultureCodePtNegativept CultureCode = "pt-pt"
	CultureCodeRuNegativeru CultureCode = "ru-ru"
	CultureCodeSvNegativese CultureCode = "sv-se"
	CultureCodeTrNegativetr CultureCode = "tr-tr"
	CultureCodeZhNegativecn CultureCode = "zh-cn"
	CultureCodeZhNegativetw CultureCode = "zh-tw"
)

func (*CultureCode) UnmarshalJSON

func (s *CultureCode) UnmarshalJSON(bytes []byte) error

type CurrentSpend

type CurrentSpend struct {
	Amount *float64 `json:"amount,omitempty"`
	Unit   *string  `json:"unit,omitempty"`
}

type DeleteOperationResponse

type DeleteOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
}

type ForecastSpend

type ForecastSpend struct {
	Amount *float64 `json:"amount,omitempty"`
	Unit   *string  `json:"unit,omitempty"`
}

type GetOperationResponse

type GetOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Budget
}

type ListCompleteResult

type ListCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []Budget
}

type ListCustomPager added in v0.20240628.1153531

type ListCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListCustomPager) NextPageLink() *odata.Link

type ListOperationResponse

type ListOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]Budget
}

type Notification

type Notification struct {
	ContactEmails []string       `json:"contactEmails"`
	ContactGroups *[]string      `json:"contactGroups,omitempty"`
	ContactRoles  *[]string      `json:"contactRoles,omitempty"`
	Enabled       bool           `json:"enabled"`
	Locale        *CultureCode   `json:"locale,omitempty"`
	Operator      OperatorType   `json:"operator"`
	Threshold     float64        `json:"threshold"`
	ThresholdType *ThresholdType `json:"thresholdType,omitempty"`
}

type OperatorType

type OperatorType string
const (
	OperatorTypeEqualTo              OperatorType = "EqualTo"
	OperatorTypeGreaterThan          OperatorType = "GreaterThan"
	OperatorTypeGreaterThanOrEqualTo OperatorType = "GreaterThanOrEqualTo"
)

func (*OperatorType) UnmarshalJSON

func (s *OperatorType) UnmarshalJSON(bytes []byte) error

type ScopedBudgetId

type ScopedBudgetId struct {
	Scope      string
	BudgetName string
}

ScopedBudgetId is a struct representing the Resource ID for a Scoped Budget

func NewScopedBudgetID

func NewScopedBudgetID(scope string, budgetName string) ScopedBudgetId

NewScopedBudgetID returns a new ScopedBudgetId struct

func ParseScopedBudgetID

func ParseScopedBudgetID(input string) (*ScopedBudgetId, error)

ParseScopedBudgetID parses 'input' into a ScopedBudgetId

func ParseScopedBudgetIDInsensitively

func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error)

ParseScopedBudgetIDInsensitively parses 'input' case-insensitively into a ScopedBudgetId note: this method should only be used for API response data and not user input

func (*ScopedBudgetId) FromParseResult

func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error

func (ScopedBudgetId) ID

func (id ScopedBudgetId) ID() string

ID returns the formatted Scoped Budget ID

func (ScopedBudgetId) Segments

func (id ScopedBudgetId) Segments() []resourceids.Segment

Segments returns a slice of Resource ID Segments which comprise this Scoped Budget ID

func (ScopedBudgetId) String

func (id ScopedBudgetId) String() string

String returns a human-readable description of this Scoped Budget ID

type ThresholdType

type ThresholdType string
const (
	ThresholdTypeActual     ThresholdType = "Actual"
	ThresholdTypeForecasted ThresholdType = "Forecasted"
)

func (*ThresholdType) UnmarshalJSON

func (s *ThresholdType) UnmarshalJSON(bytes []byte) error

type TimeGrainType

type TimeGrainType string
const (
	TimeGrainTypeAnnually       TimeGrainType = "Annually"
	TimeGrainTypeBillingAnnual  TimeGrainType = "BillingAnnual"
	TimeGrainTypeBillingMonth   TimeGrainType = "BillingMonth"
	TimeGrainTypeBillingQuarter TimeGrainType = "BillingQuarter"
	TimeGrainTypeMonthly        TimeGrainType = "Monthly"
	TimeGrainTypeQuarterly      TimeGrainType = "Quarterly"
)

func (*TimeGrainType) UnmarshalJSON

func (s *TimeGrainType) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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