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
+56
View File
@@ -0,0 +1,56 @@
// Package consumption implements the Azure ARM Consumption service API version
// 2017-04-24-preview.
//
// Consumption management client provides access to consumption resources for
// Azure Web-Direct subscriptions. Other subscription types which were not
// purchased directly through the Azure web portal are not supported through
// this preview API.
package consumption
// 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 Consumption
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Consumption.
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,
}
}
+141
View File
@@ -0,0 +1,141 @@
package consumption
// 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/shopspring/decimal"
"net/http"
)
// ErrorDetails is the details of the error.
type ErrorDetails struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Target *string `json:"target,omitempty"`
}
// ErrorResponse is error response indicates that the service is not able to
// process the incoming request. The reason is provided in the error message.
type ErrorResponse struct {
Error *ErrorDetails `json:"error,omitempty"`
}
// MeterDetails is the properties of the meter detail.
type MeterDetails struct {
MeterName *string `json:"meterName,omitempty"`
MeterCategory *string `json:"meterCategory,omitempty"`
MeterSubCategory *string `json:"meterSubCategory,omitempty"`
Unit *string `json:"unit,omitempty"`
MeterLocation *string `json:"meterLocation,omitempty"`
TotalIncludedQuantity *decimal.Decimal `json:"totalIncludedQuantity,omitempty"`
PretaxStandardRate *decimal.Decimal `json:"pretaxStandardRate,omitempty"`
}
// Operation is a Consumption REST API operation.
type Operation struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay is the object that represents the operation.
type OperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
}
// OperationListResult is result of listing consumption operations. It contains
// a list of operations and a URL link to get the next set of results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationListResult) OperationListResultPreparer() (*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)))
}
// Resource is the Resource model definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// UsageDetail is an usage detail resource.
type UsageDetail struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*UsageDetailProperties `json:"properties,omitempty"`
}
// UsageDetailProperties is the properties of the usage detail.
type UsageDetailProperties struct {
BillingPeriodID *string `json:"billingPeriodId,omitempty"`
InvoiceID *string `json:"invoiceId,omitempty"`
UsageStart *date.Time `json:"usageStart,omitempty"`
UsageEnd *date.Time `json:"usageEnd,omitempty"`
InstanceName *string `json:"instanceName,omitempty"`
InstanceID *string `json:"instanceId,omitempty"`
InstanceLocation *string `json:"instanceLocation,omitempty"`
Currency *string `json:"currency,omitempty"`
UsageQuantity *decimal.Decimal `json:"usageQuantity,omitempty"`
BillableQuantity *decimal.Decimal `json:"billableQuantity,omitempty"`
PretaxCost *decimal.Decimal `json:"pretaxCost,omitempty"`
IsEstimated *bool `json:"isEstimated,omitempty"`
MeterID *string `json:"meterId,omitempty"`
MeterDetails *MeterDetails `json:"meterDetails,omitempty"`
AdditionalProperties *map[string]*string `json:"additionalProperties,omitempty"`
}
// UsageDetailsListResult is result of listing usage details. It contains a
// list of available usage details in reverse chronological order by billing
// period.
type UsageDetailsListResult struct {
autorest.Response `json:"-"`
Value *[]UsageDetail `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// UsageDetailsListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client UsageDetailsListResult) UsageDetailsListResultPreparer() (*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)))
}
+125
View File
@@ -0,0 +1,125 @@
package consumption
// 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"
)
// OperationsClient is the consumption management client provides access to
// consumption resources for Azure Web-Direct subscriptions. Other subscription
// types which were not purchased directly through the Azure web portal are not
// supported through this preview API.
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient
// client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all of the available consumption REST API operations.
func (client OperationsClient) List() (result OperationListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2017-04-24-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.Consumption/operations"),
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 OperationsClient) 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 OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, 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 OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.OperationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "consumption.OperationsClient", "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, "consumption.OperationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to next results request")
}
return
}
+170
View File
@@ -0,0 +1,170 @@
package consumption
// 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/validation"
"net/http"
)
// UsageDetailsClient is the consumption management client provides access to
// consumption resources for Azure Web-Direct subscriptions. Other subscription
// types which were not purchased directly through the Azure web portal are not
// supported through this preview API.
type UsageDetailsClient struct {
ManagementClient
}
// NewUsageDetailsClient creates an instance of the UsageDetailsClient client.
func NewUsageDetailsClient(subscriptionID string) UsageDetailsClient {
return NewUsageDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageDetailsClientWithBaseURI creates an instance of the
// UsageDetailsClient client.
func NewUsageDetailsClientWithBaseURI(baseURI string, subscriptionID string) UsageDetailsClient {
return UsageDetailsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists the usage details for a scope in reverse chronological order by
// billing period. Usage details are available via this API only for January 1,
// 2017 or later.
//
// scope is the scope of the usage details. The scope can be
// '/subscriptions/{subscriptionId}/' for a subscription, or
// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}'
// for an invoice or
// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
// for a billing perdiod. expand is may be used to expand the
// additionalProperties or meterDetails property within a list of usage
// details. By default, these fields are not included when listing usage
// details. filter is may be used to filter usageDetails by usageEnd (Utc
// time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
// not currently support 'ne', 'or', or 'not'. skiptoken is skiptoken is only
// used if a previous operation returned a partial result. If a previous
// response contains a nextLink element, the value of the nextLink element will
// include a skiptoken parameter that specifies a starting point to use for
// subsequent calls. top is may be used to limit the number of results to the
// most recent N usageDetails.
func (client UsageDetailsClient) List(scope string, expand string, filter string, skiptoken string, top *int32) (result UsageDetailsListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil},
{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "consumption.UsageDetailsClient", "List")
}
req, err := client.ListPreparer(scope, expand, filter, skiptoken, top)
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageDetailsClient) ListPreparer(scope string, expand string, filter string, skiptoken string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"scope": autorest.Encode("path", scope),
}
const APIVersion = "2017-04-24-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
if len(skiptoken) > 0 {
queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken)
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/{scope}/providers/Microsoft.Consumption/usageDetails", 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 UsageDetailsClient) 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 UsageDetailsClient) ListResponder(resp *http.Response) (result UsageDetailsListResult, 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 UsageDetailsClient) ListNextResults(lastResults UsageDetailsListResult) (result UsageDetailsListResult, err error) {
req, err := lastResults.UsageDetailsListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "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, "consumption.UsageDetailsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to next results request")
}
return
}
+29
View File
@@ -0,0 +1,29 @@
package consumption
// 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-consumption/2017-04-24-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}