commerce

package
v19.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package commerce implements the Azure ARM Commerce service API version 2015-06-01-preview.

Index

Constants

View Source
const (
	// DefaultBaseURI is the default URI used for the service Commerce
	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 AggregationGranularity

type AggregationGranularity string

AggregationGranularity enumerates the values for aggregation granularity.

const (
	// Daily ...
	Daily AggregationGranularity = "Daily"
	// Hourly ...
	Hourly AggregationGranularity = "Hourly"
)

func PossibleAggregationGranularityValues

func PossibleAggregationGranularityValues() []AggregationGranularity

PossibleAggregationGranularityValues returns an array of possible values for the AggregationGranularity const type.

type BaseClient

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

BaseClient is the base client for Commerce.

func New

func New(subscriptionID string) BaseClient

New creates an instance of the BaseClient client.

func NewWithBaseURI

func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient

NewWithBaseURI creates an instance of the BaseClient client.

type BasicOfferTermInfo

type BasicOfferTermInfo interface {
	AsMonetaryCredit() (*MonetaryCredit, bool)
	AsMonetaryCommitment() (*MonetaryCommitment, bool)
	AsRecurringCharge() (*RecurringCharge, bool)
	AsOfferTermInfo() (*OfferTermInfo, bool)
}

BasicOfferTermInfo describes the offer term.

type ErrorResponse

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

ErrorResponse describes the format of Error response.

type InfoField

type InfoField struct {
	// Project - Identifies the name of the instance provisioned by the user.
	Project *string `json:"project,omitempty"`
}

InfoField key-value pairs of instance details in the legacy format.

type MeterInfo

type MeterInfo struct {
	// MeterID - The unique identifier of the resource.
	MeterID *uuid.UUID `json:"MeterId,omitempty"`
	// MeterName - The name of the meter, within the given meter category
	MeterName *string `json:"MeterName,omitempty"`
	// MeterCategory - The category of the meter, e.g., 'Cloud services', 'Networking', etc..
	MeterCategory *string `json:"MeterCategory,omitempty"`
	// MeterSubCategory - The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc..
	MeterSubCategory *string `json:"MeterSubCategory,omitempty"`
	// Unit - The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc.
	Unit *string `json:"Unit,omitempty"`
	// MeterTags - Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party.
	MeterTags *[]string `json:"MeterTags,omitempty"`
	// MeterRegion - The region in which the Azure service is available.
	MeterRegion *string `json:"MeterRegion,omitempty"`
	// MeterRates - The list of key/value pairs for the meter rates, in the format 'key':'value' where key = the meter quantity, and value = the corresponding price
	MeterRates map[string]*float64 `json:"MeterRates"`
	// EffectiveDate - Indicates the date from which the meter rate is effective.
	EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
	// IncludedQuantity - The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be charged.
	IncludedQuantity *float64 `json:"IncludedQuantity,omitempty"`
}

MeterInfo detailed information about the meter.

func (MeterInfo) MarshalJSON

func (mi MeterInfo) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for MeterInfo.

type MonetaryCommitment

type MonetaryCommitment struct {
	// TieredDiscount - The list of key/value pairs for the tiered meter rates, in the format 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by offer terms of type 'Monetary Commitment'.
	TieredDiscount map[string]*decimal.Decimal `json:"TieredDiscount"`
	// ExcludedMeterIds - An array of meter ids that are excluded from the given offer terms.
	ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"`
	// EffectiveDate - Indicates the date from which the offer term is effective.
	EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
	// Name - Possible values include: 'NameOfferTermInfo', 'NameMonetaryCredit', 'NameMonetaryCommitment', 'NameRecurringCharge'
	Name Name `json:"Name,omitempty"`
}

MonetaryCommitment indicates that a monetary commitment is required for this offer

func (MonetaryCommitment) AsBasicOfferTermInfo

func (mc MonetaryCommitment) AsBasicOfferTermInfo() (BasicOfferTermInfo, bool)

AsBasicOfferTermInfo is the BasicOfferTermInfo implementation for MonetaryCommitment.

func (MonetaryCommitment) AsMonetaryCommitment

func (mc MonetaryCommitment) AsMonetaryCommitment() (*MonetaryCommitment, bool)

AsMonetaryCommitment is the BasicOfferTermInfo implementation for MonetaryCommitment.

func (MonetaryCommitment) AsMonetaryCredit

func (mc MonetaryCommitment) AsMonetaryCredit() (*MonetaryCredit, bool)

AsMonetaryCredit is the BasicOfferTermInfo implementation for MonetaryCommitment.

func (MonetaryCommitment) AsOfferTermInfo

func (mc MonetaryCommitment) AsOfferTermInfo() (*OfferTermInfo, bool)

AsOfferTermInfo is the BasicOfferTermInfo implementation for MonetaryCommitment.

func (MonetaryCommitment) AsRecurringCharge

func (mc MonetaryCommitment) AsRecurringCharge() (*RecurringCharge, bool)

AsRecurringCharge is the BasicOfferTermInfo implementation for MonetaryCommitment.

func (MonetaryCommitment) MarshalJSON

func (mc MonetaryCommitment) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for MonetaryCommitment.

type MonetaryCredit

type MonetaryCredit struct {
	// Credit - The amount of credit provided under the terms of the given offer level.
	Credit *decimal.Decimal `json:"Credit,omitempty"`
	// ExcludedMeterIds - An array of meter ids that are excluded from the given offer terms.
	ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"`
	// EffectiveDate - Indicates the date from which the offer term is effective.
	EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
	// Name - Possible values include: 'NameOfferTermInfo', 'NameMonetaryCredit', 'NameMonetaryCommitment', 'NameRecurringCharge'
	Name Name `json:"Name,omitempty"`
}

MonetaryCredit indicates that this is a monetary credit offer.

func (MonetaryCredit) AsBasicOfferTermInfo

func (mc MonetaryCredit) AsBasicOfferTermInfo() (BasicOfferTermInfo, bool)

AsBasicOfferTermInfo is the BasicOfferTermInfo implementation for MonetaryCredit.

func (MonetaryCredit) AsMonetaryCommitment

func (mc MonetaryCredit) AsMonetaryCommitment() (*MonetaryCommitment, bool)

AsMonetaryCommitment is the BasicOfferTermInfo implementation for MonetaryCredit.

func (MonetaryCredit) AsMonetaryCredit

func (mc MonetaryCredit) AsMonetaryCredit() (*MonetaryCredit, bool)

AsMonetaryCredit is the BasicOfferTermInfo implementation for MonetaryCredit.

func (MonetaryCredit) AsOfferTermInfo

func (mc MonetaryCredit) AsOfferTermInfo() (*OfferTermInfo, bool)

AsOfferTermInfo is the BasicOfferTermInfo implementation for MonetaryCredit.

func (MonetaryCredit) AsRecurringCharge

func (mc MonetaryCredit) AsRecurringCharge() (*RecurringCharge, bool)

AsRecurringCharge is the BasicOfferTermInfo implementation for MonetaryCredit.

func (MonetaryCredit) MarshalJSON

func (mc MonetaryCredit) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for MonetaryCredit.

type Name

type Name string

Name enumerates the values for name.

const (
	// NameMonetaryCommitment ...
	NameMonetaryCommitment Name = "Monetary Commitment"
	// NameMonetaryCredit ...
	NameMonetaryCredit Name = "Monetary Credit"
	// NameOfferTermInfo ...
	NameOfferTermInfo Name = "OfferTermInfo"
	// NameRecurringCharge ...
	NameRecurringCharge Name = "Recurring Charge"
)

func PossibleNameValues

func PossibleNameValues() []Name

PossibleNameValues returns an array of possible values for the Name const type.

type OfferTermInfo

type OfferTermInfo struct {
	// EffectiveDate - Indicates the date from which the offer term is effective.
	EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
	// Name - Possible values include: 'NameOfferTermInfo', 'NameMonetaryCredit', 'NameMonetaryCommitment', 'NameRecurringCharge'
	Name Name `json:"Name,omitempty"`
}

OfferTermInfo describes the offer term.

func (OfferTermInfo) AsBasicOfferTermInfo

func (oti OfferTermInfo) AsBasicOfferTermInfo() (BasicOfferTermInfo, bool)

AsBasicOfferTermInfo is the BasicOfferTermInfo implementation for OfferTermInfo.

func (OfferTermInfo) AsMonetaryCommitment

func (oti OfferTermInfo) AsMonetaryCommitment() (*MonetaryCommitment, bool)

AsMonetaryCommitment is the BasicOfferTermInfo implementation for OfferTermInfo.

func (OfferTermInfo) AsMonetaryCredit

func (oti OfferTermInfo) AsMonetaryCredit() (*MonetaryCredit, bool)

AsMonetaryCredit is the BasicOfferTermInfo implementation for OfferTermInfo.

func (OfferTermInfo) AsOfferTermInfo

func (oti OfferTermInfo) AsOfferTermInfo() (*OfferTermInfo, bool)

AsOfferTermInfo is the BasicOfferTermInfo implementation for OfferTermInfo.

func (OfferTermInfo) AsRecurringCharge

func (oti OfferTermInfo) AsRecurringCharge() (*RecurringCharge, bool)

AsRecurringCharge is the BasicOfferTermInfo implementation for OfferTermInfo.

func (OfferTermInfo) MarshalJSON

func (oti OfferTermInfo) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for OfferTermInfo.

type RateCardClient

type RateCardClient struct {
	BaseClient
}

RateCardClient is the client for the RateCard methods of the Commerce service.

func NewRateCardClient

func NewRateCardClient(subscriptionID string) RateCardClient

NewRateCardClient creates an instance of the RateCardClient client.

func NewRateCardClientWithBaseURI

func NewRateCardClientWithBaseURI(baseURI string, subscriptionID string) RateCardClient

NewRateCardClientWithBaseURI creates an instance of the RateCardClient client.

func (RateCardClient) Get

func (client RateCardClient) Get(ctx context.Context, filter string) (result ResourceRateCardInfo, err error)

Get enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. Parameters: filter - the filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part of the $filter.

func (RateCardClient) GetPreparer

func (client RateCardClient) GetPreparer(ctx context.Context, filter string) (*http.Request, error)

GetPreparer prepares the Get request.

func (RateCardClient) GetResponder

func (client RateCardClient) GetResponder(resp *http.Response) (result ResourceRateCardInfo, err error)

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

func (RateCardClient) GetSender

func (client RateCardClient) 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.

type RateCardQueryParameters

type RateCardQueryParameters struct {
	// OfferDurableID - The Offer ID parameter consists of the 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See https://azure.microsoft.com/en-us/support/legal/offer-details/ for more information on the list of available Offer IDs, country/region availability, and billing currency.
	OfferDurableID *string `json:"OfferDurableId,omitempty"`
	// Currency - The currency in which the rates need to be provided.
	Currency *string `json:"Currency,omitempty"`
	// Locale - The culture in which the resource metadata needs to be localized.
	Locale *string `json:"Locale,omitempty"`
	// RegionInfo - 2 letter ISO code where the offer was purchased.
	RegionInfo *string `json:"RegionInfo,omitempty"`
}

RateCardQueryParameters parameters that are used in the odata $filter query parameter for providing RateCard information.

type RecurringCharge

type RecurringCharge struct {
	// RecurringCharge - The amount of recurring charge as per the offer term.
	RecurringCharge *int32 `json:"RecurringCharge,omitempty"`
	// EffectiveDate - Indicates the date from which the offer term is effective.
	EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
	// Name - Possible values include: 'NameOfferTermInfo', 'NameMonetaryCredit', 'NameMonetaryCommitment', 'NameRecurringCharge'
	Name Name `json:"Name,omitempty"`
}

RecurringCharge indicates a recurring charge is present for this offer.

func (RecurringCharge) AsBasicOfferTermInfo

func (rc RecurringCharge) AsBasicOfferTermInfo() (BasicOfferTermInfo, bool)

AsBasicOfferTermInfo is the BasicOfferTermInfo implementation for RecurringCharge.

func (RecurringCharge) AsMonetaryCommitment

func (rc RecurringCharge) AsMonetaryCommitment() (*MonetaryCommitment, bool)

AsMonetaryCommitment is the BasicOfferTermInfo implementation for RecurringCharge.

func (RecurringCharge) AsMonetaryCredit

func (rc RecurringCharge) AsMonetaryCredit() (*MonetaryCredit, bool)

AsMonetaryCredit is the BasicOfferTermInfo implementation for RecurringCharge.

func (RecurringCharge) AsOfferTermInfo

func (rc RecurringCharge) AsOfferTermInfo() (*OfferTermInfo, bool)

AsOfferTermInfo is the BasicOfferTermInfo implementation for RecurringCharge.

func (RecurringCharge) AsRecurringCharge

func (rc RecurringCharge) AsRecurringCharge() (*RecurringCharge, bool)

AsRecurringCharge is the BasicOfferTermInfo implementation for RecurringCharge.

func (RecurringCharge) MarshalJSON

func (rc RecurringCharge) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for RecurringCharge.

type ResourceRateCardInfo

type ResourceRateCardInfo struct {
	autorest.Response `json:"-"`
	// Currency - The currency in which the rates are provided.
	Currency *string `json:"Currency,omitempty"`
	// Locale - The culture in which the resource information is localized.
	Locale *string `json:"Locale,omitempty"`
	// IsTaxIncluded - All rates are pretax, so this will always be returned as 'false'.
	IsTaxIncluded *bool `json:"IsTaxIncluded,omitempty"`
	// OfferTerms - A list of offer terms.
	OfferTerms *[]BasicOfferTermInfo `json:"OfferTerms,omitempty"`
	// Meters - A list of meters.
	Meters *[]MeterInfo `json:"Meters,omitempty"`
}

ResourceRateCardInfo price and Metadata information for resources

func (*ResourceRateCardInfo) UnmarshalJSON

func (rrci *ResourceRateCardInfo) UnmarshalJSON(body []byte) error

UnmarshalJSON is the custom unmarshaler for ResourceRateCardInfo struct.

type UsageAggregatesClient

type UsageAggregatesClient struct {
	BaseClient
}

UsageAggregatesClient is the client for the UsageAggregates methods of the Commerce service.

func NewUsageAggregatesClient

func NewUsageAggregatesClient(subscriptionID string) UsageAggregatesClient

NewUsageAggregatesClient creates an instance of the UsageAggregatesClient client.

func NewUsageAggregatesClientWithBaseURI

func NewUsageAggregatesClientWithBaseURI(baseURI string, subscriptionID string) UsageAggregatesClient

NewUsageAggregatesClientWithBaseURI creates an instance of the UsageAggregatesClient client.

func (UsageAggregatesClient) List

func (client UsageAggregatesClient) List(ctx context.Context, reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (result UsageAggregationListResultPage, err error)

List query aggregated Azure subscription consumption data for a date range. Parameters: reportedStartTime - the start of the time range to retrieve data for. reportedEndTime - the end of the time range to retrieve data for. showDetails - `True` returns usage data in instance-level detail, `false` causes server-side aggregation with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for website consumption. If you specify showDetails = false, the data will be aggregated as a single line item for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and usageEndTime). aggregationGranularity - `Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity. continuationToken - used when a continuation token string is provided in the response body of the previous call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of the day/hour (based on the granularity) passed in.

func (UsageAggregatesClient) ListComplete

func (client UsageAggregatesClient) ListComplete(ctx context.Context, reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (result UsageAggregationListResultIterator, err error)

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

func (UsageAggregatesClient) ListPreparer

func (client UsageAggregatesClient) ListPreparer(ctx context.Context, reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (*http.Request, error)

ListPreparer prepares the List request.

func (UsageAggregatesClient) ListResponder

func (client UsageAggregatesClient) ListResponder(resp *http.Response) (result UsageAggregationListResult, err error)

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

func (UsageAggregatesClient) ListSender

func (client UsageAggregatesClient) 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 UsageAggregation

type UsageAggregation struct {
	// ID - Unique Id for the usage aggregate.
	ID *string `json:"id,omitempty"`
	// Name - Name of the usage aggregate.
	Name *string `json:"name,omitempty"`
	// Type - Type of the resource being returned.
	Type *string `json:"type,omitempty"`
	// UsageSample - Usage data.
	*UsageSample `json:"properties,omitempty"`
}

UsageAggregation describes the usageAggregation.

func (UsageAggregation) MarshalJSON

func (ua UsageAggregation) MarshalJSON() ([]byte, error)

MarshalJSON is the custom marshaler for UsageAggregation.

func (*UsageAggregation) UnmarshalJSON

func (ua *UsageAggregation) UnmarshalJSON(body []byte) error

UnmarshalJSON is the custom unmarshaler for UsageAggregation struct.

type UsageAggregationListResult

type UsageAggregationListResult struct {
	autorest.Response `json:"-"`
	// Value - Gets or sets details for the requested aggregation.
	Value *[]UsageAggregation `json:"value,omitempty"`
	// NextLink - Gets or sets the link to the next set of results.
	NextLink *string `json:"nextLink,omitempty"`
}

UsageAggregationListResult the Get UsageAggregates operation response.

func (UsageAggregationListResult) IsEmpty

func (ualr UsageAggregationListResult) IsEmpty() bool

IsEmpty returns true if the ListResult contains no values.

type UsageAggregationListResultIterator

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

UsageAggregationListResultIterator provides access to a complete listing of UsageAggregation values.

func (*UsageAggregationListResultIterator) Next

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

func (UsageAggregationListResultIterator) NotDone

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

func (UsageAggregationListResultIterator) Response

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

func (UsageAggregationListResultIterator) Value

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

type UsageAggregationListResultPage

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

UsageAggregationListResultPage contains a page of UsageAggregation values.

func (*UsageAggregationListResultPage) Next

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.

func (UsageAggregationListResultPage) NotDone

func (page UsageAggregationListResultPage) NotDone() bool

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

func (UsageAggregationListResultPage) Response

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

func (UsageAggregationListResultPage) Values

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

type UsageSample

type UsageSample struct {
	// SubscriptionID - The subscription identifier for the Azure user.
	SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"`
	// MeterID - Unique ID for the resource that was consumed (aka ResourceID).
	MeterID *string `json:"meterId,omitempty"`
	// UsageStartTime - UTC start time for the usage bucket to which this usage aggregate belongs.
	UsageStartTime *date.Time `json:"usageStartTime,omitempty"`
	// UsageEndTime - UTC end time for the usage bucket to which this usage aggregate belongs.
	UsageEndTime *date.Time `json:"usageEndTime,omitempty"`
	// Quantity - The amount of the resource consumption that occurred in this time frame.
	Quantity *float64 `json:"quantity,omitempty"`
	// Unit - The unit in which the usage for this resource is being counted, e.g. Hours, GB.
	Unit *string `json:"unit,omitempty"`
	// MeterName - Friendly name of the resource being consumed.
	MeterName *string `json:"meterName,omitempty"`
	// MeterCategory - Category of the consumed resource.
	MeterCategory *string `json:"meterCategory,omitempty"`
	// MeterSubCategory - Sub-category of the consumed resource.
	MeterSubCategory *string `json:"meterSubCategory,omitempty"`
	// MeterRegion - Region of the meterId used for billing purposes
	MeterRegion *string `json:"meterRegion,omitempty"`
	// InfoFields - Key-value pairs of instance details (legacy format).
	InfoFields *InfoField `json:"infoFields,omitempty"`
	// InstanceData - Key-value pairs of instance details represented as a string.
	InstanceData *string `json:"instanceData,omitempty"`
}

UsageSample describes a sample of the usageAggregation.

Jump to

Keyboard shortcuts

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