From 611cf52f25f426aa95a255988bb319d14ef7332e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 10 May 2019 14:54:50 -0700 Subject: [PATCH 1/2] Generated from 310b5ada2616fb0b8f5808d6d1422df350d459e6 (#4771) Add examples --- .../web/mgmt/2018-02-01/web/deletedwebapps.go | 187 ++++++++++++++++++ services/web/mgmt/2018-02-01/web/models.go | 1 + .../mgmt/2018-02-01/web/webapi/interfaces.go | 2 + 3 files changed, 190 insertions(+) diff --git a/services/web/mgmt/2018-02-01/web/deletedwebapps.go b/services/web/mgmt/2018-02-01/web/deletedwebapps.go index 4eaaaf388399..0b6ed25039dc 100644 --- a/services/web/mgmt/2018-02-01/web/deletedwebapps.go +++ b/services/web/mgmt/2018-02-01/web/deletedwebapps.go @@ -40,6 +40,82 @@ func NewDeletedWebAppsClientWithBaseURI(baseURI string, subscriptionID string) D return DeletedWebAppsClient{NewWithBaseURI(baseURI, subscriptionID)} } +// GetDeletedWebAppByLocation get deleted app for a subscription at location. +// Parameters: +// deletedSiteID - the numeric ID of the deleted app, e.g. 12345 +func (client DeletedWebAppsClient) GetDeletedWebAppByLocation(ctx context.Context, location string, deletedSiteID string) (result DeletedSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.GetDeletedWebAppByLocation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedWebAppByLocationPreparer(ctx, location, deletedSiteID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedWebAppByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedWebAppByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", resp, "Failure responding to request") + } + + return +} + +// GetDeletedWebAppByLocationPreparer prepares the GetDeletedWebAppByLocation request. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationPreparer(ctx context.Context, location string, deletedSiteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deletedSiteId": autorest.Encode("path", deletedSiteID), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedWebAppByLocationSender sends the GetDeletedWebAppByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedWebAppByLocationResponder handles the response to the GetDeletedWebAppByLocation request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationResponder(resp *http.Response) (result DeletedSite, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // List get all deleted apps for a subscription. func (client DeletedWebAppsClient) List(ctx context.Context) (result DeletedWebAppCollectionPage, err error) { if tracing.IsEnabled() { @@ -149,3 +225,114 @@ func (client DeletedWebAppsClient) ListComplete(ctx context.Context) (result Del result.page, err = client.List(ctx) return } + +// ListByLocation get all deleted apps for a subscription at location +func (client DeletedWebAppsClient) ListByLocation(ctx context.Context, location string) (result DeletedWebAppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.ListByLocation") + defer func() { + sc := -1 + if result.dwac.Response.Response != nil { + sc = result.dwac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByLocationNextResults + req, err := client.ListByLocationPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.dwac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", resp, "Failure sending request") + return + } + + result.dwac, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", resp, "Failure responding to request") + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client DeletedWebAppsClient) ListByLocationPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByLocationSender sends the ListByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListByLocationResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByLocationNextResults retrieves the next set of results, if any. +func (client DeletedWebAppsClient) listByLocationNextResults(ctx context.Context, lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.deletedWebAppCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeletedWebAppsClient) ListByLocationComplete(ctx context.Context, location string) (result DeletedWebAppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.ListByLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByLocation(ctx, location) + return +} diff --git a/services/web/mgmt/2018-02-01/web/models.go b/services/web/mgmt/2018-02-01/web/models.go index a4ad3ce316f6..92f764bed29a 100644 --- a/services/web/mgmt/2018-02-01/web/models.go +++ b/services/web/mgmt/2018-02-01/web/models.go @@ -7313,6 +7313,7 @@ type DeletedAppRestoreRequestProperties struct { // DeletedSite a deleted app. type DeletedSite struct { + autorest.Response `json:"-"` // DeletedSiteProperties - DeletedSite resource specific properties *DeletedSiteProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id. diff --git a/services/web/mgmt/2018-02-01/web/webapi/interfaces.go b/services/web/mgmt/2018-02-01/web/webapi/interfaces.go index ce20c093071c..10fe2bd43800 100644 --- a/services/web/mgmt/2018-02-01/web/webapi/interfaces.go +++ b/services/web/mgmt/2018-02-01/web/webapi/interfaces.go @@ -131,7 +131,9 @@ var _ CertificatesClientAPI = (*web.CertificatesClient)(nil) // DeletedWebAppsClientAPI contains the set of methods on the DeletedWebAppsClient type. type DeletedWebAppsClientAPI interface { + GetDeletedWebAppByLocation(ctx context.Context, location string, deletedSiteID string) (result web.DeletedSite, err error) List(ctx context.Context) (result web.DeletedWebAppCollectionPage, err error) + ListByLocation(ctx context.Context, location string) (result web.DeletedWebAppCollectionPage, err error) } var _ DeletedWebAppsClientAPI = (*web.DeletedWebAppsClient)(nil) From efc9f9696be0cbc66075ad97ed7fb7b70fbbdf55 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 13 May 2019 13:41:13 -0700 Subject: [PATCH 2/2] Generated from ca964030410907fee5bc6c2e08d6e5dd934e49a3 (#4778) Add Source Web App Location --- services/web/mgmt/2018-02-01/web/models.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web/mgmt/2018-02-01/web/models.go b/services/web/mgmt/2018-02-01/web/models.go index 92f764bed29a..b8666162d53b 100644 --- a/services/web/mgmt/2018-02-01/web/models.go +++ b/services/web/mgmt/2018-02-01/web/models.go @@ -6253,6 +6253,8 @@ type CloningInfo struct { // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. SourceWebAppID *string `json:"sourceWebAppId,omitempty"` + // SourceWebAppLocation - Location of source app ex: West US or North Europe + SourceWebAppLocation *string `json:"sourceWebAppLocation,omitempty"` // HostingEnvironment - App Service Environment. HostingEnvironment *string `json:"hostingEnvironment,omitempty"` // AppSettingsOverrides - Application setting overrides for cloned app. If specified, these settings override the settings cloned @@ -6285,6 +6287,9 @@ func (ci CloningInfo) MarshalJSON() ([]byte, error) { if ci.SourceWebAppID != nil { objectMap["sourceWebAppId"] = ci.SourceWebAppID } + if ci.SourceWebAppLocation != nil { + objectMap["sourceWebAppLocation"] = ci.SourceWebAppLocation + } if ci.HostingEnvironment != nil { objectMap["hostingEnvironment"] = ci.HostingEnvironment }