~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.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 storage
 
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
// AccountsClient is the the Storage Management Client.
 
28
type AccountsClient struct {
 
29
        ManagementClient
 
30
}
 
31
 
 
32
// NewAccountsClient creates an instance of the AccountsClient client.
 
33
func NewAccountsClient(subscriptionID string) AccountsClient {
 
34
        return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
35
}
 
36
 
 
37
// NewAccountsClientWithBaseURI creates an instance of the AccountsClient
 
38
// client.
 
39
func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient {
 
40
        return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)}
 
41
}
 
42
 
 
43
// CheckNameAvailability checks that account name is valid and is not in use.
 
44
//
 
45
// accountName is the name of the storage account within the specified
 
46
// resource group. Storage account names must be between 3 and 24 characters
 
47
// in length and use numbers and lower-case letters only.
 
48
func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, ae error) {
 
49
        req, err := client.CheckNameAvailabilityPreparer(accountName)
 
50
        if err != nil {
 
51
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", "Failure preparing request")
 
52
        }
 
53
 
 
54
        resp, err := client.CheckNameAvailabilitySender(req)
 
55
        if err != nil {
 
56
                result.Response = autorest.Response{Response: resp}
 
57
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", "Failure sending request")
 
58
        }
 
59
 
 
60
        result, err = client.CheckNameAvailabilityResponder(resp)
 
61
        if err != nil {
 
62
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", "Failure responding to request")
 
63
        }
 
64
 
 
65
        return
 
66
}
 
67
 
 
68
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
 
69
func (client AccountsClient) CheckNameAvailabilityPreparer(accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) {
 
70
        pathParameters := map[string]interface{}{
 
71
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
72
        }
 
73
 
 
74
        queryParameters := map[string]interface{}{
 
75
                "api-version": APIVersion,
 
76
        }
 
77
 
 
78
        return autorest.Prepare(&http.Request{},
 
79
                autorest.AsJSON(),
 
80
                autorest.AsPost(),
 
81
                autorest.WithBaseURL(client.BaseURI),
 
82
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"),
 
83
                autorest.WithJSON(accountName),
 
84
                autorest.WithPathParameters(pathParameters),
 
85
                autorest.WithQueryParameters(queryParameters))
 
86
}
 
87
 
 
88
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
 
89
// http.Response Body if it receives an error.
 
90
func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
 
91
        return client.Send(req, http.StatusOK)
 
92
}
 
93
 
 
94
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
 
95
// closes the http.Response Body.
 
96
func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) {
 
97
        err = autorest.Respond(
 
98
                resp,
 
99
                client.ByInspecting(),
 
100
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
101
                autorest.ByUnmarshallingJSON(&result),
 
102
                autorest.ByClosing())
 
103
        result.Response = autorest.Response{Response: resp}
 
104
        return
 
105
}
 
106
 
 
107
// Create asynchronously creates a new storage account with the specified
 
108
// parameters. Existing accounts cannot be updated with this API and should
 
109
// instead use the Update Storage Account API. If an account is already
 
110
// created and subsequent PUT request is issued with exact same set of
 
111
// properties, then HTTP 200 would be returned.
 
112
//
 
113
// resourceGroupName is the name of the resource group within the user's
 
114
// subscription. accountName is the name of the storage account within the
 
115
// specified resource group. Storage account names must be between 3 and 24
 
116
// characters in length and use numbers and lower-case letters only.
 
117
// parameters is the parameters to provide for the created account.
 
118
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, ae error) {
 
119
        req, err := client.CreatePreparer(resourceGroupName, accountName, parameters)
 
120
        if err != nil {
 
121
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", "Failure preparing request")
 
122
        }
 
123
 
 
124
        resp, err := client.CreateSender(req)
 
125
        if err != nil {
 
126
                result.Response = autorest.Response{Response: resp}
 
127
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", "Failure sending request")
 
128
        }
 
129
 
 
130
        result, err = client.CreateResponder(resp)
 
131
        if err != nil {
 
132
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", "Failure responding to request")
 
133
        }
 
134
 
 
135
        return
 
136
}
 
137
 
 
138
// CreatePreparer prepares the Create request.
 
139
func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) {
 
140
        pathParameters := map[string]interface{}{
 
141
                "accountName":       url.QueryEscape(accountName),
 
142
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
143
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
144
        }
 
145
 
 
146
        queryParameters := map[string]interface{}{
 
147
                "api-version": APIVersion,
 
148
        }
 
149
 
 
150
        return autorest.Prepare(&http.Request{},
 
151
                autorest.AsJSON(),
 
152
                autorest.AsPut(),
 
153
                autorest.WithBaseURL(client.BaseURI),
 
154
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"),
 
155
                autorest.WithJSON(parameters),
 
156
                autorest.WithPathParameters(pathParameters),
 
157
                autorest.WithQueryParameters(queryParameters))
 
158
}
 
