~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/web/globalresourcegroups.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package 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 0.12.0.0
 
18
// Changes may cause incorrect behavior and will be lost if the code is
 
19
// regenerated.
 
20
 
 
21
import (
 
22
        "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest"
 
23
        "net/http"
 
24
        "net/url"
 
25
)
 
26
 
 
27
// GlobalResourceGroupsClient is the use these APIs to manage Azure Websites
 
28
// resources through the Azure Resource Manager. All task operations conform
 
29
// to the HTTP/1.1 protocol specification and each operation returns an
 
30
// x-ms-request-id header that can be used to obtain information about the
 
31
// request. You must make sure that requests made to these resources are
 
32
// secure. For more information, see <a
 
33
// href="https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx">Authenticating
 
34
// Azure Resource Manager requests.</a>
 
35
type GlobalResourceGroupsClient struct {
 
36
        ManagementClient
 
37
}
 
38
 
 
39
// NewGlobalResourceGroupsClient creates an instance of the
 
40
// GlobalResourceGroupsClient client.
 
41
func NewGlobalResourceGroupsClient(subscriptionID string) GlobalResourceGroupsClient {
 
42
        return NewGlobalResourceGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
43
}
 
44
 
 
45
// NewGlobalResourceGroupsClientWithBaseURI creates an instance of the
 
46
// GlobalResourceGroupsClient client.
 
47
func NewGlobalResourceGroupsClientWithBaseURI(baseURI string, subscriptionID string) GlobalResourceGroupsClient {
 
48
        return GlobalResourceGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
 
49
}
 
50
 
 
51
// MoveResources sends the move resources request.
 
52
//
 
53
func (client GlobalResourceGroupsClient) MoveResources(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, ae error) {
 
54
        req, err := client.MoveResourcesPreparer(resourceGroupName, moveResourceEnvelope)
 
55
        if err != nil {
 
56
                return result, autorest.NewErrorWithError(err, "web/GlobalResourceGroupsClient", "MoveResources", "Failure preparing request")
 
57
        }
 
58
 
 
59
        resp, err := client.MoveResourcesSender(req)
 
60
        if err != nil {
 
61
                result.Response = resp
 
62
                return result, autorest.NewErrorWithError(err, "web/GlobalResourceGroupsClient", "MoveResources", "Failure sending request")
 
63
        }
 
64
 
 
65
        result, err = client.MoveResourcesResponder(resp)
 
66
        if err != nil {
 
67
                ae = autorest.NewErrorWithError(err, "web/GlobalResourceGroupsClient", "MoveResources", "Failure responding to request")
 
68
        }
 
69
 
 
70
        return
 
71
}
 
72
 
 
73
// MoveResourcesPreparer prepares the MoveResources request.
 
74
func (client GlobalResourceGroupsClient) MoveResourcesPreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) {
 
75
        pathParameters := map[string]interface{}{
 
76
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
77
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
78
        }
 
79
 
 
80
        queryParameters := map[string]interface{}{
 
81
                "api-version": APIVersion,
 
82
        }
 
83
 
 
84
        return autorest.Prepare(&http.Request{},
 
85
                autorest.AsJSON(),
 
86
                autorest.AsPost(),
 
87
                autorest.WithBaseURL(client.BaseURI),
 
88
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources"),
 
89
                autorest.WithJSON(moveResourceEnvelope),
 
90
                autorest.WithPathParameters(pathParameters),
 
91
                autorest.WithQueryParameters(queryParameters))
 
92
}
 
93
 
 
94
// MoveResourcesSender sends the MoveResources request. The method will close the
 
95
// http.Response Body if it receives an error.
 
96
func (client GlobalResourceGroupsClient) MoveResourcesSender(req *http.Request) (*http.Response, error) {
 
97
        return client.Send(req, http.StatusOK, http.StatusNoContent)
 
98
}
 
99
 
 
100
// MoveResourcesResponder handles the response to the MoveResources request. The method always
 
101
// closes the http.Response Body.
 
102
func (client GlobalResourceGroupsClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) {
 
103
        err = autorest.Respond(
 
104
                resp,
 
105
                client.ByInspecting(),
 
106
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
 
107
                autorest.ByClosing())
 
108
        result.Response = resp
 
109
        return
 
110
}