~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/authorization/managementlocks.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 authorization
 
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
// ManagementLocksClient is the client for the ManagementLocks methods of the
 
28
// Authorization service.
 
29
type ManagementLocksClient struct {
 
30
        ManagementClient
 
31
}
 
32
 
 
33
// NewManagementLocksClient creates an instance of the ManagementLocksClient
 
34
// client.
 
35
func NewManagementLocksClient(subscriptionID string) ManagementLocksClient {
 
36
        return NewManagementLocksClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
37
}
 
38
 
 
39
// NewManagementLocksClientWithBaseURI creates an instance of the
 
40
// ManagementLocksClient client.
 
41
func NewManagementLocksClientWithBaseURI(baseURI string, subscriptionID string) ManagementLocksClient {
 
42
        return ManagementLocksClient{NewWithBaseURI(baseURI, subscriptionID)}
 
43
}
 
44
 
 
45
// CreateOrUpdateAtResourceGroupLevel create or update a management lock at
 
46
// the resource group level.
 
47
//
 
48
// resourceGroupName is the resource group name. lockName is the lock name.
 
49
// parameters is the management lock parameters.
 
50
func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevel(resourceGroupName string, lockName string, parameters ManagementLockProperties) (result ManagementLockObject, ae error) {
 
51
        req, err := client.CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName, lockName, parameters)
 
52
        if err != nil {
 
53
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", "Failure preparing request")
 
54
        }
 
55
 
 
56
        resp, err := client.CreateOrUpdateAtResourceGroupLevelSender(req)
 
57
        if err != nil {
 
58
                result.Response = autorest.Response{Response: resp}
 
59
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", "Failure sending request")
 
60
        }
 
61
 
 
62
        result, err = client.CreateOrUpdateAtResourceGroupLevelResponder(resp)
 
63
        if err != nil {
 
64
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", "Failure responding to request")
 
65
        }
 
66
 
 
67
        return
 
68
}
 
69
 
 
70
// CreateOrUpdateAtResourceGroupLevelPreparer prepares the CreateOrUpdateAtResourceGroupLevel request.
 
71
func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName string, lockName string, parameters ManagementLockProperties) (*http.Request, error) {
 
72
        pathParameters := map[string]interface{}{
 
73
                "lockName":          url.QueryEscape(lockName),
 
74
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
75
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
76
        }
 
77
 
 
78
        queryParameters := map[string]interface{}{
 
79
                "api-version": APIVersion,
 
80
        }
 
81
 
 
82
        return autorest.Prepare(&http.Request{},
 
83
                autorest.AsJSON(),
 
84
                autorest.AsPut(),
 
85
                autorest.WithBaseURL(client.BaseURI),
 
86
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}"),
 
87
                autorest.WithJSON(parameters),
 
88
                autorest.WithPathParameters(pathParameters),
 
89
                autorest.WithQueryParameters(queryParameters))
 
90
}
 
91
 
 
92
// CreateOrUpdateAtResourceGroupLevelSender sends the CreateOrUpdateAtResourceGroupLevel request. The method will close the
 
93
// http.Response Body if it receives an error.
 
94
func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) {
 
95
        return client.Send(req, http.StatusOK, http.StatusCreated)
 
96
}
 
97
 
 
98
// CreateOrUpdateAtResourceGroupLevelResponder handles the response to the CreateOrUpdateAtResourceGroupLevel request. The method always
 
99
// closes the http.Response Body.
 
100
func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) {
 
101
        err = autorest.Respond(
 
102
                resp,
 
103
                client.ByInspecting(),
 
104
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
 
105
                autorest.ByUnmarshallingJSON(&result),
 
106
                autorest.ByClosing())
 
107
        result.Response = autorest.Response{Response: resp}
 
108
        return
 
109
}
 
110
 
 
111
// CreateOrUpdateAtResourceLevel create or update a management lock at the
 
112
// resource level or any level below resource.
 
113
//
 
114
// resourceGroupName is the name of the resource group.
 
115
// resourceProviderNamespace is resource identity. parentResourcePath is
 
116
// resource identity. resourceType is resource identity. resourceName is
 
117
// resource identity. lockName is the name of lock. parameters is create or
 
118
// update management lock parameters.
 
119
func (client ManagementLocksClient) CreateOrUpdateAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockProperties) (result ManagementLockObject, ae error) {
 
120
        req, err := client.CreateOrUpdateAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters)
 
121
        if err != nil {
 
122
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceLevel", "Failure preparing request")
 
123
        }
 
124
 
 
125
        resp, err := client.CreateOrUpdateAtResourceLevelSender(req)
 
126
        if err != nil {
 
127
                result.Response = autorest.Response{Response: resp}
 
128
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceLevel", "Failure sending request")
 
129
        }
 
130
 
 
131
        result, err = client.CreateOrUpdateAtResourceLevelResponder(resp)
 
132
        if err != nil {
 
133
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtResourceLevel", "Failure responding to request")
 
134
        }
 
135
 
 
136
        return
 
137
}
 
138
 
 
139
// CreateOrUpdateAtResourceLevelPreparer prepares the CreateOrUpdateAtResourceLevel request.
 
140
func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockProperties) (*http.Request, error) {
 
141
        pathParameters := map[string]interface{}{
 
142
                "lockName":                  url.QueryEscape(lockName),
 
143
                "parentResourcePath":        parentResourcePath,
 
144
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
145
                "resourceName":              url.QueryEscape(resourceName),
 
146
                "resourceProviderNamespace": url.QueryEscape(resourceProviderNamespace),
 
147
                "resourceType":              resourceType,
 
148
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
149
        }
 
150
 
 
151
        queryParameters := map[string]interface{}{
 
152
                "api-version": APIVersion,
 
153
        }
 
154
 
 
155
        return autorest.Prepare(&http.Request{},
 
156
                autorest.AsJSON(),
 
157
                autorest.AsPut(),
 
158
                autorest.WithBaseURL(client.BaseURI),
 
159
                autorest.WithPath("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}"),
 
160
                autorest.WithJSON(parameters),
 
161
                autorest.WithPathParameters(pathParameters),
 
162
                autorest.WithQueryParameters(queryParameters))
 
163
}
 
164
 
 
165
// CreateOrUpdateAtResourceLevelSender sends the CreateOrUpdateAtResourceLevel request. The method will close the
 
166
// http.Response Body if it receives an error.
 
167
func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelSender(req *http.Request) (*http.Response, error) {
 
168
        return client.Send(req, http.StatusOK, http.StatusCreated)
 
169
}
 
170
 
 
171
// CreateOrUpdateAtResourceLevelResponder handles the response to the CreateOrUpdateAtResourceLevel request. The method always
 
172
// closes the http.Response Body.
 
173
func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) {
 
174
        err = autorest.Respond(
 
175
                resp,
 
176
                client.ByInspecting(),
 
177
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
 
178
                autorest.ByUnmarshallingJSON(&result),
 
179
                autorest.ByClosing())
 
180
        result.Response = autorest.Response{Response: resp}
 
181
        return
 
182
}
 
183
 
 
184
// CreateOrUpdateAtSubscriptionLevel create or update a management lock at the
 
185
// subscription level.
 
186
//
 
187
// lockName is the name of lock. parameters is the management lock parameters.
 
188
func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevel(lockName string, parameters ManagementLockProperties) (result ManagementLockObject, ae error) {
 
189
        req, err := client.CreateOrUpdateAtSubscriptionLevelPreparer(lockName, parameters)
 
190
        if err != nil {
 
191
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", "Failure preparing request")
 
192
        }
 
193
 
 
194
        resp, err := client.CreateOrUpdateAtSubscriptionLevelSender(req)
 
195
        if err != nil {
 
196
                result.Response = autorest.Response{Response: resp}
 
197
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", "Failure sending request")
 
198
        }
 
199
 
 
200
        result, err = client.CreateOrUpdateAtSubscriptionLevelResponder(resp)
 
201
        if err != nil {
 
202
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", "Failure responding to request")
 
203
        }
 
204
 
 
205
        return
 
206
}
 
207
 
 
208
// CreateOrUpdateAtSubscriptionLevelPreparer prepares the CreateOrUpdateAtSubscriptionLevel request.
 
209
func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelPreparer(lockName string, parameters ManagementLockProperties) (*http.Request, error) {
 
210
        pathParameters := map[string]interface{}{
 
211
                "lockName":       url.QueryEscape(lockName),
 
212
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
213
        }
 
214
 
 
215
        queryParameters := map[string]interface{}{
 
216
                "api-version": APIVersion,
 
217
        }
 
218
 
 
219
        return autorest.Prepare(&http.Request{},
 
220
                autorest.AsJSON(),
 
221
                autorest.AsPut(),
 
222
                autorest.WithBaseURL(client.BaseURI),
 
223
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}"),
 
224
                autorest.WithJSON(parameters),
 
225
                autorest.WithPathParameters(pathParameters),
 
226
                autorest.WithQueryParameters(queryParameters))
 
227
}
 
228
 
 
229
// CreateOrUpdateAtSubscriptionLevelSender sends the CreateOrUpdateAtSubscriptionLevel request. The method will close the
 
230
// http.Response Body if it receives an error.
 
231
func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) {
 
232
        return client.Send(req, http.StatusCreated, http.StatusOK)
 
233
}
 
234
 
 
235
// CreateOrUpdateAtSubscriptionLevelResponder handles the response to the CreateOrUpdateAtSubscriptionLevel request. The method always
 
236
// closes the http.Response Body.
 
237
func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) {
 
238
        err = autorest.Respond(
 
239
                resp,
 
240
                client.ByInspecting(),
 
241
                autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
 
242
                autorest.ByUnmarshallingJSON(&result),
 
243
                autorest.ByClosing())
 
244
        result.Response = autorest.Response{Response: resp}
 
245
        return
 
246
}
 
247
 
 
248
// DeleteAtResourceGroupLevel deletes the management lock of a resource group.
 
249
//
 
250
// resourceGroup is the resource group names. lockName is the name of lock.
 
251
func (client ManagementLocksClient) DeleteAtResourceGroupLevel(resourceGroup string, lockName string) (result autorest.Response, ae error) {
 
252
        req, err := client.DeleteAtResourceGroupLevelPreparer(resourceGroup, lockName)
 
253
        if err != nil {
 
254
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceGroupLevel", "Failure preparing request")
 
255
        }
 
256
 
 
257
        resp, err := client.DeleteAtResourceGroupLevelSender(req)
 
258
        if err != nil {
 
259
                result.Response = resp
 
260
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceGroupLevel", "Failure sending request")
 
261
        }
 
262
 
 
263
        result, err = client.DeleteAtResourceGroupLevelResponder(resp)
 
264
        if err != nil {
 
265
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceGroupLevel", "Failure responding to request")
 
266
        }
 
267
 
 
268
        return
 
269
}
 
270
 
 
271
// DeleteAtResourceGroupLevelPreparer prepares the DeleteAtResourceGroupLevel request.
 
272
func (client ManagementLocksClient) DeleteAtResourceGroupLevelPreparer(resourceGroup string, lockName string) (*http.Request, error) {
 
273
        pathParameters := map[string]interface{}{
 
274
                "lockName":       url.QueryEscape(lockName),
 
275
                "resourceGroup":  url.QueryEscape(resourceGroup),
 
276
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
277
        }
 
278
 
 
279
        queryParameters := map[string]interface{}{
 
280
                "api-version": APIVersion,
 
281
        }
 
282
 
 
283
        return autorest.Prepare(&http.Request{},
 
284
                autorest.AsJSON(),
 
285
                autorest.AsDelete(),
 
286
                autorest.WithBaseURL(client.BaseURI),
 
287
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Authorization/locks/{lockName}"),
 
288
                autorest.WithPathParameters(pathParameters),
 
289
                autorest.WithQueryParameters(queryParameters))
 
290
}
 
291
 
 
292
// DeleteAtResourceGroupLevelSender sends the DeleteAtResourceGroupLevel request. The method will close the
 
293
// http.Response Body if it receives an error.
 
294
func (client ManagementLocksClient) DeleteAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) {
 
295
        return client.Send(req, http.StatusNoContent, http.StatusOK, http.StatusAccepted)
 
296
}
 
297
 
 
298
// DeleteAtResourceGroupLevelResponder handles the response to the DeleteAtResourceGroupLevel request. The method always
 
299
// closes the http.Response Body.
 
300
func (client ManagementLocksClient) DeleteAtResourceGroupLevelResponder(resp *http.Response) (result autorest.Response, err error) {
 
301
        err = autorest.Respond(
 
302
                resp,
 
303
                client.ByInspecting(),
 
304
                autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted),
 
305
                autorest.ByClosing())
 
306
        result.Response = resp
 
307
        return
 
308
}
 
309
 
 
310
// DeleteAtResourceLevel deletes the management lock of a resource or any
 
311
// level below resource.
 
312
//
 
313
// resourceGroupName is the name of the resource group.
 
314
// resourceProviderNamespace is resource identity. parentResourcePath is
 
315
// resource identity. resourceType is resource identity. resourceName is
 
316
// resource identity. lockName is the name of lock.
 
317
func (client ManagementLocksClient) DeleteAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result autorest.Response, ae error) {
 
318
        req, err := client.DeleteAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName)
 
319
        if err != nil {
 
320
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceLevel", "Failure preparing request")
 
321
        }
 
322
 
 
323
        resp, err := client.DeleteAtResourceLevelSender(req)
 
324
        if err != nil {
 
325
                result.Response = resp
 
326
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceLevel", "Failure sending request")
 
327
        }
 
328
 
 
329
        result, err = client.DeleteAtResourceLevelResponder(resp)
 
330
        if err != nil {
 
331
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtResourceLevel", "Failure responding to request")
 
332
        }
 
333
 
 
334
        return
 
335
}
 
336
 
 
337
// DeleteAtResourceLevelPreparer prepares the DeleteAtResourceLevel request.
 
338
func (client ManagementLocksClient) DeleteAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) {
 
339
        pathParameters := map[string]interface{}{
 
340
                "lockName":                  url.QueryEscape(lockName),
 
341
                "parentResourcePath":        parentResourcePath,
 
342
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
343
                "resourceName":              url.QueryEscape(resourceName),
 
344
                "resourceProviderNamespace": url.QueryEscape(resourceProviderNamespace),
 
345
                "resourceType":              resourceType,
 
346
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
347
        }
 
348
 
 
349
        queryParameters := map[string]interface{}{
 
350
                "api-version": APIVersion,
 
351
        }
 
352
 
 
353
        return autorest.Prepare(&http.Request{},
 
354
                autorest.AsJSON(),
 
355
                autorest.AsDelete(),
 
356
                autorest.WithBaseURL(client.BaseURI),
 
357
                autorest.WithPath("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}"),
 
358
                autorest.WithPathParameters(pathParameters),
 
359
                autorest.WithQueryParameters(queryParameters))
 
360
}
 
361
 
 
362
// DeleteAtResourceLevelSender sends the DeleteAtResourceLevel request. The method will close the
 
363
// http.Response Body if it receives an error.
 
364
func (client ManagementLocksClient) DeleteAtResourceLevelSender(req *http.Request) (*http.Response, error) {
 
365
        return client.Send(req, http.StatusNoContent, http.StatusOK, http.StatusAccepted)
 
366
}
 
367
 
 
368
// DeleteAtResourceLevelResponder handles the response to the DeleteAtResourceLevel request. The method always
 
369
// closes the http.Response Body.
 
370
func (client ManagementLocksClient) DeleteAtResourceLevelResponder(resp *http.Response) (result autorest.Response, err error) {
 
371
        err = autorest.Respond(
 
372
                resp,
 
373
                client.ByInspecting(),
 
374
                autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted),
 
375
                autorest.ByClosing())
 
376
        result.Response = resp
 
377
        return
 
378
}
 
379
 
 
380
// DeleteAtSubscriptionLevel deletes the management lock of a subscription.
 
381
//
 
382
// lockName is the name of lock.
 
383
func (client ManagementLocksClient) DeleteAtSubscriptionLevel(lockName string) (result autorest.Response, ae error) {
 
384
        req, err := client.DeleteAtSubscriptionLevelPreparer(lockName)
 
385
        if err != nil {
 
386
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtSubscriptionLevel", "Failure preparing request")
 
387
        }
 
388
 
 
389
        resp, err := client.DeleteAtSubscriptionLevelSender(req)
 
390
        if err != nil {
 
391
                result.Response = resp
 
392
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtSubscriptionLevel", "Failure sending request")
 
393
        }
 
394
 
 
395
        result, err = client.DeleteAtSubscriptionLevelResponder(resp)
 
396
        if err != nil {
 
397
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "DeleteAtSubscriptionLevel", "Failure responding to request")
 
398
        }
 
399
 
 
400
        return
 
401
}
 
402
 
 
403
// DeleteAtSubscriptionLevelPreparer prepares the DeleteAtSubscriptionLevel request.
 
404
func (client ManagementLocksClient) DeleteAtSubscriptionLevelPreparer(lockName string) (*http.Request, error) {
 
405
        pathParameters := map[string]interface{}{
 
406
                "lockName":       url.QueryEscape(lockName),
 
407
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
408
        }
 
409
 
 
410
        queryParameters := map[string]interface{}{
 
411
                "api-version": APIVersion,
 
412
        }
 
413
 
 
414
        return autorest.Prepare(&http.Request{},
 
415
                autorest.AsJSON(),
 
416
                autorest.AsDelete(),
 
417
                autorest.WithBaseURL(client.BaseURI),
 
418
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}"),
 
419
                autorest.WithPathParameters(pathParameters),
 
420
                autorest.WithQueryParameters(queryParameters))
 
