Documentation ¶
Index ¶
- type AggregationGranularity
- type ClientFactory
- type ErrorResponse
- type InfoField
- type MeterInfo
- type MonetaryCommitment
- type MonetaryCredit
- type OfferTermInfo
- type OfferTermInfoAutoGenerated
- type OfferTermInfoAutoGeneratedClassification
- type RateCardClient
- type RateCardClientGetOptions
- type RateCardClientGetResponse
- type RateCardQueryParameters
- type RecurringCharge
- type ResourceRateCardInfo
- type UsageAggregatesClient
- type UsageAggregatesClientListOptions
- type UsageAggregatesClientListResponse
- type UsageAggregation
- type UsageAggregationListResult
- type UsageSample
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationGranularity ¶
type AggregationGranularity string
const ( AggregationGranularityDaily AggregationGranularity = "Daily" AggregationGranularityHourly AggregationGranularity = "Hourly" )
func PossibleAggregationGranularityValues ¶
func PossibleAggregationGranularityValues() []AggregationGranularity
PossibleAggregationGranularityValues returns the possible values for the AggregationGranularity const type.
type ClientFactory ¶
type ClientFactory struct {
// contains filtered or unexported fields
}
ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.
func NewClientFactory ¶
func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)
NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.
- subscriptionID - It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewRateCardClient ¶
func (c *ClientFactory) NewRateCardClient() *RateCardClient
NewRateCardClient creates a new instance of RateCardClient.
func (*ClientFactory) NewUsageAggregatesClient ¶
func (c *ClientFactory) NewUsageAggregatesClient() *UsageAggregatesClient
NewUsageAggregatesClient creates a new instance of UsageAggregatesClient.
type ErrorResponse ¶
type ErrorResponse struct { // Error code Code *string // Error message indicating why the operation failed. Message *string }
ErrorResponse - Describes the format of Error response.
func (ErrorResponse) MarshalJSON ¶
func (e ErrorResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ErrorResponse.
func (*ErrorResponse) UnmarshalJSON ¶
func (e *ErrorResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.
type InfoField ¶
type InfoField struct { // Identifies the name of the instance provisioned by the user. Project *string }
InfoField - Key-value pairs of instance details in the legacy format.
func (InfoField) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type InfoField.
func (*InfoField) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type InfoField.
type MeterInfo ¶
type MeterInfo struct { // Indicates the date from which the meter rate is effective. EffectiveDate *time.Time // The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be charged. IncludedQuantity *float32 // The category of the meter, e.g., 'Cloud services', 'Networking', etc.. MeterCategory *string // The unique identifier of the resource. MeterID *string // The name of the meter, within the given meter category MeterName *string // 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]*float32 // The region in which the Azure service is available. MeterRegion *string // The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. MeterSubCategory *string // Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party. MeterTags []*string // The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc. Unit *string }
MeterInfo - Detailed information about the meter.
func (MeterInfo) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type MeterInfo.
func (*MeterInfo) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type MeterInfo.
type MonetaryCommitment ¶
type MonetaryCommitment struct { // REQUIRED; Name of the offer term Name *OfferTermInfo // Indicates the date from which the offer term is effective. EffectiveDate *time.Time // An array of meter ids that are excluded from the given offer terms. ExcludedMeterIDs []*string // 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]*float64 }
MonetaryCommitment - Indicates that a monetary commitment is required for this offer
func (*MonetaryCommitment) GetOfferTermInfoAutoGenerated ¶
func (m *MonetaryCommitment) GetOfferTermInfoAutoGenerated() *OfferTermInfoAutoGenerated
GetOfferTermInfoAutoGenerated implements the OfferTermInfoAutoGeneratedClassification interface for type MonetaryCommitment.
func (MonetaryCommitment) MarshalJSON ¶
func (m MonetaryCommitment) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MonetaryCommitment.
func (*MonetaryCommitment) UnmarshalJSON ¶
func (m *MonetaryCommitment) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MonetaryCommitment.
type MonetaryCredit ¶
type MonetaryCredit struct { // REQUIRED; Name of the offer term Name *OfferTermInfo // The amount of credit provided under the terms of the given offer level. Credit *float64 // Indicates the date from which the offer term is effective. EffectiveDate *time.Time // An array of meter ids that are excluded from the given offer terms. ExcludedMeterIDs []*string }
MonetaryCredit - Indicates that this is a monetary credit offer.
func (*MonetaryCredit) GetOfferTermInfoAutoGenerated ¶
func (m *MonetaryCredit) GetOfferTermInfoAutoGenerated() *OfferTermInfoAutoGenerated
GetOfferTermInfoAutoGenerated implements the OfferTermInfoAutoGeneratedClassification interface for type MonetaryCredit.
func (MonetaryCredit) MarshalJSON ¶
func (m MonetaryCredit) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MonetaryCredit.
func (*MonetaryCredit) UnmarshalJSON ¶
func (m *MonetaryCredit) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MonetaryCredit.
type OfferTermInfo ¶
type OfferTermInfo string
OfferTermInfo - Name of the offer term
const ( OfferTermInfoMonetaryCommitment OfferTermInfo = "Monetary Commitment" OfferTermInfoMonetaryCredit OfferTermInfo = "Monetary Credit" OfferTermInfoRecurringCharge OfferTermInfo = "Recurring Charge" )
func PossibleOfferTermInfoValues ¶
func PossibleOfferTermInfoValues() []OfferTermInfo
PossibleOfferTermInfoValues returns the possible values for the OfferTermInfo const type.
type OfferTermInfoAutoGenerated ¶
type OfferTermInfoAutoGenerated struct { // REQUIRED; Name of the offer term Name *OfferTermInfo // Indicates the date from which the offer term is effective. EffectiveDate *time.Time }
OfferTermInfoAutoGenerated - Describes the offer term.
func (*OfferTermInfoAutoGenerated) GetOfferTermInfoAutoGenerated ¶
func (o *OfferTermInfoAutoGenerated) GetOfferTermInfoAutoGenerated() *OfferTermInfoAutoGenerated
GetOfferTermInfoAutoGenerated implements the OfferTermInfoAutoGeneratedClassification interface for type OfferTermInfoAutoGenerated.
func (OfferTermInfoAutoGenerated) MarshalJSON ¶
func (o OfferTermInfoAutoGenerated) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OfferTermInfoAutoGenerated.
func (*OfferTermInfoAutoGenerated) UnmarshalJSON ¶
func (o *OfferTermInfoAutoGenerated) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OfferTermInfoAutoGenerated.
type OfferTermInfoAutoGeneratedClassification ¶
type OfferTermInfoAutoGeneratedClassification interface { // GetOfferTermInfoAutoGenerated returns the OfferTermInfoAutoGenerated content of the underlying type. GetOfferTermInfoAutoGenerated() *OfferTermInfoAutoGenerated }
OfferTermInfoAutoGeneratedClassification provides polymorphic access to related types. Call the interface's GetOfferTermInfoAutoGenerated() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *MonetaryCommitment, *MonetaryCredit, *OfferTermInfoAutoGenerated, *RecurringCharge
type RateCardClient ¶
type RateCardClient struct {
// contains filtered or unexported fields
}
RateCardClient contains the methods for the RateCard group. Don't use this type directly, use NewRateCardClient() instead.
func NewRateCardClient ¶
func NewRateCardClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RateCardClient, error)
NewRateCardClient creates a new instance of RateCardClient with the specified values.
- subscriptionID - It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*RateCardClient) Get ¶
func (client *RateCardClient) Get(ctx context.Context, filter string, options *RateCardClientGetOptions) (RateCardClientGetResponse, 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. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2015-06-01-preview
- 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.
- options - RateCardClientGetOptions contains the optional parameters for the RateCardClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/commerce/resource-manager/Microsoft.Commerce/preview/2015-06-01-preview/examples/GetRateCard.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commerce/armcommerce" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armcommerce.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewRateCardClient().Get(ctx, "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.ResourceRateCardInfo = armcommerce.ResourceRateCardInfo{ // Meters: []*armcommerce.MeterInfo{ // { // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-01T00:00:00.000Z"); return t}()), // IncludedQuantity: to.Ptr[float32](0), // MeterCategory: to.Ptr("Test Category"), // MeterID: to.Ptr("1d7518e5-bc2f-4a93-9057-1b3047856645"), // MeterName: to.Ptr("Test Meter"), // MeterRates: map[string]*float32{ // "0": to.Ptr[float32](1.99), // "100": to.Ptr[float32](0.99), // }, // MeterRegion: to.Ptr("US West"), // MeterSubCategory: to.Ptr("Test Subcategory"), // MeterTags: []*string{ // to.Ptr("Third Party")}, // Unit: to.Ptr("Hours"), // }}, // OfferTerms: []armcommerce.OfferTermInfoAutoGeneratedClassification{ // }, // } }
Output:
type RateCardClientGetOptions ¶
type RateCardClientGetOptions struct { }
RateCardClientGetOptions contains the optional parameters for the RateCardClient.Get method.
type RateCardClientGetResponse ¶
type RateCardClientGetResponse struct { // Price and Metadata information for resources ResourceRateCardInfo }
RateCardClientGetResponse contains the response from method RateCardClient.Get.
type RateCardQueryParameters ¶
type RateCardQueryParameters struct { // REQUIRED; The currency in which the rates need to be provided. Currency *string // REQUIRED; The culture in which the resource metadata needs to be localized. Locale *string // REQUIRED; 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 // REQUIRED; 2 letter ISO code where the offer was purchased. RegionInfo *string }
RateCardQueryParameters - Parameters that are used in the odata $filter query parameter for providing RateCard information.
func (RateCardQueryParameters) MarshalJSON ¶
func (r RateCardQueryParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type RateCardQueryParameters.
func (*RateCardQueryParameters) UnmarshalJSON ¶
func (r *RateCardQueryParameters) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type RateCardQueryParameters.
type RecurringCharge ¶
type RecurringCharge struct { // REQUIRED; Name of the offer term Name *OfferTermInfo // Indicates the date from which the offer term is effective. EffectiveDate *time.Time // The amount of recurring charge as per the offer term. RecurringCharge *int32 }
RecurringCharge - Indicates a recurring charge is present for this offer.
func (*RecurringCharge) GetOfferTermInfoAutoGenerated ¶
func (r *RecurringCharge) GetOfferTermInfoAutoGenerated() *OfferTermInfoAutoGenerated
GetOfferTermInfoAutoGenerated implements the OfferTermInfoAutoGeneratedClassification interface for type RecurringCharge.
func (RecurringCharge) MarshalJSON ¶
func (r RecurringCharge) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type RecurringCharge.
func (*RecurringCharge) UnmarshalJSON ¶
func (r *RecurringCharge) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type RecurringCharge.
type ResourceRateCardInfo ¶
type ResourceRateCardInfo struct { // The currency in which the rates are provided. Currency *string // All rates are pretax, so this will always be returned as 'false'. IsTaxIncluded *bool // The culture in which the resource information is localized. Locale *string // A list of meters. Meters []*MeterInfo // A list of offer terms. OfferTerms []OfferTermInfoAutoGeneratedClassification }
ResourceRateCardInfo - Price and Metadata information for resources
func (ResourceRateCardInfo) MarshalJSON ¶
func (r ResourceRateCardInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ResourceRateCardInfo.
func (*ResourceRateCardInfo) UnmarshalJSON ¶
func (r *ResourceRateCardInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRateCardInfo.
type UsageAggregatesClient ¶
type UsageAggregatesClient struct {
// contains filtered or unexported fields
}
UsageAggregatesClient contains the methods for the UsageAggregates group. Don't use this type directly, use NewUsageAggregatesClient() instead.
func NewUsageAggregatesClient ¶
func NewUsageAggregatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsageAggregatesClient, error)
NewUsageAggregatesClient creates a new instance of UsageAggregatesClient with the specified values.
- subscriptionID - It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*UsageAggregatesClient) NewListPager ¶
func (client *UsageAggregatesClient) NewListPager(reportedStartTime time.Time, reportedEndTime time.Time, options *UsageAggregatesClientListOptions) *runtime.Pager[UsageAggregatesClientListResponse]
NewListPager - Query aggregated Azure subscription consumption data for a date range.
Generated from API version 2015-06-01-preview
- reportedStartTime - The start of the time range to retrieve data for.
- reportedEndTime - The end of the time range to retrieve data for.
- options - UsageAggregatesClientListOptions contains the optional parameters for the UsageAggregatesClient.NewListPager method.
type UsageAggregatesClientListOptions ¶
type UsageAggregatesClientListOptions struct { // Daily (default) returns the data in daily granularity, Hourly returns the data in hourly granularity. AggregationGranularity *AggregationGranularity // 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. ContinuationToken *string // 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). ShowDetails *bool }
UsageAggregatesClientListOptions contains the optional parameters for the UsageAggregatesClient.NewListPager method.
type UsageAggregatesClientListResponse ¶
type UsageAggregatesClientListResponse struct { // The Get UsageAggregates operation response. UsageAggregationListResult }
UsageAggregatesClientListResponse contains the response from method UsageAggregatesClient.NewListPager.
type UsageAggregation ¶
type UsageAggregation struct { // Unique Id for the usage aggregate. ID *string // Name of the usage aggregate. Name *string // Usage data. Properties *UsageSample // Type of the resource being returned. Type *string }
UsageAggregation - Describes the usageAggregation.
func (UsageAggregation) MarshalJSON ¶
func (u UsageAggregation) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UsageAggregation.
func (*UsageAggregation) UnmarshalJSON ¶
func (u *UsageAggregation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UsageAggregation.
type UsageAggregationListResult ¶
type UsageAggregationListResult struct { // Gets or sets the link to the next set of results. NextLink *string // Gets or sets details for the requested aggregation. Value []*UsageAggregation }
UsageAggregationListResult - The Get UsageAggregates operation response.
func (UsageAggregationListResult) MarshalJSON ¶
func (u UsageAggregationListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UsageAggregationListResult.
func (*UsageAggregationListResult) UnmarshalJSON ¶
func (u *UsageAggregationListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UsageAggregationListResult.
type UsageSample ¶
type UsageSample struct { // Key-value pairs of instance details (legacy format). InfoFields *InfoField // Key-value pairs of instance details represented as a string. InstanceData *string // Category of the consumed resource. MeterCategory *string // Unique ID for the resource that was consumed (aka ResourceID). MeterID *string // Friendly name of the resource being consumed. MeterName *string // Region of the meterId used for billing purposes MeterRegion *string // Sub-category of the consumed resource. MeterSubCategory *string // The amount of the resource consumption that occurred in this time frame. Quantity *float32 // The subscription identifier for the Azure user. SubscriptionID *string // The unit in which the usage for this resource is being counted, e.g. Hours, GB. Unit *string // UTC end time for the usage bucket to which this usage aggregate belongs. UsageEndTime *time.Time // UTC start time for the usage bucket to which this usage aggregate belongs. UsageStartTime *time.Time }
UsageSample - Describes a sample of the usageAggregation.
func (UsageSample) MarshalJSON ¶
func (u UsageSample) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type UsageSample.
func (*UsageSample) UnmarshalJSON ¶
func (u *UsageSample) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type UsageSample.