budgets

package
v0.20240311.1163512 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

README

github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2023-11-01/budgets Documentation

The budgets SDK allows for interaction with the Azure Resource Manager Service costmanagement (API Version 2023-11-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/costmanagement/2023-11-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", "budgetValue")

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", "budgetValue")

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", "budgetValue")

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, budgets.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, budgets.DefaultListOperationOptions())
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 PossibleValuesForBudgetNotificationOperatorType

func PossibleValuesForBudgetNotificationOperatorType() []string

func PossibleValuesForBudgetOperatorType

func PossibleValuesForBudgetOperatorType() []string

func PossibleValuesForCategoryType

func PossibleValuesForCategoryType() []string

func PossibleValuesForCultureCode

func PossibleValuesForCultureCode() []string

func PossibleValuesForFrequency

func PossibleValuesForFrequency() []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 BudgetNotificationOperatorType

type BudgetNotificationOperatorType string
const (
	BudgetNotificationOperatorTypeEqualTo              BudgetNotificationOperatorType = "EqualTo"
	BudgetNotificationOperatorTypeGreaterThan          BudgetNotificationOperatorType = "GreaterThan"
	BudgetNotificationOperatorTypeGreaterThanOrEqualTo BudgetNotificationOperatorType = "GreaterThanOrEqualTo"
	BudgetNotificationOperatorTypeLessThan             BudgetNotificationOperatorType = "LessThan"
)

func (*BudgetNotificationOperatorType) UnmarshalJSON

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

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,omitempty"`
	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, options ListOperationOptions, 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"
	CategoryTypeReservationUtilization CategoryType = "ReservationUtilization"
)

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 Frequency

type Frequency string
const (
	FrequencyDaily   Frequency = "Daily"
	FrequencyMonthly Frequency = "Monthly"
	FrequencyWeekly  Frequency = "Weekly"
)

func (*Frequency) UnmarshalJSON

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

type GetOperationResponse

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

type ListCompleteResult

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

type ListOperationOptions

type ListOperationOptions struct {
	Filter *string
}

func DefaultListOperationOptions

func DefaultListOperationOptions() ListOperationOptions

func (ListOperationOptions) ToHeaders

func (o ListOperationOptions) ToHeaders() *client.Headers

func (ListOperationOptions) ToOData

func (o ListOperationOptions) ToOData() *odata.Query

func (ListOperationOptions) ToQuery

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"`
	Frequency     *Frequency                     `json:"frequency,omitempty"`
	Locale        *CultureCode                   `json:"locale,omitempty"`
	Operator      BudgetNotificationOperatorType `json:"operator"`
	Threshold     float64                        `json:"threshold"`
	ThresholdType *ThresholdType                 `json:"thresholdType,omitempty"`
}

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"
	TimeGrainTypeLastSevenDays     TimeGrainType = "Last7Days"
	TimeGrainTypeLastThreeZeroDays TimeGrainType = "Last30Days"
	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