421
}
 
422
 
 
423
// DeleteAtSubscriptionLevelSender sends the DeleteAtSubscriptionLevel request. The method will close the
 
424
// http.Response Body if it receives an error.
 
425
func (client ManagementLocksClient) DeleteAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) {
 
426
        return client.Send(req, http.StatusNoContent, http.StatusOK, http.StatusAccepted)
 
427
}
 
428
 
 
429
// DeleteAtSubscriptionLevelResponder handles the response to the DeleteAtSubscriptionLevel request. The method always
 
430
// closes the http.Response Body.
 
431
func (client ManagementLocksClient) DeleteAtSubscriptionLevelResponder(resp *http.Response) (result autorest.Response, err error) {
 
432
        err = autorest.Respond(
 
433
                resp,
 
434
                client.ByInspecting(),
 
435
                autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted),
 
436
                autorest.ByClosing())
 
437
        result.Response = resp
 
438
        return
 
439
}
 
440
 
 
441
// Get gets the management lock of a scope.
 
442
//
 
443
// lockName is name of the management lock.
 
444
func (client ManagementLocksClient) Get(lockName string) (result ManagementLockObject, ae error) {
 
445
        req, err := client.GetPreparer(lockName)
 
446
        if err != nil {
 
447
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "Get", "Failure preparing request")
 
448
        }
 
449
 
 
450
        resp, err := client.GetSender(req)
 
451
        if err != nil {
 
452
                result.Response = autorest.Response{Response: resp}
 
453
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "Get", "Failure sending request")
 
454
        }
 
455
 
 
456
        result, err = client.GetResponder(resp)
 
457
        if err != nil {
 
458
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "Get", "Failure responding to request")
 
459
        }
 
460
 
 
461
        return
 
462
}
 
463
 
 
464
// GetPreparer prepares the Get request.
 
465
func (client ManagementLocksClient) GetPreparer(lockName string) (*http.Request, error) {
 
466
        pathParameters := map[string]interface{}{
 
467
                "lockName":       url.QueryEscape(lockName),
 
468
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
469
        }
 
470
 
 
471
        queryParameters := map[string]interface{}{
 
472
                "api-version": APIVersion,
 
473
        }
 
474
 
 
475
        return autorest.Prepare(&http.Request{},
 
476
                autorest.AsJSON(),
 
477
                autorest.AsGet(),
 
478
                autorest.WithBaseURL(client.BaseURI),
 
479
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}"),
 
480
                autorest.WithPathParameters(pathParameters),
 
481
                autorest.WithQueryParameters(queryParameters))
 
482
}
 
483
 
 
484
// GetSender sends the Get request. The method will close the
 
485
// http.Response Body if it receives an error.
 
486
func (client ManagementLocksClient) GetSender(req *http.Request) (*http.Response, error) {
 
487
        return client.Send(req, http.StatusOK, http.StatusNoContent)
 
488
}
 
489
 
 
490
// GetResponder handles the response to the Get request. The method always
 
491
// closes the http.Response Body.
 
492
func (client ManagementLocksClient) GetResponder(resp *http.Response) (result ManagementLockObject, err error) {
 
493
        err = autorest.Respond(
 
494
                resp,
 
495
                client.ByInspecting(),
 
496
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
 
497
                autorest.ByUnmarshallingJSON(&result),
 
498
                autorest.ByClosing())
 
499
        result.Response = autorest.Response{Response: resp}
 
500
        return
 
501
}
 
502
 
 
503
// ListAtResourceGroupLevel gets all the management locks of a resource group.
 
504
//
 
505
// resourceGroupName is resource group name. filter is the filter to apply on
 
506
// the operation.
 
507
func (client ManagementLocksClient) ListAtResourceGroupLevel(resourceGroupName string, filter string) (result ManagementLockListResult, ae error) {
 
508
        req, err := client.ListAtResourceGroupLevelPreparer(resourceGroupName, filter)
 
509
        if err != nil {
 
510
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure preparing request")
 
511
        }
 
512
 
 
513
        resp, err := client.ListAtResourceGroupLevelSender(req)
 
514
        if err != nil {
 
515
                result.Response = autorest.Response{Response: resp}
 
516
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure sending request")
 
517
        }
 
518
 
 
519
        result, err = client.ListAtResourceGroupLevelResponder(resp)
 
520
        if err != nil {
 
521
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure responding to request")
 
522
        }
 
523
 
 
524
        return
 
525
}
 
526
 
 
527
// ListAtResourceGroupLevelPreparer prepares the ListAtResourceGroupLevel request.
 
