// Package web implements the Azure ARM Web service API version . // // WebSite Management Client 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 ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "net/http" ) const ( // DefaultBaseURI is the default URI used for the service Web DefaultBaseURI = "https://management.azure.com" ) // ManagementClient is the base client for Web. type ManagementClient struct { autorest.Client BaseURI string SubscriptionID string } // New creates an instance of the ManagementClient client. func New(subscriptionID string) ManagementClient { return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the ManagementClient client. func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, SubscriptionID: subscriptionID, } } // CheckNameAvailability check if a resource name is available. // // request is name availability request. func (client ManagementClient) CheckNameAvailability(request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: request, Constraints: []validation.Constraint{{Target: "request.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "CheckNameAvailability") } req, err := client.CheckNameAvailabilityPreparer(request) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") return } resp, err := client.CheckNameAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") return } result, err = client.CheckNameAvailabilityResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") } return } // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. func (client ManagementClient) CheckNameAvailabilityPreparer(request ResourceNameAvailabilityRequest) (*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.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), autorest.WithJSON(request), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always // closes the http.Response Body. func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // GetPublishingUser gets publishing user func (client ManagementClient) GetPublishingUser() (result User, err error) { req, err := client.GetPublishingUserPreparer() if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", nil, "Failure preparing request") return } resp, err := client.GetPublishingUserSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure sending request") return } result, err = client.GetPublishingUserResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure responding to request") } return } // GetPublishingUserPreparer prepares the GetPublishingUser request. func (client ManagementClient) GetPublishingUserPreparer() (*http.Request, error) { const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // GetPublishingUserSender sends the GetPublishingUser request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always // closes the http.Response Body. func (client ManagementClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListGeoRegions get a list of available geographical regions. // // sku is name of SKU used to filter the regions. linuxWorkersEnabled is specify true if you want to // filter to only regions that support Linux workers. func (client ManagementClient) ListGeoRegions(sku SkuName, linuxWorkersEnabled *bool) (result GeoRegionCollection, err error) { req, err := client.ListGeoRegionsPreparer(sku, linuxWorkersEnabled) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing request") return } resp, err := client.ListGeoRegionsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending request") return } result, err = client.ListGeoRegionsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to request") } return } // ListGeoRegionsPreparer prepares the ListGeoRegions request. func (client ManagementClient) ListGeoRegionsPreparer(sku SkuName, linuxWorkersEnabled *bool) (*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(string(sku)) > 0 { queryParameters["sku"] = autorest.Encode("query", sku) } if linuxWorkersEnabled != nil { queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ListGeoRegionsSender sends the ListGeoRegions request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ListGeoRegionsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListGeoRegionsResponder handles the response to the ListGeoRegions request. The method always // closes the http.Response Body. func (client ManagementClient) ListGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListGeoRegionsNextResults retrieves the next set of results, if any. func (client ManagementClient) ListGeoRegionsNextResults(lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { req, err := lastResults.GeoRegionCollectionPreparer() if err != nil { return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListGeoRegionsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending next results request") } result, err = client.ListGeoRegionsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to next results request") } return } // ListGeoRegionsComplete gets all elements from the list without paging. func (client ManagementClient) ListGeoRegionsComplete(sku SkuName, linuxWorkersEnabled *bool, cancel <-chan struct{}) (<-chan GeoRegion, <-chan error) { resultChan := make(chan GeoRegion) errChan := make(chan error, 1) go func() { defer func() { close(resultChan) close(errChan) }() list, err := client.ListGeoRegions(sku, linuxWorkersEnabled) if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } for list.NextLink != nil { list, err = client.ListGeoRegionsNextResults(list) if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } } }() return resultChan, errChan } // ListPremierAddOnOffers list all premier add-on offers. func (client ManagementClient) ListPremierAddOnOffers() (result PremierAddOnOfferCollection, err error) { req, err := client.ListPremierAddOnOffersPreparer() if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing request") return } resp, err := client.ListPremierAddOnOffersSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending request") return } result, err = client.ListPremierAddOnOffersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to request") } return } // ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. func (client ManagementClient) ListPremierAddOnOffersPreparer() (*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/premieraddonoffers", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always // closes the http.Response Body. func (client ManagementClient) ListPremierAddOnOffersResponder(resp *http.Response) (result PremierAddOnOfferCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListPremierAddOnOffersNextResults retrieves the next set of results, if any. func (client ManagementClient) ListPremierAddOnOffersNextResults(lastResults PremierAddOnOfferCollection) (result PremierAddOnOfferCollection, err error) { req, err := lastResults.PremierAddOnOfferCollectionPreparer() if err != nil { return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListPremierAddOnOffersSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending next results request") } result, err = client.ListPremierAddOnOffersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to next results request") } return } // ListPremierAddOnOffersComplete gets all elements from the list without paging. func (client ManagementClient) ListPremierAddOnOffersComplete(cancel <-chan struct{}) (<-chan PremierAddOnOffer, <-chan error) { resultChan := make(chan PremierAddOnOffer) errChan := make(chan error, 1) go func() { defer func() { close(resultChan) close(errChan) }() list, err := client.ListPremierAddOnOffers() if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } for list.NextLink != nil { list, err = client.ListPremierAddOnOffersNextResults(list) if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } } }() return resultChan, errChan } // ListSkus list all SKUs. func (client ManagementClient) ListSkus() (result SkuInfos, err error) { req, err := client.ListSkusPreparer() if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", nil, "Failure preparing request") return } resp, err := client.ListSkusSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure sending request") return } result, err = client.ListSkusResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure responding to request") } return } // ListSkusPreparer prepares the ListSkus request. func (client ManagementClient) ListSkusPreparer() (*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/skus", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ListSkusSender sends the ListSkus request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ListSkusSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListSkusResponder handles the response to the ListSkus request. The method always // closes the http.Response Body. func (client ManagementClient) ListSkusResponder(resp *http.Response) (result SkuInfos, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListSourceControls gets the source controls available for Azure websites. func (client ManagementClient) ListSourceControls() (result SourceControlCollection, err error) { req, err := client.ListSourceControlsPreparer() if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing request") return } resp, err := client.ListSourceControlsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending request") return } result, err = client.ListSourceControlsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to request") } return } // ListSourceControlsPreparer prepares the ListSourceControls request. func (client ManagementClient) ListSourceControlsPreparer() (*http.Request, error) { const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ListSourceControlsSender sends the ListSourceControls request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ListSourceControlsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // ListSourceControlsResponder handles the response to the ListSourceControls request. The method always // closes the http.Response Body. func (client ManagementClient) ListSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListSourceControlsNextResults retrieves the next set of results, if any. func (client ManagementClient) ListSourceControlsNextResults(lastResults SourceControlCollection) (result SourceControlCollection, err error) { req, err := lastResults.SourceControlCollectionPreparer() if err != nil { return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListSourceControlsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending next results request") } result, err = client.ListSourceControlsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to next results request") } return } // ListSourceControlsComplete gets all elements from the list without paging. func (client ManagementClient) ListSourceControlsComplete(cancel <-chan struct{}) (<-chan SourceControl, <-chan error) { resultChan := make(chan SourceControl) errChan := make(chan error, 1) go func() { defer func() { close(resultChan) close(errChan) }() list, err := client.ListSourceControls() if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } for list.NextLink != nil { list, err = client.ListSourceControlsNextResults(list) if err != nil { errChan <- err return } if list.Value != nil { for _, item := range *list.Value { select { case <-cancel: return case resultChan <- item: // Intentionally left blank } } } } }() return resultChan, errChan } // Move move resources between resource groups. // // resourceGroupName is name of the resource group to which the resource belongs. moveResourceEnvelope is object that // represents the resource to move. func (client ManagementClient) Move(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (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}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, {TargetValue: moveResourceEnvelope, Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, }}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Move") } req, err := client.MovePreparer(resourceGroupName, moveResourceEnvelope) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", nil, "Failure preparing request") return } resp, err := client.MoveSender(req) if err != nil { result.Response = resp err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure sending request") return } result, err = client.MoveResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure responding to request") } return } // MovePreparer prepares the Move request. func (client ManagementClient) MovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*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.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), autorest.WithJSON(moveResourceEnvelope), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // MoveSender sends the Move request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) MoveSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // MoveResponder handles the response to the Move request. The method always // closes the http.Response Body. func (client ManagementClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return } // UpdatePublishingUser updates publishing user // // userDetails is details of publishing user func (client ManagementClient) UpdatePublishingUser(userDetails User) (result User, err error) { req, err := client.UpdatePublishingUserPreparer(userDetails) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", nil, "Failure preparing request") return } resp, err := client.UpdatePublishingUserSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure sending request") return } result, err = client.UpdatePublishingUserResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure responding to request") } return } // UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. func (client ManagementClient) UpdatePublishingUserPreparer(userDetails User) (*http.Request, error) { const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), autorest.WithJSON(userDetails), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always // closes the http.Response Body. func (client ManagementClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // UpdateSourceControl updates source control token // // sourceControlType is type of source control requestMessage is source control token information func (client ManagementClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", nil, "Failure preparing request") return } resp, err := client.UpdateSourceControlSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure sending request") return } result, err = client.UpdateSourceControlResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure responding to request") } return } // UpdateSourceControlPreparer prepares the UpdateSourceControl request. func (client ManagementClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) { pathParameters := map[string]interface{}{ "sourceControlType": autorest.Encode("path", sourceControlType), } const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), autorest.WithJSON(requestMessage), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always // closes the http.Response Body. func (client ManagementClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Validate validate if a resource can be created. // // resourceGroupName is name of the resource group to which the resource belongs. validateRequest is request with the // resources to validate. func (client ManagementClient) Validate(resourceGroupName string, validateRequest ValidateRequest) (result ValidateResponse, 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}}}, {TargetValue: validateRequest, Constraints: []validation.Constraint{{Target: "validateRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "validateRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, {Target: "validateRequest.ValidateProperties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, }}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Validate") } req, err := client.ValidatePreparer(resourceGroupName, validateRequest) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", nil, "Failure preparing request") return } resp, err := client.ValidateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure sending request") return } result, err = client.ValidateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure responding to request") } return } // ValidatePreparer prepares the Validate request. func (client ManagementClient) ValidatePreparer(resourceGroupName string, validateRequest ValidateRequest) (*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.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate", pathParameters), autorest.WithJSON(validateRequest), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ValidateSender sends the Validate request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ValidateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ValidateResponder handles the response to the Validate request. The method always // closes the http.Response Body. func (client ManagementClient) ValidateResponder(resp *http.Response) (result ValidateResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ValidateMove validate whether a resource can be moved. // // resourceGroupName is name of the resource group to which the resource belongs. moveResourceEnvelope is object that // represents the resource to move. func (client ManagementClient) ValidateMove(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (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}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, {TargetValue: moveResourceEnvelope, Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, }}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "ValidateMove") } req, err := client.ValidateMovePreparer(resourceGroupName, moveResourceEnvelope) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", nil, "Failure preparing request") return } resp, err := client.ValidateMoveSender(req) if err != nil { result.Response = resp err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure sending request") return } result, err = client.ValidateMoveResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure responding to request") } return } // ValidateMovePreparer prepares the ValidateMove request. func (client ManagementClient) ValidateMovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*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.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources", pathParameters), autorest.WithJSON(moveResourceEnvelope), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // ValidateMoveSender sends the ValidateMove request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) ValidateMoveSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ValidateMoveResponder handles the response to the ValidateMove request. The method always // closes the http.Response Body. func (client ManagementClient) ValidateMoveResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return } // VerifyHostingEnvironmentVnet verifies if this VNET is compatible with an App Service Environment by analyzing the // Network Security Group rules. // // parameters is VNET information func (client ManagementClient) VerifyHostingEnvironmentVnet(parameters VnetParameters) (result VnetValidationFailureDetails, err error) { req, err := client.VerifyHostingEnvironmentVnetPreparer(parameters) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "VerifyHostingEnvironmentVnet", nil, "Failure preparing request") return } resp, err := client.VerifyHostingEnvironmentVnetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "web.ManagementClient", "VerifyHostingEnvironmentVnet", resp, "Failure sending request") return } result, err = client.VerifyHostingEnvironmentVnetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "web.ManagementClient", "VerifyHostingEnvironmentVnet", resp, "Failure responding to request") } return } // VerifyHostingEnvironmentVnetPreparer prepares the VerifyHostingEnvironmentVnet request. func (client ManagementClient) VerifyHostingEnvironmentVnetPreparer(parameters VnetParameters) (*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.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } // VerifyHostingEnvironmentVnetSender sends the VerifyHostingEnvironmentVnet request. The method will close the // http.Response Body if it receives an error. func (client ManagementClient) VerifyHostingEnvironmentVnetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // VerifyHostingEnvironmentVnetResponder handles the response to the VerifyHostingEnvironmentVnet request. The method always // closes the http.Response Body. func (client ManagementClient) VerifyHostingEnvironmentVnetResponder(resp *http.Response) (result VnetValidationFailureDetails, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }