~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/web/provider.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
// ProviderClient is the use these APIs to manage Azure Websites resources
 
28
// through the Azure Resource Manager. All task operations conform to the
 
29
// 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 ProviderClient struct {
 
36
        ManagementClient
 
37
}
 
38
 
 
39
// NewProviderClient creates an instance of the ProviderClient client.
 
40
func NewProviderClient(subscriptionID string) ProviderClient {
 
41
        return NewProviderClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
42
}
 
43
 
 
44
// NewProviderClientWithBaseURI creates an instance of the ProviderClient
 
45
// client.
 
46
func NewProviderClientWithBaseURI(baseURI string, subscriptionID string) ProviderClient {
 
47
        return ProviderClient{NewWithBaseURI(baseURI, subscriptionID)}
 
48
}
 
49
 
 
50
// GetPublishingUser sends the get publishing user request.
 
51
func (client ProviderClient) GetPublishingUser() (result User, ae error) {
 
52
        req, err := client.GetPublishingUserPreparer()
 
53
        if err != nil {
 
54
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetPublishingUser", "Failure preparing request")
 
55
        }
 
56
 
 
57
        resp, err := client.GetPublishingUserSender(req)
 
58
        if err != nil {
 
59
                result.Response = autorest.Response{Response: resp}
 
60
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetPublishingUser", "Failure sending request")
 
61
        }
 
62
 
 
63
        result, err = client.GetPublishingUserResponder(resp)
 
64
        if err != nil {
 
65
                ae = autorest.NewErrorWithError(err, "web/ProviderClient", "GetPublishingUser", "Failure responding to request")
 
66
        }
 
67
 
 
68
        return
 
69
}
 
70
 
 
71
// GetPublishingUserPreparer prepares the GetPublishingUser request.
 
72
func (client ProviderClient) GetPublishingUserPreparer() (*http.Request, error) {
 
73
        queryParameters := map[string]interface{}{
 
74
                "api-version": APIVersion,
 
75
        }
 
76
 
 
77
        return autorest.Prepare(&http.Request{},
 
78
                autorest.AsJSON(),
 
79
                autorest.AsGet(),
 
80
                autorest.WithBaseURL(client.BaseURI),
 
81
                autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"),
 
82
                autorest.WithQueryParameters(queryParameters))
 
83
}
 
84
 
 
85
// GetPublishingUserSender sends the GetPublishingUser request. The method will close the
 
86
// http.Response Body if it receives an error.
 
87
func (client ProviderClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) {
 
88
        return client.Send(req, http.StatusOK)
 
89
}
 
90
 
 
91
// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always
 
92
// closes the http.Response Body.
 
93
func (client ProviderClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) {
 
94
        err = autorest.Respond(
 
95
                resp,
 
96
                client.ByInspecting(),
 
97
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
98
                autorest.ByUnmarshallingJSON(&result),
 
99
                autorest.ByClosing())
 
100
        result.Response = autorest.Response{Response: resp}
 
101
        return
 
102
}
 
103
 
 
104
// GetSourceControl sends the get source control request.
 
105
//
 
106
// sourceControlType is type of source control
 
107
func (client ProviderClient) GetSourceControl(sourceControlType string) (result SourceControl, ae error) {
 
108
        req, err := client.GetSourceControlPreparer(sourceControlType)
 
109
        if err != nil {
 
110
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControl", "Failure preparing request")
 
111
        }
 
112
 
 
113
        resp, err := client.GetSourceControlSender(req)
 
114
        if err != nil {
 
115
                result.Response = autorest.Response{Response: resp}
 
116
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControl", "Failure sending request")
 
117
        }
 
118
 
 
119
        result, err = client.GetSourceControlResponder(resp)
 
120
        if err != nil {
 
121
                ae = autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControl", "Failure responding to request")
 
122
        }
 
123
 
 
124
        return
 
125
}
 
126
 
 
127
// GetSourceControlPreparer prepares the GetSourceControl request.
 
