From 1ff21e399e90697a0596489637cbbd86bba383eb Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Mar 2018 21:05:11 +0000 Subject: [PATCH 1/3] Generated from 2c9ced71b2b53f7039ec9ddbcbe4f23f05897e89 Adding reference to readme.md --- services/web/mgmt/2016-09-01/web/global.go | 102 +++++++++++++++++++++ services/web/mgmt/2016-09-01/web/models.go | 20 ++++ 2 files changed, 122 insertions(+) create mode 100644 services/web/mgmt/2016-09-01/web/global.go diff --git a/services/web/mgmt/2016-09-01/web/global.go b/services/web/mgmt/2016-09-01/web/global.go new file mode 100644 index 000000000000..11459045b607 --- /dev/null +++ b/services/web/mgmt/2016-09-01/web/global.go @@ -0,0 +1,102 @@ +package web + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// GlobalClient is the webSite Management Client +type GlobalClient struct { + BaseClient +} + +// NewGlobalClient creates an instance of the GlobalClient client. +func NewGlobalClient(subscriptionID string) GlobalClient { + return NewGlobalClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGlobalClientWithBaseURI creates an instance of the GlobalClient client. +func NewGlobalClientWithBaseURI(baseURI string, subscriptionID string) GlobalClient { + return GlobalClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetBillingMeters gets a list of meters for a given location. +func (client GlobalClient) GetBillingMeters(ctx context.Context) (result ListBillingMeter, err error) { + req, err := client.GetBillingMetersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", nil, "Failure preparing request") + return + } + + resp, err := client.GetBillingMetersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", resp, "Failure sending request") + return + } + + result, err = client.GetBillingMetersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", resp, "Failure responding to request") + } + + return +} + +// GetBillingMetersPreparer prepares the GetBillingMeters request. +func (client GlobalClient) GetBillingMetersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBillingMetersSender sends the GetBillingMeters request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalClient) GetBillingMetersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetBillingMetersResponder handles the response to the GetBillingMeters request. The method always +// closes the http.Response Body. +func (client GlobalClient) GetBillingMetersResponder(resp *http.Response) (result ListBillingMeter, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/web/mgmt/2016-09-01/web/models.go b/services/web/mgmt/2016-09-01/web/models.go index b807de3a1208..00575fc19d2b 100644 --- a/services/web/mgmt/2016-09-01/web/models.go +++ b/services/web/mgmt/2016-09-01/web/models.go @@ -5408,6 +5408,20 @@ type BackupSchedule struct { LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` } +// BillingMeter billing meter. +type BillingMeter struct { + // MeterID - Meter GUID onboarded in Commerce + MeterID *string `json:"meterId,omitempty"` + // BillingLocation - CSM Location + BillingLocation *string `json:"billingLocation,omitempty"` + // ShortName - Short Name from Azure pricing Page + ShortName *string `json:"shortName,omitempty"` + // FriendlyName - Meter Resource Name + FriendlyName *string `json:"friendlyName,omitempty"` + // ResourceType - ResourceType meter used for + ResourceType *string `json:"resourceType,omitempty"` +} + // Capability describes the capabilities/features allowed for a specific SKU. type Capability struct { // Name - Name of the SKU capability. @@ -10596,6 +10610,12 @@ func (j JobProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ListBillingMeter ... +type ListBillingMeter struct { + autorest.Response `json:"-"` + Value *[]BillingMeter `json:"value,omitempty"` +} + // ListCapability ... type ListCapability struct { autorest.Response `json:"-"` From 049d098668ebc08858ab0db1e2080449ce1167e3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 01:09:07 +0000 Subject: [PATCH 2/3] Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs --- services/web/mgmt/2016-09-01/web/apps.go | 59 +---- .../web/mgmt/2016-09-01/web/billingmeters.go | 135 +++++++++++ services/web/mgmt/2016-09-01/web/global.go | 102 --------- services/web/mgmt/2016-09-01/web/models.go | 214 +++++++++++++++++- 4 files changed, 350 insertions(+), 160 deletions(-) create mode 100644 services/web/mgmt/2016-09-01/web/billingmeters.go delete mode 100644 services/web/mgmt/2016-09-01/web/global.go diff --git a/services/web/mgmt/2016-09-01/web/apps.go b/services/web/mgmt/2016-09-01/web/apps.go index 538573f1b651..1159b5edb59f 100644 --- a/services/web/mgmt/2016-09-01/web/apps.go +++ b/services/web/mgmt/2016-09-01/web/apps.go @@ -1338,12 +1338,8 @@ func (client AppsClient) CreateMSDeployOperationSlotResponder(resp *http.Respons // // resourceGroupName is name of the resource group to which the resource belongs. name is unique name of the app to // create or update. To create or update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. skipDNSRegistration is if true web app hostname is not -// registered with DNS on creation. This parameter is -// only used for app creation. skipCustomDomainVerification is if true, custom (non *.azurewebsites.net) domains -// associated with web app are not verified. forceDNSRegistration is if true, web app hostname is force registered -// with DNS. TTLInSeconds is time to live in seconds for web app's default domain name. -func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (result AppsCreateOrUpdateFuture, err error) { +// representation of the app properties. See example. +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (result AppsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -1367,7 +1363,7 @@ func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName s return result, validation.NewError("web.AppsClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -1383,7 +1379,7 @@ func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName s } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (*http.Request, error) { +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -1394,18 +1390,6 @@ func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGro queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - if skipCustomDomainVerification != nil { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) - } - if forceDNSRegistration != nil { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) - } - if len(TTLInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) - } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -3031,8 +3015,8 @@ func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Re // resourceGroupName is name of the resource group to which the resource belongs. name is name of the app to // delete. deleteMetrics is if true, web app metrics are also deleted. deleteEmptyServerFarm is specify true if the // App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, -// the empty App Service plan is not deleted. skipDNSRegistration is if true, DNS registration is skipped. -func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { +// the empty App Service plan is not deleted. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -3041,7 +3025,7 @@ func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, n return result, validation.NewError("web.AppsClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) + req, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") return @@ -3063,7 +3047,7 @@ func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, n } // DeletePreparer prepares the Delete request. -func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -3080,9 +3064,6 @@ func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName s if deleteEmptyServerFarm != nil { queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } preparer := autorest.CreatePreparer( autorest.AsDelete(), @@ -23369,12 +23350,8 @@ func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (resul // // resourceGroupName is name of the resource group to which the resource belongs. name is unique name of the app to // create or update. To create or update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. skipDNSRegistration is if true web app hostname is not -// registered with DNS on creation. This parameter is -// only used for app creation. skipCustomDomainVerification is if true, custom (non *.azurewebsites.net) domains -// associated with web app are not verified. forceDNSRegistration is if true, web app hostname is force registered -// with DNS. TTLInSeconds is time to live in seconds for web app's default domain name. -func (client AppsClient) Update(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (result Site, err error) { +// representation of the app properties. See example. +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (result Site, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -23383,7 +23360,7 @@ func (client AppsClient) Update(ctx context.Context, resourceGroupName string, n return result, validation.NewError("web.AppsClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds) + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "Update", nil, "Failure preparing request") return @@ -23405,7 +23382,7 @@ func (client AppsClient) Update(ctx context.Context, resourceGroupName string, n } // UpdatePreparer prepares the Update request. -func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (*http.Request, error) { +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -23416,18 +23393,6 @@ func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName s queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - if skipCustomDomainVerification != nil { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) - } - if forceDNSRegistration != nil { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) - } - if len(TTLInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) - } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), diff --git a/services/web/mgmt/2016-09-01/web/billingmeters.go b/services/web/mgmt/2016-09-01/web/billingmeters.go new file mode 100644 index 000000000000..c1043768b341 --- /dev/null +++ b/services/web/mgmt/2016-09-01/web/billingmeters.go @@ -0,0 +1,135 @@ +package web + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BillingMetersClient is the webSite Management Client +type BillingMetersClient struct { + BaseClient +} + +// NewBillingMetersClient creates an instance of the BillingMetersClient client. +func NewBillingMetersClient(subscriptionID string) BillingMetersClient { + return NewBillingMetersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBillingMetersClientWithBaseURI creates an instance of the BillingMetersClient client. +func NewBillingMetersClientWithBaseURI(baseURI string, subscriptionID string) BillingMetersClient { + return BillingMetersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of meters for a given location. +// +// billingLocation is azure Location of billable resource +func (client BillingMetersClient) List(ctx context.Context, billingLocation string) (result BillingMeterCollectionPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, billingLocation) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BillingMetersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BillingMetersClient", "List", resp, "Failure sending request") + return + } + + result.bmc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BillingMetersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BillingMetersClient) ListPreparer(ctx context.Context, billingLocation string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(billingLocation) > 0 { + queryParameters["billingLocation"] = autorest.Encode("query", billingLocation) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BillingMetersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BillingMetersClient) ListResponder(resp *http.Response) (result BillingMeterCollection, 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 BillingMetersClient) listNextResults(lastResults BillingMeterCollection) (result BillingMeterCollection, err error) { + req, err := lastResults.billingMeterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BillingMetersClient", "listNextResults", 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, "web.BillingMetersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BillingMetersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BillingMetersClient) ListComplete(ctx context.Context, billingLocation string) (result BillingMeterCollectionIterator, err error) { + result.page, err = client.List(ctx, billingLocation) + return +} diff --git a/services/web/mgmt/2016-09-01/web/global.go b/services/web/mgmt/2016-09-01/web/global.go deleted file mode 100644 index 11459045b607..000000000000 --- a/services/web/mgmt/2016-09-01/web/global.go +++ /dev/null @@ -1,102 +0,0 @@ -package web - -// 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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// GlobalClient is the webSite Management Client -type GlobalClient struct { - BaseClient -} - -// NewGlobalClient creates an instance of the GlobalClient client. -func NewGlobalClient(subscriptionID string) GlobalClient { - return NewGlobalClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalClientWithBaseURI creates an instance of the GlobalClient client. -func NewGlobalClientWithBaseURI(baseURI string, subscriptionID string) GlobalClient { - return GlobalClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetBillingMeters gets a list of meters for a given location. -func (client GlobalClient) GetBillingMeters(ctx context.Context) (result ListBillingMeter, err error) { - req, err := client.GetBillingMetersPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", nil, "Failure preparing request") - return - } - - resp, err := client.GetBillingMetersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", resp, "Failure sending request") - return - } - - result, err = client.GetBillingMetersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetBillingMeters", resp, "Failure responding to request") - } - - return -} - -// GetBillingMetersPreparer prepares the GetBillingMeters request. -func (client GlobalClient) GetBillingMetersPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBillingMetersSender sends the GetBillingMeters request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetBillingMetersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetBillingMetersResponder handles the response to the GetBillingMeters request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetBillingMetersResponder(resp *http.Response) (result ListBillingMeter, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/web/mgmt/2016-09-01/web/models.go b/services/web/mgmt/2016-09-01/web/models.go index 00575fc19d2b..9d06c1f2a639 100644 --- a/services/web/mgmt/2016-09-01/web/models.go +++ b/services/web/mgmt/2016-09-01/web/models.go @@ -5408,17 +5408,215 @@ type BackupSchedule struct { LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` } -// BillingMeter billing meter. +// BillingMeter app Service billing entity that contains information about meter which the Azure billing system +// utilizes to charge users for services. type BillingMeter struct { + // BillingMeterProperties - BillingMeter resource specific properties + *BillingMeterProperties `json:"properties,omitempty"` + // ID - Resource Id. + ID *string `json:"id,omitempty"` + // Name - Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BillingMeter. +func (bm BillingMeter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bm.BillingMeterProperties != nil { + objectMap["properties"] = bm.BillingMeterProperties + } + if bm.ID != nil { + objectMap["id"] = bm.ID + } + if bm.Name != nil { + objectMap["name"] = bm.Name + } + if bm.Kind != nil { + objectMap["kind"] = bm.Kind + } + if bm.Type != nil { + objectMap["type"] = bm.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BillingMeter struct. +func (bm *BillingMeter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var billingMeterProperties BillingMeterProperties + err = json.Unmarshal(*v, &billingMeterProperties) + if err != nil { + return err + } + bm.BillingMeterProperties = &billingMeterProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bm.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + bm.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bm.Type = &typeVar + } + } + } + + return nil +} + +// BillingMeterCollection collection of Billing Meters +type BillingMeterCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Billing Meters. + Value *[]BillingMeter `json:"value,omitempty"` + // NextLink - Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// BillingMeterCollectionIterator provides access to a complete listing of BillingMeter values. +type BillingMeterCollectionIterator struct { + i int + page BillingMeterCollectionPage +} + +// 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 (iter *BillingMeterCollectionIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BillingMeterCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BillingMeterCollectionIterator) Response() BillingMeterCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BillingMeterCollectionIterator) Value() BillingMeter { + if !iter.page.NotDone() { + return BillingMeter{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (bmc BillingMeterCollection) IsEmpty() bool { + return bmc.Value == nil || len(*bmc.Value) == 0 +} + +// billingMeterCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bmc BillingMeterCollection) billingMeterCollectionPreparer() (*http.Request, error) { + if bmc.NextLink == nil || len(to.String(bmc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bmc.NextLink))) +} + +// BillingMeterCollectionPage contains a page of BillingMeter values. +type BillingMeterCollectionPage struct { + fn func(BillingMeterCollection) (BillingMeterCollection, error) + bmc BillingMeterCollection +} + +// 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 (page *BillingMeterCollectionPage) Next() error { + next, err := page.fn(page.bmc) + if err != nil { + return err + } + page.bmc = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BillingMeterCollectionPage) NotDone() bool { + return !page.bmc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BillingMeterCollectionPage) Response() BillingMeterCollection { + return page.bmc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BillingMeterCollectionPage) Values() []BillingMeter { + if page.bmc.IsEmpty() { + return nil + } + return *page.bmc.Value +} + +// BillingMeterProperties billingMeter resource specific properties +type BillingMeterProperties struct { // MeterID - Meter GUID onboarded in Commerce MeterID *string `json:"meterId,omitempty"` - // BillingLocation - CSM Location + // BillingLocation - Azure Location of billable resource BillingLocation *string `json:"billingLocation,omitempty"` - // ShortName - Short Name from Azure pricing Page + // ShortName - Short Name from App Service Azure pricing Page ShortName *string `json:"shortName,omitempty"` - // FriendlyName - Meter Resource Name + // FriendlyName - Friendly name of the meter FriendlyName *string `json:"friendlyName,omitempty"` - // ResourceType - ResourceType meter used for + // ResourceType - App Service resource type meter used for ResourceType *string `json:"resourceType,omitempty"` } @@ -10610,12 +10808,6 @@ func (j JobProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ListBillingMeter ... -type ListBillingMeter struct { - autorest.Response `json:"-"` - Value *[]BillingMeter `json:"value,omitempty"` -} - // ListCapability ... type ListCapability struct { autorest.Response `json:"-"` From 23e8de0a7a8383b1d601bdbdd6b8edb51a30b106 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 01:18:06 +0000 Subject: [PATCH 3/3] Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs --- services/web/mgmt/2016-09-01/web/apps.go | 59 +++++++++++++++++++----- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/services/web/mgmt/2016-09-01/web/apps.go b/services/web/mgmt/2016-09-01/web/apps.go index 1159b5edb59f..538573f1b651 100644 --- a/services/web/mgmt/2016-09-01/web/apps.go +++ b/services/web/mgmt/2016-09-01/web/apps.go @@ -1338,8 +1338,12 @@ func (client AppsClient) CreateMSDeployOperationSlotResponder(resp *http.Respons // // resourceGroupName is name of the resource group to which the resource belongs. name is unique name of the app to // create or update. To create or update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. -func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (result AppsCreateOrUpdateFuture, err error) { +// representation of the app properties. See example. skipDNSRegistration is if true web app hostname is not +// registered with DNS on creation. This parameter is +// only used for app creation. skipCustomDomainVerification is if true, custom (non *.azurewebsites.net) domains +// associated with web app are not verified. forceDNSRegistration is if true, web app hostname is force registered +// with DNS. TTLInSeconds is time to live in seconds for web app's default domain name. +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (result AppsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -1363,7 +1367,7 @@ func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName s return result, validation.NewError("web.AppsClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -1379,7 +1383,7 @@ func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName s } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (*http.Request, error) { +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -1390,6 +1394,18 @@ func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGro queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(TTLInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) + } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -3015,8 +3031,8 @@ func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Re // resourceGroupName is name of the resource group to which the resource belongs. name is name of the app to // delete. deleteMetrics is if true, web app metrics are also deleted. deleteEmptyServerFarm is specify true if the // App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, -// the empty App Service plan is not deleted. -func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (result autorest.Response, err error) { +// the empty App Service plan is not deleted. skipDNSRegistration is if true, DNS registration is skipped. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -3025,7 +3041,7 @@ func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, n return result, validation.NewError("web.AppsClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm) + req, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") return @@ -3047,7 +3063,7 @@ func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, n } // DeletePreparer prepares the Delete request. -func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (*http.Request, error) { +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -3064,6 +3080,9 @@ func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName s if deleteEmptyServerFarm != nil { queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } preparer := autorest.CreatePreparer( autorest.AsDelete(), @@ -23350,8 +23369,12 @@ func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (resul // // resourceGroupName is name of the resource group to which the resource belongs. name is unique name of the app to // create or update. To create or update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. -func (client AppsClient) Update(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (result Site, err error) { +// representation of the app properties. See example. skipDNSRegistration is if true web app hostname is not +// registered with DNS on creation. This parameter is +// only used for app creation. skipCustomDomainVerification is if true, custom (non *.azurewebsites.net) domains +// associated with web app are not verified. forceDNSRegistration is if true, web app hostname is force registered +// with DNS. TTLInSeconds is time to live in seconds for web app's default domain name. +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (result Site, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -23360,7 +23383,7 @@ func (client AppsClient) Update(ctx context.Context, resourceGroupName string, n return result, validation.NewError("web.AppsClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds) if err != nil { err = autorest.NewErrorWithError(err, "web.AppsClient", "Update", nil, "Failure preparing request") return @@ -23382,7 +23405,7 @@ func (client AppsClient) Update(ctx context.Context, resourceGroupName string, n } // UpdatePreparer prepares the Update request. -func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (*http.Request, error) { +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -23393,6 +23416,18 @@ func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName s queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(TTLInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) + } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"),