528
func (client ManagementLocksClient) ListAtResourceGroupLevelPreparer(resourceGroupName string, filter string) (*http.Request, error) {
 
529
        pathParameters := map[string]interface{}{
 
530
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
531
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
532
        }
 
533
 
 
534
        queryParameters := map[string]interface{}{
 
535
                "api-version": APIVersion,
 
536
        }
 
537
        if len(filter) > 0 {
 
538
                queryParameters["$filter"] = filter
 
539
        }
 
540
 
 
541
        return autorest.Prepare(&http.Request{},
 
542
                autorest.AsJSON(),
 
543
                autorest.AsGet(),
 
544
                autorest.WithBaseURL(client.BaseURI),
 
545
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks"),
 
546
                autorest.WithPathParameters(pathParameters),
 
547
                autorest.WithQueryParameters(queryParameters))
 
548
}
 
549
 
 
550
// ListAtResourceGroupLevelSender sends the ListAtResourceGroupLevel request. The method will close the
 
551
// http.Response Body if it receives an error.
 
552
func (client ManagementLocksClient) ListAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) {
 
553
        return client.Send(req, http.StatusOK)
 
554
}
 
555
 
 
556
// ListAtResourceGroupLevelResponder handles the response to the ListAtResourceGroupLevel request. The method always
 
557
// closes the http.Response Body.
 
558
func (client ManagementLocksClient) ListAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) {
 
559
        err = autorest.Respond(
 
560
                resp,
 
561
                client.ByInspecting(),
 
562
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
563
                autorest.ByUnmarshallingJSON(&result),
 
564
                autorest.ByClosing())
 
565
        result.Response = autorest.Response{Response: resp}
 
566
        return
 
567
}
 
568
 
 
569
// ListAtResourceGroupLevelNextResults retrieves the next set of results, if any.
 
570
func (client ManagementLocksClient) ListAtResourceGroupLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, ae error) {
 
571
        req, err := lastResults.ManagementLockListResultPreparer()
 
572
        if err != nil {
 
573
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure preparing next results request request")
 
574
        }
 
575
        if req == nil {
 
576
                return
 
577
        }
 
578
 
 
579
        resp, err := client.ListAtResourceGroupLevelSender(req)
 
580
        if err != nil {
 
581
                result.Response = autorest.Response{Response: resp}
 
582
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure sending next results request request")
 
583
        }
 
584
 
 
585
        result, err = client.ListAtResourceGroupLevelResponder(resp)
 
586
        if err != nil {
 
587
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceGroupLevel", "Failure responding to next results request request")
 
588
        }
 
589
 
 
590
        return
 
591
}
 
592
 
 
593
// ListAtResourceLevel gets all the management locks of a resource or any
 
594
// level below resource.
 
595
//
 
596
// resourceGroupName is the name of the resource group. The name is case
 
597
// insensitive. resourceProviderNamespace is resource identity.
 
598
// parentResourcePath is resource identity. resourceType is resource
 
599
// identity. resourceName is resource identity. filter is the filter to apply
 
600
// on the operation.
 
601
func (client ManagementLocksClient) ListAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ManagementLockListResult, ae error) {
 
602
        req, err := client.ListAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter)
 
603
        if err != nil {
 
604
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure preparing request")
 
605
        }
 
606
 
 
607
        resp, err := client.ListAtResourceLevelSender(req)
 
608
        if err != nil {
 
609
                result.Response = autorest.Response{Response: resp}
 
610
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure sending request")
 
611
        }
 
612
 
 
613
        result, err = client.ListAtResourceLevelResponder(resp)
 
614
        if err != nil {
 
615
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure responding to request")
 
616
        }
 
617
 
 
618
        return
 
619
}
 
620
 
 
621
// ListAtResourceLevelPreparer prepares the ListAtResourceLevel request.
 
622
func (client ManagementLocksClient) ListAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) {
 
623
        pathParameters := map[string]interface{}{
 
624
                "parentResourcePath":        parentResourcePath,
 
625
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
626
                "resourceName":              url.QueryEscape(resourceName),
 
627
                "resourceProviderNamespace": url.QueryEscape(resourceProviderNamespace),
 
628
                "resourceType":              resourceType,
 
629
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
630
        }
 
631
 
 
632
        queryParameters := map[string]interface{}{
 
633
                "api-version": APIVersion,
 
634
        }
 
635
        if len(filter) > 0 {
 
636
                queryParameters["$filter"] = filter
 
637
        }
 
638
 
 
639
        return autorest.Prepare(&http.Request{},
 
640
                autorest.AsJSON(),
 
641
                autorest.AsGet(),
 
642
                autorest.WithBaseURL(client.BaseURI),
 
643
                autorest.WithPath("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks"),
 
644
                autorest.WithPathParameters(pathParameters),
 
645
                autorest.WithQueryParameters(queryParameters))
 
646
}
 