128
func (client ProviderClient) GetSourceControlPreparer(sourceControlType string) (*http.Request, error) {
 
129
        pathParameters := map[string]interface{}{
 
130
                "sourceControlType": url.QueryEscape(sourceControlType),
 
131
        }
 
132
 
 
133
        queryParameters := map[string]interface{}{
 
134
                "api-version": APIVersion,
 
135
        }
 
136
 
 
137
        return autorest.Prepare(&http.Request{},
 
138
                autorest.AsJSON(),
 
139
                autorest.AsGet(),
 
140
                autorest.WithBaseURL(client.BaseURI),
 
141
                autorest.WithPath("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}"),
 
142
                autorest.WithPathParameters(pathParameters),
 
143
                autorest.WithQueryParameters(queryParameters))
 
144
}
 
145
 
 
146
// GetSourceControlSender sends the GetSourceControl request. The method will close the
 
147
// http.Response Body if it receives an error.
 
148
func (client ProviderClient) GetSourceControlSender(req *http.Request) (*http.Response, error) {
 
149
        return client.Send(req, http.StatusOK)
 
150
}
 
151
 
 
152
// GetSourceControlResponder handles the response to the GetSourceControl request. The method always
 
153
// closes the http.Response Body.
 
154
func (client ProviderClient) GetSourceControlResponder(resp *http.Response) (result SourceControl, err error) {
 
155
        err = autorest.Respond(
 
156
                resp,
 
157
                client.ByInspecting(),
 
158
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
159
                autorest.ByUnmarshallingJSON(&result),
 
160
                autorest.ByClosing())
 
161
        result.Response = autorest.Response{Response: resp}
 
162
        return
 
163
}
 
164
 
 
165
// GetSourceControls sends the get source controls request.
 
166
func (client ProviderClient) GetSourceControls() (result SourceControlCollection, ae error) {
 
167
        req, err := client.GetSourceControlsPreparer()
 
168
        if err != nil {
 
169
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControls", "Failure preparing request")
 
170
        }
 
171
 
 
172
        resp, err := client.GetSourceControlsSender(req)
 
173
        if err != nil {
 
174
                result.Response = autorest.Response{Response: resp}
 
175
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControls", "Failure sending request")
 
176
        }
 
177
 
 
178
        result, err = client.GetSourceControlsResponder(resp)
 
179
        if err != nil {
 
180
                ae = autorest.NewErrorWithError(err, "web/ProviderClient", "GetSourceControls", "Failure responding to request")
 
181
        }
 
182
 
 
183
        return
 
184
}
 
185
 
 
186
// GetSourceControlsPreparer prepares the GetSourceControls request.
 
187
func (client ProviderClient) GetSourceControlsPreparer() (*http.Request, error) {
 
188
        queryParameters := map[string]interface{}{
 
189
                "api-version": APIVersion,
 
190
        }
 
191
 
 
192
        return autorest.Prepare(&http.Request{},
 
193
                autorest.AsJSON(),
 
194
                autorest.AsGet(),
 
195
                autorest.WithBaseURL(client.BaseURI),
 
196
                autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"),
 
197
                autorest.WithQueryParameters(queryParameters))
 
198
}
 
199
 
 
200
// GetSourceControlsSender sends the GetSourceControls request. The method will close the
 
201
// http.Response Body if it receives an error.
 
202
func (client ProviderClient) GetSourceControlsSender(req *http.Request) (*http.Response, error) {
 
203
        return client.Send(req, http.StatusOK)
 
204
}
 
205
 
 
206
// GetSourceControlsResponder handles the response to the GetSourceControls request. The method always
 
207
// closes the http.Response Body.
 
208
func (client ProviderClient) GetSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) {
 
209
        err = autorest.Respond(
 
210
                resp,
 
211
                client.ByInspecting(),
 
212
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
213
                autorest.ByUnmarshallingJSON(&result),
 
214
                autorest.ByClosing())
 
215
        result.Response = autorest.Response{Response: resp}
 
216
        return
 
217
}
 
218
 
 
219
// UpdatePublishingUser sends the update publishing user request.
 
220
//
 
221
// requestMessage is details of publishing user
 
222
func (client ProviderClient) UpdatePublishingUser(requestMessage User) (result User, ae error) {
 
223
        req, err := client.UpdatePublishingUserPreparer(requestMessage)
 
224
        if err != nil {
 
225
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "UpdatePublishingUser", "Failure preparing request")
 
226
        }
 
227
 
 
228
        resp, err := client.UpdatePublishingUserSender(req)
 
229
        if err != nil {
 
230
                result.Response = autorest.Response{Response: resp}
 
231
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "UpdatePublishingUser", "Failure sending request")
 
232
        }
 
233
 
 
234
        result, err = client.UpdatePublishingUserResponder(resp)
 
235
        if err != nil {
 
236
                ae = autorest.NewErrorWithError(err, "web/ProviderClient", "UpdatePublishingUser", "Failure responding to request")
 
237
        }
 
238
 
 
239
        return
 
240
}
 
241
 
 
242
// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request.
 
243
func (client ProviderClient) UpdatePublishingUserPreparer(requestMessage User) (*http.Request, error) {
 
244
        queryParameters := map[string]interface{}{
 
245
                "api-version": APIVersion,
 
246
        }
 
247
 
 
248
        return autorest.Prepare(&http.Request{},
 
249
                autorest.AsJSON(),
 
250
                autorest.AsPut(),
 
251
                autorest.WithBaseURL(client.BaseURI),
 
252
                autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"),
 
253
                autorest.WithJSON(requestMessage),
 
254
                autorest.WithQueryParameters(queryParameters))
 
255
}
 
256
 
 
257
// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the
 
258
// http.Response Body if it receives an error.
 
259
func (client ProviderClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) {
 
260
        return client.Send(req, http.StatusOK)
 
261
}
 
262
 
 
263
// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always
 
264
// closes the http.Response Body.
 
265
func (client ProviderClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) {
 
266
        err = autorest.Respond(
 
267
                resp,
 
268
                client.ByInspecting(),
 
269
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
270
                autorest.ByUnmarshallingJSON(&result),
 
271
                autorest.ByClosing())
 
272
        result.Response = autorest.Response{Response: resp}
 
273
        return
 
274
}
 
275
 
 
276
// UpdateSourceControl sends the update source control request.
 
277
//
 
278
// sourceControlType is type of source control requestMessage is source
 
279
// control token information
 
280
func (client ProviderClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, ae error) {
 
281
        req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage)
 
282
        if err != nil {
 
283
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "UpdateSourceControl", "Failure preparing request")
 
284
        }
 
285
 
 
286
        resp, err := client.UpdateSourceControlSender(req)
 
287
        if err != nil {
 
288
                result.Response = autorest.Response{Response: resp}
 
289
                return result, autorest.NewErrorWithError(err, "web/ProviderClient", "UpdateSourceControl", "Failure sending request")
 
290
        }
 
291
 
 
292
        result, err = client.UpdateSourceControlResponder(resp)
 
293
        if err != nil {
 
294
                ae = autorest.NewErrorWithError(err, "web/ProviderClient", "UpdateSourceControl", "Failure responding to request")
 
295
        }
 
296
 
 
297
        return
 
298
}
 
299
 
 
300
// UpdateSourceControlPreparer prepares the UpdateSourceControl request.
 
301
func (client ProviderClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) {
 
302
        pathParameters := map[string]interface{}{
 
303
                "sourceControlType": url.QueryEscape(sourceControlType),
 
304
        }
 
305
 
 
306
        queryParameters := map[string]interface{}{
 
307
                "api-version": APIVersion,
 
308
        }
 
309
 
 
310
        return autorest.Prepare(&http.Request{},
 
311
                autorest.AsJSON(),
 
312
                autorest.AsPut(),
 
313
                autorest.WithBaseURL(client.BaseURI),
 
314
                autorest.WithPath("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}"),
 
315
                autorest.WithJSON(requestMessage),
 
316
                autorest.WithPathParameters(pathParameters),
 
317
                autorest.WithQueryParameters(queryParameters))
 
318
}
 
319
 
 
320
// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the
 
321
// http.Response Body if it receives an error.
 
322
func (client ProviderClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) {
 
323
        return client.Send(req, http.StatusOK)
 
324
}
 
325
 
 
326
// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always
 
327
// closes the http.Response Body.
 
328
func (client ProviderClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) {
 
329
        err = autorest.Respond(
 
330
                resp,
 
331
                client.ByInspecting(),
 
332
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
333
                autorest.ByUnmarshallingJSON(&result),
 
334
                autorest.ByClosing())
 
335
        result.Response = autorest.Response{Response: resp}
 
336
        return
 
337
}