159
 
 
160
// CreateSender sends the Create request. The method will close the
 
161
// http.Response Body if it receives an error.
 
162
func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) {
 
163
        return client.Send(req, http.StatusOK, http.StatusAccepted)
 
164
}
 
165
 
 
166
// CreateResponder handles the response to the Create request. The method always
 
167
// closes the http.Response Body.
 
168
func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) {
 
169
        err = autorest.Respond(
 
170
                resp,
 
171
                client.ByInspecting(),
 
172
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
 
173
                autorest.ByUnmarshallingJSON(&result),
 
174
                autorest.ByClosing())
 
175
        result.Response = autorest.Response{Response: resp}
 
176
        return
 
177
}
 
178
 
 
179
// Delete deletes a storage account in Microsoft Azure.
 
180
//
 
181
// resourceGroupName is the name of the resource group within the user's
 
182
// subscription. accountName is the name of the storage account within the
 
183
// specified resource group. Storage account names must be between 3 and 24
 
184
// characters in length and use numbers and lower-case letters only.
 
185
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, ae error) {
 
186
        req, err := client.DeletePreparer(resourceGroupName, accountName)
 
187
        if err != nil {
 
188
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", "Failure preparing request")
 
189
        }
 
190
 
 
191
        resp, err := client.DeleteSender(req)
 
192
        if err != nil {
 
193
                result.Response = resp
 
194
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", "Failure sending request")
 
195
        }
 
196
 
 
197
        result, err = client.DeleteResponder(resp)
 
198
        if err != nil {
 
199
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", "Failure responding to request")
 
200
        }
 
201
 
 
202
        return
 
203
}
 
204
 
 
205
// DeletePreparer prepares the Delete request.
 
206
func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 
207
        pathParameters := map[string]interface{}{
 
208
                "accountName":       url.QueryEscape(accountName),
 
209
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
210
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
211
        }
 
212
 
 
213
        queryParameters := map[string]interface{}{
 
214
                "api-version": APIVersion,
 
215
        }
 
216
 
 
217
        return autorest.Prepare(&http.Request{},
 
218
                autorest.AsJSON(),
 
219
                autorest.AsDelete(),
 
220
                autorest.WithBaseURL(client.BaseURI),
 
221
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"),
 
222
                autorest.WithPathParameters(pathParameters),
 
223
                autorest.WithQueryParameters(queryParameters))
 
224
}
 
225
 
 
226
// DeleteSender sends the Delete request. The method will close the
 
227
// http.Response Body if it receives an error.
 
228
func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) {
 
229
        return client.Send(req, http.StatusOK, http.StatusNoContent)
 
230
}
 
231
 
 
232
// DeleteResponder handles the response to the Delete request. The method always
 
233
// closes the http.Response Body.
 
234
func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
 
235
        err = autorest.Respond(
 
236
                resp,
 
237
                client.ByInspecting(),
 
238
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
 
239
                autorest.ByClosing())
 
240
        result.Response = resp
 
241
        return
 
242
}
 
243
 
 
244
// GetProperties returns the properties for the specified storage account
 
245
// including but not limited to name, account type, location, and account
 
246
// status. The ListKeys operation should be used to retrieve storage keys.
 
247
//
 
248
// resourceGroupName is the name of the resource group within the user's
 
249
// subscription. accountName is the name of the storage account within the
 
250
// specified resource group. Storage account names must be between 3 and 24
 
251
// characters in length and use numbers and lower-case letters only.
 
252
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, ae error) {
 
253
        req, err := client.GetPropertiesPreparer(resourceGroupName, accountName)
 
254
        if err != nil {
 
255
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", "Failure preparing request")
 
256
        }
 
257
 
 
258
        resp, err := client.GetPropertiesSender(req)
 
259
        if err != nil {
 
260
                result.Response = autorest.Response{Response: resp}
 
261
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", "Failure sending request")
 
262
        }
 
263
 
 
264
        result, err = client.GetPropertiesResponder(resp)
 
265
        if err != nil {
 
266
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", "Failure responding to request")
 
267
        }
 
268
 
 
269
        return
 
270
}
 
271
 
 
272
// GetPropertiesPreparer prepares the GetProperties request.
 
