vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Package commerce implements the Azure ARM Commerce service API version
// 2015-06-01-preview.
//
//
package commerce
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Commerce
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Commerce.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+151
View File
@@ -0,0 +1,151 @@
package commerce
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/satori/uuid"
"github.com/shopspring/decimal"
"net/http"
)
// AggregationGranularity enumerates the values for aggregation granularity.
type AggregationGranularity string
const (
// Daily specifies the daily state for aggregation granularity.
Daily AggregationGranularity = "Daily"
// Hourly specifies the hourly state for aggregation granularity.
Hourly AggregationGranularity = "Hourly"
)
// ErrorResponse is describes the format of Error response.
type ErrorResponse struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// InfoField is key-value pairs of instance details in the legacy format.
type InfoField struct {
Project *string `json:"project,omitempty"`
}
// MeterInfo is detailed information about the meter.
type MeterInfo struct {
MeterID *uuid.UUID `json:"MeterId,omitempty"`
MeterName *string `json:"MeterName,omitempty"`
MeterCategory *string `json:"MeterCategory,omitempty"`
MeterSubCategory *string `json:"MeterSubCategory,omitempty"`
Unit *string `json:"Unit,omitempty"`
MeterTags *[]string `json:"MeterTags,omitempty"`
MeterRegion *string `json:"MeterRegion,omitempty"`
MeterRates *map[string]*float64 `json:"MeterRates,omitempty"`
EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
IncludedQuantity *float64 `json:"IncludedQuantity,omitempty"`
}
// MonetaryCommitment is indicates that a monetary commitment is required for
// this offer
type MonetaryCommitment struct {
EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
TieredDiscount *map[string]*decimal.Decimal `json:"TieredDiscount,omitempty"`
ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"`
}
// MonetaryCredit is indicates that this is a monetary credit offer.
type MonetaryCredit struct {
EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
Credit *decimal.Decimal `json:"Credit,omitempty"`
ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"`
}
// OfferTermInfo is describes the offer term.
type OfferTermInfo struct {
EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
}
// RateCardQueryParameters is parameters that are used in the odata $filter
// query parameter for providing RateCard information.
type RateCardQueryParameters struct {
OfferDurableID *string `json:"OfferDurableId,omitempty"`
Currency *string `json:"Currency,omitempty"`
Locale *string `json:"Locale,omitempty"`
RegionInfo *string `json:"RegionInfo,omitempty"`
}
// RecurringCharge is indicates a recurring charge is present for this offer.
type RecurringCharge struct {
EffectiveDate *date.Time `json:"EffectiveDate,omitempty"`
RecurringCharge *int32 `json:"RecurringCharge,omitempty"`
}
// ResourceRateCardInfo is price and Metadata information for resources
type ResourceRateCardInfo struct {
autorest.Response `json:"-"`
Currency *string `json:"Currency,omitempty"`
Locale *string `json:"Locale,omitempty"`
IsTaxIncluded *bool `json:"IsTaxIncluded,omitempty"`
OfferTerms *[]OfferTermInfo `json:"OfferTerms,omitempty"`
Meters *[]MeterInfo `json:"Meters,omitempty"`
}
// UsageAggregation is describes the usageAggregation.
type UsageAggregation struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*UsageSample `json:"properties,omitempty"`
}
// UsageAggregationListResult is the Get UsageAggregates operation response.
type UsageAggregationListResult struct {
autorest.Response `json:"-"`
Value *[]UsageAggregation `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// UsageAggregationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client UsageAggregationListResult) UsageAggregationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// UsageSample is describes a sample of the usageAggregation.
type UsageSample struct {
SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"`
MeterID *string `json:"meterId,omitempty"`
UsageStartTime *date.Time `json:"usageStartTime,omitempty"`
UsageEndTime *date.Time `json:"usageEndTime,omitempty"`
Quantity *map[string]interface{} `json:"quantity,omitempty"`
Unit *string `json:"unit,omitempty"`
MeterName *string `json:"meterName,omitempty"`
MeterCategory *string `json:"meterCategory,omitempty"`
MeterSubCategory *string `json:"meterSubCategory,omitempty"`
MeterRegion *string `json:"meterRegion,omitempty"`
InfoFields *InfoField `json:"infoFields,omitempty"`
InstanceData *string `json:"instanceData,omitempty"`
}
+117
View File
@@ -0,0 +1,117 @@
package commerce
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// RateCardClient is the client for the RateCard methods of the Commerce
// service.
type RateCardClient struct {
ManagementClient
}
// NewRateCardClient creates an instance of the RateCardClient client.
func NewRateCardClient(subscriptionID string) RateCardClient {
return NewRateCardClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewRateCardClientWithBaseURI creates an instance of the RateCardClient
// client.
func NewRateCardClientWithBaseURI(baseURI string, subscriptionID string) RateCardClient {
return RateCardClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// 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.
//
// filter is 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 (client RateCardClient) Get(filter string) (result ResourceRateCardInfo, err error) {
req, err := client.GetPreparer(filter)
if err != nil {
err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client RateCardClient) GetPreparer(filter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-06-01-preview"
queryParameters := map[string]interface{}{
"$filter": autorest.Encode("query", filter),
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client RateCardClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client RateCardClient) GetResponder(resp *http.Response) (result ResourceRateCardInfo, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+155
View File
@@ -0,0 +1,155 @@
package commerce
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"net/http"
)
// UsageAggregatesClient is the client for the UsageAggregates methods of the
// Commerce service.
type UsageAggregatesClient struct {
ManagementClient
}
// NewUsageAggregatesClient creates an instance of the UsageAggregatesClient
// client.
func NewUsageAggregatesClient(subscriptionID string) UsageAggregatesClient {
return NewUsageAggregatesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageAggregatesClientWithBaseURI creates an instance of the
// UsageAggregatesClient client.
func NewUsageAggregatesClientWithBaseURI(baseURI string, subscriptionID string) UsageAggregatesClient {
return UsageAggregatesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List query aggregated Azure subscription consumption data for a date range.
//
// reportedStartTime is the start of the time range to retrieve data for.
// reportedEndTime is the end of the time range to retrieve data for.
// showDetails is `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 is `Daily` (default) returns the data in daily
// granularity, `Hourly` returns the data in hourly granularity.
// continuationToken is 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 (client UsageAggregatesClient) List(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (result UsageAggregationListResult, err error) {
req, err := client.ListPreparer(reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken)
if err != nil {
err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageAggregatesClient) ListPreparer(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
"reportedEndTime": autorest.Encode("query", reportedEndTime),
"reportedStartTime": autorest.Encode("query", reportedStartTime),
}
if showDetails != nil {
queryParameters["showDetails"] = autorest.Encode("query", *showDetails)
}
if len(string(aggregationGranularity)) > 0 {
queryParameters["aggregationGranularity"] = autorest.Encode("query", aggregationGranularity)
}
if len(continuationToken) > 0 {
queryParameters["continuationToken"] = autorest.Encode("query", continuationToken)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageAggregatesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client UsageAggregatesClient) ListResponder(resp *http.Response) (result UsageAggregationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client UsageAggregatesClient) ListNextResults(lastResults UsageAggregationListResult) (result UsageAggregationListResult, err error) {
req, err := lastResults.UsageAggregationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to next results request")
}
return
}
+29
View File
@@ -0,0 +1,29 @@
package commerce
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.1.0-beta arm-commerce/2015-06-01-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}