647
 
 
648
// ListAtResourceLevelSender sends the ListAtResourceLevel request. The method will close the
 
649
// http.Response Body if it receives an error.
 
650
func (client ManagementLocksClient) ListAtResourceLevelSender(req *http.Request) (*http.Response, error) {
 
651
        return client.Send(req, http.StatusOK)
 
652
}
 
653
 
 
654
// ListAtResourceLevelResponder handles the response to the ListAtResourceLevel request. The method always
 
655
// closes the http.Response Body.
 
656
func (client ManagementLocksClient) ListAtResourceLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) {
 
657
        err = autorest.Respond(
 
658
                resp,
 
659
                client.ByInspecting(),
 
660
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
661
                autorest.ByUnmarshallingJSON(&result),
 
662
                autorest.ByClosing())
 
663
        result.Response = autorest.Response{Response: resp}
 
664
        return
 
665
}
 
666
 
 
667
// ListAtResourceLevelNextResults retrieves the next set of results, if any.
 
668
func (client ManagementLocksClient) ListAtResourceLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, ae error) {
 
669
        req, err := lastResults.ManagementLockListResultPreparer()
 
670
        if err != nil {
 
671
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure preparing next results request request")
 
672
        }
 
673
        if req == nil {
 
674
                return
 
675
        }
 
676
 
 
677
        resp, err := client.ListAtResourceLevelSender(req)
 
678
        if err != nil {
 
679
                result.Response = autorest.Response{Response: resp}
 
680
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure sending next results request request")
 
681
        }
 
682
 
 
683
        result, err = client.ListAtResourceLevelResponder(resp)
 
684
        if err != nil {
 
685
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtResourceLevel", "Failure responding to next results request request")
 
686
        }
 
687
 
 
688
        return
 
689
}
 
690
 
 
691
// ListAtSubscriptionLevel gets all the management locks of a subscription.
 
692
//
 
693
// filter is the filter to apply on the operation.
 
694
func (client ManagementLocksClient) ListAtSubscriptionLevel(filter string) (result ManagementLockListResult, ae error) {
 
695
        req, err := client.ListAtSubscriptionLevelPreparer(filter)
 
696
        if err != nil {
 
697
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure preparing request")
 
698
        }
 
699
 
 
700
        resp, err := client.ListAtSubscriptionLevelSender(req)
 
701
        if err != nil {
 
702
                result.Response = autorest.Response{Response: resp}
 
703
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure sending request")
 
704
        }
 
705
 
 
706
        result, err = client.ListAtSubscriptionLevelResponder(resp)
 
707
        if err != nil {
 
708
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure responding to request")
 
709
        }
 
710
 
 
711
        return
 
712
}
 
713
 
 
714
// ListAtSubscriptionLevelPreparer prepares the ListAtSubscriptionLevel request.
 
715
func (client ManagementLocksClient) ListAtSubscriptionLevelPreparer(filter string) (*http.Request, error) {
 
716
        pathParameters := map[string]interface{}{
 
717
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
718
        }
 
719
 
 
720
        queryParameters := map[string]interface{}{
 
721
                "api-version": APIVersion,
 
722
        }
 
723
        if len(filter) > 0 {
 
724
                queryParameters["$filter"] = filter
 
725
        }
 
726
 
 
727
        return autorest.Prepare(&http.Request{},
 
728
                autorest.AsJSON(),
 
729
                autorest.AsGet(),
 
730
                autorest.WithBaseURL(client.BaseURI),
 
731
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks"),
 
732
                autorest.WithPathParameters(pathParameters),
 
733
                autorest.WithQueryParameters(queryParameters))
 
734
}
 
735
 
 
736
// ListAtSubscriptionLevelSender sends the ListAtSubscriptionLevel request. The method will close the
 
737
// http.Response Body if it receives an error.
 
738
func (client ManagementLocksClient) ListAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) {
 
739
        return client.Send(req, http.StatusOK)
 
740
}
 
741
 
 
742
// ListAtSubscriptionLevelResponder handles the response to the ListAtSubscriptionLevel request. The method always
 
743
// closes the http.Response Body.
 