273
func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 
274
        pathParameters := map[string]interface{}{
 
275
                "accountName":       url.QueryEscape(accountName),
 
276
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
277
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
278
        }
 
279
 
 
280
        queryParameters := map[string]interface{}{
 
281
                "api-version": APIVersion,
 
282
        }
 
283
 
 
284
        return autorest.Prepare(&http.Request{},
 
285
                autorest.AsJSON(),
 
286
                autorest.AsGet(),
 
287
                autorest.WithBaseURL(client.BaseURI),
 
288
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"),
 
289
                autorest.WithPathParameters(pathParameters),
 
290
                autorest.WithQueryParameters(queryParameters))
 
291
}
 
292
 
 
293
// GetPropertiesSender sends the GetProperties request. The method will close the
 
294
// http.Response Body if it receives an error.
 
295
func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
 
296
        return client.Send(req, http.StatusOK)
 
297
}
 
298
 
 
299
// GetPropertiesResponder handles the response to the GetProperties request. The method always
 
300
// closes the http.Response Body.
 
301
func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) {
 
302
        err = autorest.Respond(
 
303
                resp,
 
304
                client.ByInspecting(),
 
305
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
306
                autorest.ByUnmarshallingJSON(&result),
 
307
                autorest.ByClosing())
 
308
        result.Response = autorest.Response{Response: resp}
 
309
        return
 
310
}
 
311
 
 
312
// List lists all the storage accounts available under the subscription. Note
 
313
// that storage keys are not returned; use the ListKeys operation for this.
 
314
func (client AccountsClient) List() (result AccountListResult, ae error) {
 
315
        req, err := client.ListPreparer()
 
316
        if err != nil {
 
317
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "List", "Failure preparing request")
 
318
        }
 
319
 
 
320
        resp, err := client.ListSender(req)
 
321
        if err != nil {
 
322
                result.Response = autorest.Response{Response: resp}
 
323
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "List", "Failure sending request")
 
324
        }
 
325
 
 
326
        result, err = client.ListResponder(resp)
 
327
        if err != nil {
 
328
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "List", "Failure responding to request")
 
329
        }
 
330
 
 
331
        return
 
332
}
 
333
 
 
334
// ListPreparer prepares the List request.
 
335
func (client AccountsClient) ListPreparer() (*http.Request, error) {
 
336
        pathParameters := map[string]interface{}{
 
337
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
338
        }
 
339
 
 
340
        queryParameters := map[string]interface{}{
 
341
                "api-version": APIVersion,
 
342
        }
 
343
 
 
344
        return autorest.Prepare(&http.Request{},
 
345
                autorest.AsJSON(),
 
346
                autorest.AsGet(),
 
347
                autorest.WithBaseURL(client.BaseURI),
 
348
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts"),
 
349
                autorest.WithPathParameters(pathParameters),
 
350
                autorest.WithQueryParameters(queryParameters))
 
351
}
 
352
 
 
353
// ListSender sends the List request. The method will close the
 
354
// http.Response Body if it receives an error.
 
355
func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) {
 
356
        return client.Send(req, http.StatusOK)
 
357
}
 
358
 
 
359
// ListResponder handles the response to the List request. The method always
 
360
// closes the http.Response Body.
 
361
func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) {
 
362
        err = autorest.Respond(
 
363
                resp,
 
364
                client.ByInspecting(),
 
365
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
366
                autorest.ByUnmarshallingJSON(&result),
 
367
                autorest.ByClosing())
 
368
        result.Response = autorest.Response{Response: resp}
 
369
        return
 
370
}
 
371
 
 
372
// ListByResourceGroup lists all the storage accounts available under the
 
373
// given resource group. Note that storage keys are not returned; use the
 
374
// ListKeys operation for this.
 
375
//
 
376
// resourceGroupName is the name of the resource group within the user's
 
377
// subscription.
 
378
func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, ae error) {
 
379
        req, err := client.ListByResourceGroupPreparer(resourceGroupName)
 
380
        if err != nil {
 
381
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", "Failure preparing request")
 
382
        }
 
383
 
 
384
        resp, err := client.ListByResourceGroupSender(req)
 
385
        if err != nil {
 
386
                result.Response = autorest.Response{Response: resp}
 
387
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", "Failure sending request")
 
388
        }
 
389
 
 
390
        result, err = client.ListByResourceGroupResponder(resp)
 
391
        if err != nil {
 
392
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", "Failure responding to request")
 
393
        }
 
394
 
 
395
        return
 
396
}
 
397
 
 
398
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
 
399
func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
 
400
        pathParameters := map[string]interface{}{
 
401
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
402
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
403
        }
 
