From 744dae3f3791a3fe4d8e133864b820dcf7e982f8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Mar 2018 22:14:42 +0000 Subject: [PATCH] Generated from 2cfd4201a8ac6728ed176142e879fa13c9aff776 Fix for https://github.com/Azure/azure-rest-api-specs/issues/1697#issuecomment-367167726 --- services/web/mgmt/2016-09-01/web/apps.go | 59 +- services/web/mgmt/2016-09-01/web/models.go | 235 ------- .../2016-09-01/web/resourcehealthmetadata.go | 588 ------------------ 3 files changed, 12 insertions(+), 870 deletions(-) delete mode 100644 services/web/mgmt/2016-09-01/web/resourcehealthmetadata.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/models.go b/services/web/mgmt/2016-09-01/web/models.go index b807de3a1208..f92303797b48 100644 --- a/services/web/mgmt/2016-09-01/web/models.go +++ b/services/web/mgmt/2016-09-01/web/models.go @@ -6878,35 +6878,6 @@ type DataSource struct { DataSourceURI *[]NameValuePair `json:"dataSourceUri,omitempty"` } -// DefaultErrorResponse app Service error response. -type DefaultErrorResponse struct { - // Error - Error model. - Error *DefaultErrorResponseError `json:"error,omitempty"` -} - -// DefaultErrorResponseError error model. -type DefaultErrorResponseError struct { - // Code - Standardized string to programmatically identify the error. - Code *string `json:"code,omitempty"` - // Message - Detailed error description and debugging information. - Message *string `json:"message,omitempty"` - // Target - Detailed error description and debugging information. - Target *string `json:"target,omitempty"` - Details *[]DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"` - // Innererror - More information to debug error. - Innererror *string `json:"innererror,omitempty"` -} - -// DefaultErrorResponseErrorDetailsItem detailed errors. -type DefaultErrorResponseErrorDetailsItem struct { - // Code - Standardized string to programmatically identify the error. - Code *string `json:"code,omitempty"` - // Message - Detailed error description and debugging information. - Message *string `json:"message,omitempty"` - // Target - Detailed error description and debugging information. - Target *string `json:"target,omitempty"` -} - // DeletedSite a deleted app. type DeletedSite struct { // ID - Numeric id for the deleted site @@ -14206,212 +14177,6 @@ func (page ResourceCollectionPage) Values() []string { return *page.rc.Value } -// ResourceHealthMetadata used for getting ResourceHealthCheck settings. -type ResourceHealthMetadata struct { - autorest.Response `json:"-"` - // ResourceHealthMetadataProperties - ResourceHealthMetadata resource specific properties - *ResourceHealthMetadataProperties `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 ResourceHealthMetadata. -func (rhm ResourceHealthMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rhm.ResourceHealthMetadataProperties != nil { - objectMap["properties"] = rhm.ResourceHealthMetadataProperties - } - if rhm.ID != nil { - objectMap["id"] = rhm.ID - } - if rhm.Name != nil { - objectMap["name"] = rhm.Name - } - if rhm.Kind != nil { - objectMap["kind"] = rhm.Kind - } - if rhm.Type != nil { - objectMap["type"] = rhm.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceHealthMetadata struct. -func (rhm *ResourceHealthMetadata) 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 resourceHealthMetadataProperties ResourceHealthMetadataProperties - err = json.Unmarshal(*v, &resourceHealthMetadataProperties) - if err != nil { - return err - } - rhm.ResourceHealthMetadataProperties = &resourceHealthMetadataProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rhm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rhm.Name = &name - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - rhm.Kind = &kind - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rhm.Type = &typeVar - } - } - } - - return nil -} - -// ResourceHealthMetadataCollection collection of resource health metadata. -type ResourceHealthMetadataCollection struct { - autorest.Response `json:"-"` - // Value - Collection of resources. - Value *[]ResourceHealthMetadata `json:"value,omitempty"` - // NextLink - Link to next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceHealthMetadataCollectionIterator provides access to a complete listing of ResourceHealthMetadata values. -type ResourceHealthMetadataCollectionIterator struct { - i int - page ResourceHealthMetadataCollectionPage -} - -// 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 *ResourceHealthMetadataCollectionIterator) 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 ResourceHealthMetadataCollectionIterator) 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 ResourceHealthMetadataCollectionIterator) Response() ResourceHealthMetadataCollection { - 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 ResourceHealthMetadataCollectionIterator) Value() ResourceHealthMetadata { - if !iter.page.NotDone() { - return ResourceHealthMetadata{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (rhmc ResourceHealthMetadataCollection) IsEmpty() bool { - return rhmc.Value == nil || len(*rhmc.Value) == 0 -} - -// resourceHealthMetadataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rhmc ResourceHealthMetadataCollection) resourceHealthMetadataCollectionPreparer() (*http.Request, error) { - if rhmc.NextLink == nil || len(to.String(rhmc.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rhmc.NextLink))) -} - -// ResourceHealthMetadataCollectionPage contains a page of ResourceHealthMetadata values. -type ResourceHealthMetadataCollectionPage struct { - fn func(ResourceHealthMetadataCollection) (ResourceHealthMetadataCollection, error) - rhmc ResourceHealthMetadataCollection -} - -// 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 *ResourceHealthMetadataCollectionPage) Next() error { - next, err := page.fn(page.rhmc) - if err != nil { - return err - } - page.rhmc = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceHealthMetadataCollectionPage) NotDone() bool { - return !page.rhmc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceHealthMetadataCollectionPage) Response() ResourceHealthMetadataCollection { - return page.rhmc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceHealthMetadataCollectionPage) Values() []ResourceHealthMetadata { - if page.rhmc.IsEmpty() { - return nil - } - return *page.rhmc.Value -} - -// ResourceHealthMetadataProperties resourceHealthMetadata resource specific properties -type ResourceHealthMetadataProperties struct { - // Category - The category that the resource matches in the RHC Policy File - Category *string `json:"category,omitempty"` - // SignalAvailability - Is there a health signal for the resource - SignalAvailability *bool `json:"signalAvailability,omitempty"` -} - // ResourceMetric object representing a metric for any resource . type ResourceMetric struct { // Name - Name of metric. diff --git a/services/web/mgmt/2016-09-01/web/resourcehealthmetadata.go b/services/web/mgmt/2016-09-01/web/resourcehealthmetadata.go deleted file mode 100644 index c930970814da..000000000000 --- a/services/web/mgmt/2016-09-01/web/resourcehealthmetadata.go +++ /dev/null @@ -1,588 +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" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ResourceHealthMetadataClient is the webSite Management Client -type ResourceHealthMetadataClient struct { - BaseClient -} - -// NewResourceHealthMetadataClient creates an instance of the ResourceHealthMetadataClient client. -func NewResourceHealthMetadataClient(subscriptionID string) ResourceHealthMetadataClient { - return NewResourceHealthMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceHealthMetadataClientWithBaseURI creates an instance of the ResourceHealthMetadataClient client. -func NewResourceHealthMetadataClientWithBaseURI(baseURI string, subscriptionID string) ResourceHealthMetadataClient { - return ResourceHealthMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetBySite gets the category of ResourceHealthMetadata to use for the given site -// -// resourceGroupName is name of the resource group to which the resource belongs. name is name of web app -func (client ResourceHealthMetadataClient) GetBySite(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadata, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("web.ResourceHealthMetadataClient", "GetBySite", err.Error()) - } - - req, err := client.GetBySitePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", nil, "Failure preparing request") - return - } - - resp, err := client.GetBySiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", resp, "Failure sending request") - return - } - - result, err = client.GetBySiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", resp, "Failure responding to request") - } - - return -} - -// GetBySitePreparer prepares the GetBySite request. -func (client ResourceHealthMetadataClient) GetBySitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBySiteSender sends the GetBySite request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceHealthMetadataClient) GetBySiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetBySiteResponder handles the response to the GetBySite request. The method always -// closes the http.Response Body. -func (client ResourceHealthMetadataClient) GetBySiteResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBySiteSlot gets the category of ResourceHealthMetadata to use for the given site -// -// resourceGroupName is name of the resource group to which the resource belongs. name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client ResourceHealthMetadataClient) GetBySiteSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadata, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("web.ResourceHealthMetadataClient", "GetBySiteSlot", err.Error()) - } - - req, err := client.GetBySiteSlotPreparer(ctx, resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetBySiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", resp, "Failure sending request") - return - } - - result, err = client.GetBySiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", resp, "Failure responding to request") - } - - return -} - -// GetBySiteSlotPreparer prepares the GetBySiteSlot request. -func (client ResourceHealthMetadataClient) GetBySiteSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBySiteSlotSender sends the GetBySiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceHealthMetadataClient) GetBySiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetBySiteSlotResponder handles the response to the GetBySiteSlot request. The method always -// closes the http.Response Body. -func (client ResourceHealthMetadataClient) GetBySiteSlotResponder(resp *http.Response) (result ResourceHealthMetadata, 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 list all ResourceHealthMetadata for all sites in the subscription. -func (client ResourceHealthMetadataClient) List(ctx context.Context) (result ResourceHealthMetadataCollectionPage, err error) { - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rhmc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", resp, "Failure sending request") - return - } - - result.rhmc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ResourceHealthMetadataClient) ListPreparer(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/resourceHealthMetadata", 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 ResourceHealthMetadataClient) 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 ResourceHealthMetadataClient) ListResponder(resp *http.Response) (result ResourceHealthMetadataCollection, 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 ResourceHealthMetadataClient) listNextResults(lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { - req, err := lastResults.resourceHealthMetadataCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "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.ResourceHealthMetadataClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceHealthMetadataClient) ListComplete(ctx context.Context) (result ResourceHealthMetadataCollectionIterator, err error) { - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup list all ResourceHealthMetadata for all sites in the resource group in the subscription. -// -// resourceGroupName is name of the resource group to which the resource belongs. -func (client ResourceHealthMetadataClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceHealthMetadataCollectionPage, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("web.ResourceHealthMetadataClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rhmc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rhmc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ResourceHealthMetadataClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceHealthMetadataClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ResourceHealthMetadataClient) ListByResourceGroupResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ResourceHealthMetadataClient) listByResourceGroupNextResults(lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { - req, err := lastResults.resourceHealthMetadataCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceHealthMetadataClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceHealthMetadataCollectionIterator, err error) { - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySite gets the category of ResourceHealthMetadata to use for the given site as a collection -// -// resourceGroupName is name of the resource group to which the resource belongs. name is name of web app. -func (client ResourceHealthMetadataClient) ListBySite(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadataCollectionPage, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("web.ResourceHealthMetadataClient", "ListBySite", err.Error()) - } - - result.fn = client.listBySiteNextResults - req, err := client.ListBySitePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySiteSender(req) - if err != nil { - result.rhmc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", resp, "Failure sending request") - return - } - - result.rhmc, err = client.ListBySiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", resp, "Failure responding to request") - } - - return -} - -// ListBySitePreparer prepares the ListBySite request. -func (client ResourceHealthMetadataClient) ListBySitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySiteSender sends the ListBySite request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceHealthMetadataClient) ListBySiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySiteResponder handles the response to the ListBySite request. The method always -// closes the http.Response Body. -func (client ResourceHealthMetadataClient) ListBySiteResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySiteNextResults retrieves the next set of results, if any. -func (client ResourceHealthMetadataClient) listBySiteNextResults(lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { - req, err := lastResults.resourceHealthMetadataCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySiteComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceHealthMetadataClient) ListBySiteComplete(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadataCollectionIterator, err error) { - result.page, err = client.ListBySite(ctx, resourceGroupName, name) - return -} - -// ListBySiteSlot gets the category of ResourceHealthMetadata to use for the given site as a collection -// -// resourceGroupName is name of the resource group to which the resource belongs. name is name of web app. slot is -// name of web app slot. If not specified then will default to production slot. -func (client ResourceHealthMetadataClient) ListBySiteSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadataCollectionPage, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("web.ResourceHealthMetadataClient", "ListBySiteSlot", err.Error()) - } - - result.fn = client.listBySiteSlotNextResults - req, err := client.ListBySiteSlotPreparer(ctx, resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySiteSlotSender(req) - if err != nil { - result.rhmc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", resp, "Failure sending request") - return - } - - result.rhmc, err = client.ListBySiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", resp, "Failure responding to request") - } - - return -} - -// ListBySiteSlotPreparer prepares the ListBySiteSlot request. -func (client ResourceHealthMetadataClient) ListBySiteSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySiteSlotSender sends the ListBySiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceHealthMetadataClient) ListBySiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySiteSlotResponder handles the response to the ListBySiteSlot request. The method always -// closes the http.Response Body. -func (client ResourceHealthMetadataClient) ListBySiteSlotResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySiteSlotNextResults retrieves the next set of results, if any. -func (client ResourceHealthMetadataClient) listBySiteSlotNextResults(lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { - req, err := lastResults.resourceHealthMetadataCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySiteSlotComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceHealthMetadataClient) ListBySiteSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadataCollectionIterator, err error) { - result.page, err = client.ListBySiteSlot(ctx, resourceGroupName, name, slot) - return -}