744
func (client ManagementLocksClient) ListAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) {
 
745
        err = autorest.Respond(
 
746
                resp,
 
747
                client.ByInspecting(),
 
748
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
749
                autorest.ByUnmarshallingJSON(&result),
 
750
                autorest.ByClosing())
 
751
        result.Response = autorest.Response{Response: resp}
 
752
        return
 
753
}
 
754
 
 
755
// ListAtSubscriptionLevelNextResults retrieves the next set of results, if any.
 
756
func (client ManagementLocksClient) ListAtSubscriptionLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, ae error) {
 
757
        req, err := lastResults.ManagementLockListResultPreparer()
 
758
        if err != nil {
 
759
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure preparing next results request request")
 
760
        }
 
761
        if req == nil {
 
762
                return
 
763
        }
 
764
 
 
765
        resp, err := client.ListAtSubscriptionLevelSender(req)
 
766
        if err != nil {
 
767
                result.Response = autorest.Response{Response: resp}
 
768
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure sending next results request request")
 
769
        }
 
770
 
 
771
        result, err = client.ListAtSubscriptionLevelResponder(resp)
 
772
        if err != nil {
 
773
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListAtSubscriptionLevel", "Failure responding to next results request request")
 
774
        }
 
775
 
 
776
        return
 
777
}
 
778
 
 
779
// ListNext get a list of management locks at resource level or below.
 
780
//
 
781
// nextLink is nextLink from the previous successful call to List operation.
 
782
func (client ManagementLocksClient) ListNext(nextLink string) (result ManagementLockListResult, ae error) {
 
783
        req, err := client.ListNextPreparer(nextLink)
 
784
        if err != nil {
 
785
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure preparing request")
 
786
        }
 
787
 
 
788
        resp, err := client.ListNextSender(req)
 
789
        if err != nil {
 
790
                result.Response = autorest.Response{Response: resp}
 
791
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure sending request")
 
792
        }
 
793
 
 
794
        result, err = client.ListNextResponder(resp)
 
795
        if err != nil {
 
796
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure responding to request")
 
797
        }
 
798
 
 
799
        return
 
800
}
 
801
 
 
802
// ListNextPreparer prepares the ListNext request.
 
803
func (client ManagementLocksClient) ListNextPreparer(nextLink string) (*http.Request, error) {
 
804
        pathParameters := map[string]interface{}{
 
805
                "nextLink":       nextLink,
 
806
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
807
        }
 
808
 
 
809
        return autorest.Prepare(&http.Request{},
 
810
                autorest.AsJSON(),
 
811
                autorest.AsGet(),
 
812
                autorest.WithBaseURL(client.BaseURI),
 
813
                autorest.WithPath("/{nextLink}"),
 
814
                autorest.WithPathParameters(pathParameters))
 
815
}
 
816
 
 
817
// ListNextSender sends the ListNext request. The method will close the
 
818
// http.Response Body if it receives an error.
 
819
func (client ManagementLocksClient) ListNextSender(req *http.Request) (*http.Response, error) {
 
820
        return client.Send(req, http.StatusOK)
 
821
}
 
822
 
 
823
// ListNextResponder handles the response to the ListNext request. The method always
 
824
// closes the http.Response Body.
 
825
func (client ManagementLocksClient) ListNextResponder(resp *http.Response) (result ManagementLockListResult, err error) {
 
826
        err = autorest.Respond(
 
827
                resp,
 
828
                client.ByInspecting(),
 
829
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
830
                autorest.ByUnmarshallingJSON(&result),
 
831
                autorest.ByClosing())
 
832
        result.Response = autorest.Response{Response: resp}
 
833
        return
 
834
}
 
835
 
 
836
// ListNextNextResults retrieves the next set of results, if any.
 
837
func (client ManagementLocksClient) ListNextNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, ae error) {
 
838
        req, err := lastResults.ManagementLockListResultPreparer()
 
839
        if err != nil {
 
840
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure preparing next results request request")
 
841
        }
 
842
        if req == nil {
 
843
                return
 
844
        }
 
845
 
 
846
        resp, err := client.ListNextSender(req)
 
847
        if err != nil {
 
848
                result.Response = autorest.Response{Response: resp}
 
849
                return result, autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure sending next results request request")
 
850
        }
 
851
 
 
852
        result, err = client.ListNextResponder(resp)
 
853
        if err != nil {
 
854
                ae = autorest.NewErrorWithError(err, "authorization/ManagementLocksClient", "ListNext", "Failure responding to next results request request")
 
855
        }
 
856
 
 
857
        return
 
858
}