404
 
 
405
        queryParameters := map[string]interface{}{
 
406
                "api-version": APIVersion,
 
407
        }
 
408
 
 
409
        return autorest.Prepare(&http.Request{},
 
410
                autorest.AsJSON(),
 
411
                autorest.AsGet(),
 
412
                autorest.WithBaseURL(client.BaseURI),
 
413
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts"),
 
414
                autorest.WithPathParameters(pathParameters),
 
415
                autorest.WithQueryParameters(queryParameters))
 
416
}
 
417
 
 
418
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
 
419
// http.Response Body if it receives an error.
 
420
func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
 
421
        return client.Send(req, http.StatusOK)
 
422
}
 
423
 
 
424
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
 
425
// closes the http.Response Body.
 
426
func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) {
 
427
        err = autorest.Respond(
 
428
                resp,
 
429
                client.ByInspecting(),
 
430
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
431
                autorest.ByUnmarshallingJSON(&result),
 
432
                autorest.ByClosing())
 
433
        result.Response = autorest.Response{Response: resp}
 
434
        return
 
435
}
 
436
 
 
437
// ListKeys lists the access keys for the specified storage account.
 
438
//
 
439
// resourceGroupName is the name of the resource group. accountName is the
 
440
// name of the storage account.
 
441
func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, ae error) {
 
442
        req, err := client.ListKeysPreparer(resourceGroupName, accountName)
 
443
        if err != nil {
 
444
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", "Failure preparing request")
 
445
        }
 
446
 
 
447
        resp, err := client.ListKeysSender(req)
 
448
        if err != nil {
 
449
                result.Response = autorest.Response{Response: resp}
 
450
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", "Failure sending request")
 
451
        }
 
452
 
 
453
        result, err = client.ListKeysResponder(resp)
 
454
        if err != nil {
 
455
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", "Failure responding to request")
 
456
        }
 
457
 
 
458
        return
 
459
}
 
460
 
 
461
// ListKeysPreparer prepares the ListKeys request.
 
462
func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 
463
        pathParameters := map[string]interface{}{
 
464
                "accountName":       url.QueryEscape(accountName),
 
465
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
466
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
467
        }
 
468
 
 
469
        queryParameters := map[string]interface{}{
 
470
                "api-version": APIVersion,
 
471
        }
 
472
 
 
473
        return autorest.Prepare(&http.Request{},
 
474
                autorest.AsJSON(),
 
475
                autorest.AsPost(),
 
476
                autorest.WithBaseURL(client.BaseURI),
 
477
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys"),
 
478
                autorest.WithPathParameters(pathParameters),
 
479
                autorest.WithQueryParameters(queryParameters))
 
480
}
 
481
 
 
482
// ListKeysSender sends the ListKeys request. The method will close the
 
483
// http.Response Body if it receives an error.
 
484
func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) {
 
485
        return client.Send(req, http.StatusOK)
 
486
}
 
487
 
 
488
// ListKeysResponder handles the response to the ListKeys request. The method always
 
489
// closes the http.Response Body.
 
490
func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) {
 
491
        err = autorest.Respond(
 
492
                resp,
 
493
                client.ByInspecting(),
 
494
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
495
                autorest.ByUnmarshallingJSON(&result),
 
496
                autorest.ByClosing())
 
497
        result.Response = autorest.Response{Response: resp}
 
498
        return
 
499
}
 
500
 
 
501
// RegenerateKey regenerates the access keys for the specified storage account.
 
502
//
 
503
// resourceGroupName is the name of the resource group within the user's
 
504
// subscription. accountName is the name of the storage account within the
 
505
// specified resource group. Storage account names must be between 3 and 24
 
506
// characters in length and use numbers and lower-case letters only.
 
507
// regenerateKey is specifies name of the key which should be regenerated.
 
508
// key1 or key2 for the default keys
 
509
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountKeys, ae error) {
 
510
        req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey)
 
511
        if err != nil {
 
512
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", "Failure preparing request")
 
513
        }
 
514
 
 
515
        resp, err := client.RegenerateKeySender(req)
 
516
        if err != nil {
 
517
                result.Response = autorest.Response{Response: resp}
 
518
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", "Failure sending request")
 
519
        }
 
520
 
 
521
        result, err = client.RegenerateKeyResponder(resp)
 
522
        if err != nil {
 
523
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", "Failure responding to request")
 
524
        }
 
525
 
 
526
        return
 
527
}
 
528
 
 
529
// RegenerateKeyPreparer prepares the RegenerateKey request.
 
