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] 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)