1package web 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "net/http" 25) 26 27// GlobalResourceGroupsClient is the webSite Management Client 28type GlobalResourceGroupsClient struct { 29 BaseClient 30} 31 32// NewGlobalResourceGroupsClient creates an instance of the GlobalResourceGroupsClient client. 33func NewGlobalResourceGroupsClient(subscriptionID string) GlobalResourceGroupsClient { 34 return NewGlobalResourceGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) 35} 36 37// NewGlobalResourceGroupsClientWithBaseURI creates an instance of the GlobalResourceGroupsClient client. 38func NewGlobalResourceGroupsClientWithBaseURI(baseURI string, subscriptionID string) GlobalResourceGroupsClient { 39 return GlobalResourceGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} 40} 41 42// MoveResources sends the move resources request. 43func (client GlobalResourceGroupsClient) MoveResources(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { 44 req, err := client.MoveResourcesPreparer(ctx, resourceGroupName, moveResourceEnvelope) 45 if err != nil { 46 err = autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", nil, "Failure preparing request") 47 return 48 } 49 50 resp, err := client.MoveResourcesSender(req) 51 if err != nil { 52 result.Response = resp 53 err = autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", resp, "Failure sending request") 54 return 55 } 56 57 result, err = client.MoveResourcesResponder(resp) 58 if err != nil { 59 err = autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", resp, "Failure responding to request") 60 } 61 62 return 63} 64 65// MoveResourcesPreparer prepares the MoveResources request. 66func (client GlobalResourceGroupsClient) MoveResourcesPreparer(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { 67 pathParameters := map[string]interface{}{ 68 "resourceGroupName": autorest.Encode("path", resourceGroupName), 69 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 70 } 71 72 const APIVersion = "2015-08-01" 73 queryParameters := map[string]interface{}{ 74 "api-version": APIVersion, 75 } 76 77 preparer := autorest.CreatePreparer( 78 autorest.AsContentType("application/json; charset=utf-8"), 79 autorest.AsPost(), 80 autorest.WithBaseURL(client.BaseURI), 81 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), 82 autorest.WithJSON(moveResourceEnvelope), 83 autorest.WithQueryParameters(queryParameters)) 84 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 85} 86 87// MoveResourcesSender sends the MoveResources request. The method will close the 88// http.Response Body if it receives an error. 89func (client GlobalResourceGroupsClient) MoveResourcesSender(req *http.Request) (*http.Response, error) { 90 return autorest.SendWithSender(client, req, 91 azure.DoRetryWithRegistration(client.Client)) 92} 93 94// MoveResourcesResponder handles the response to the MoveResources request. The method always 95// closes the http.Response Body. 96func (client GlobalResourceGroupsClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { 97 err = autorest.Respond( 98 resp, 99 client.ByInspecting(), 100 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 101 autorest.ByClosing()) 102 result.Response = resp 103 return 104} 105