530
func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) {
 
531
        pathParameters := map[string]interface{}{
 
532
                "accountName":       url.QueryEscape(accountName),
 
533
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
534
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
535
        }
 
536
 
 
537
        queryParameters := map[string]interface{}{
 
538
                "api-version": APIVersion,
 
539
        }
 
540
 
 
541
        return autorest.Prepare(&http.Request{},
 
542
                autorest.AsJSON(),
 
543
                autorest.AsPost(),
 
544
                autorest.WithBaseURL(client.BaseURI),
 
545
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey"),
 
546
                autorest.WithJSON(regenerateKey),
 
547
                autorest.WithPathParameters(pathParameters),
 
548
                autorest.WithQueryParameters(queryParameters))
 
549
}
 
550
 
 
551
// RegenerateKeySender sends the RegenerateKey request. The method will close the
 
552
// http.Response Body if it receives an error.
 
553
func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
 
554
        return client.Send(req, http.StatusOK)
 
555
}
 
556
 
 
557
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
 
558
// closes the http.Response Body.
 
559
func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) {
 
560
        err = autorest.Respond(
 
561
                resp,
 
562
                client.ByInspecting(),
 
563
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
564
                autorest.ByUnmarshallingJSON(&result),
 
565
                autorest.ByClosing())
 
566
        result.Response = autorest.Response{Response: resp}
 
567
        return
 
568
}
 
569
 
 
570
// Update updates the account type or tags for a storage account. It can also
 
571
// be used to add a custom domain (note that custom domains cannot be added
 
572
// via the Create operation). Only one custom domain is supported per storage
 
573
// account. In order to replace a custom domain, the old value must be
 
574
// cleared before a new value may be set. To clear a custom domain, simply
 
575
// update the custom domain with empty string. Then call update again with
 
576
// the new cutsom domain name. The update API can only be used to update one
 
577
// of tags, accountType, or customDomain per call. To update multiple of
 
578
// these properties, call the API multiple times with one change per call.
 
579
// This call does not change the storage keys for the account. If you want to
 
580
// change storage account keys, use the RegenerateKey operation. The location
 
581
// and name of the storage account cannot be changed after creation.
 
582
//
 
583
// resourceGroupName is the name of the resource group within the user's
 
584
// subscription. accountName is the name of the storage account within the
 
585
// specified resource group. Storage account names must be between 3 and 24
 
586
// characters in length and use numbers and lower-case letters only.
 
587
// parameters is the parameters to update on the account. Note that only one
 
588
// property can be changed at a time using this API.
 
589
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, ae error) {
 
590
        req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters)
 
591
        if err != nil {
 
592
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", "Failure preparing request")
 
593
        }
 
594
 
 
595
        resp, err := client.UpdateSender(req)
 
596
        if err != nil {
 
597
                result.Response = autorest.Response{Response: resp}
 
598
                return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", "Failure sending request")
 
599
        }
 
600
 
 
601
        result, err = client.UpdateResponder(resp)
 
602
        if err != nil {
 
603
                ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", "Failure responding to request")
 
604
        }
 
605
 
 
606
        return
 
607
}
 
608
 
 
609
// UpdatePreparer prepares the Update request.
 
610
func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) {
 
611
        pathParameters := map[string]interface{}{
 
612
                "accountName":       url.QueryEscape(accountName),
 
613
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
614
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
615
        }
 
616
 
 
617
        queryParameters := map[string]interface{}{
 
618
                "api-version": APIVersion,
 
619
        }
 
620
 
 
621
        return autorest.Prepare(&http.Request{},
 
622
                autorest.AsJSON(),
 
623
                autorest.AsPatch(),
 
624
                autorest.WithBaseURL(client.BaseURI),
 
625
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"),
 
626
                autorest.WithJSON(parameters),
 
627
                autorest.WithPathParameters(pathParameters),
 
628
                autorest.WithQueryParameters(queryParameters))
 
629
}
 
630
 
 
631
// UpdateSender sends the Update request. The method will close the
 
632
// http.Response Body if it receives an error.
 
633
func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) {
 
634
        return client.Send(req, http.StatusOK)
 
635
}
 
636
 
 
637
// UpdateResponder handles the response to the Update request. The method always
 
638
// closes the http.Response Body.
 
639
func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) {
 
640
        err = autorest.Respond(
 
641
                resp,
 
642
                client.ByInspecting(),
 
643
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
644
                autorest.ByUnmarshallingJSON(&result),
 
645
                autorest.ByClosing())
 
646
        result.Response = autorest.Response{Response: resp}
 
647
        return
 
648
}