1// Package keyvault implements the Azure ARM Keyvault service API version 2016-10-01.
2//
3// The key vault client performs cryptographic key operations and vault operations against the Key Vault service.
4package keyvault
5
6// Copyright (c) Microsoft Corporation. All rights reserved.
7// Licensed under the MIT License. See License.txt in the project root for license information.
8//
9// Code generated by Microsoft (R) AutoRest Code Generator.
10// Changes may cause incorrect behavior and will be lost if the code is regenerated.
11
12import (
13	"context"
14	"github.com/Azure/go-autorest/autorest"
15	"github.com/Azure/go-autorest/autorest/azure"
16	"github.com/Azure/go-autorest/autorest/validation"
17	"github.com/Azure/go-autorest/tracing"
18	"net/http"
19)
20
21// BaseClient is the base client for Keyvault.
22type BaseClient struct {
23	autorest.Client
24}
25
26// New creates an instance of the BaseClient client.
27func New() BaseClient {
28	return NewWithoutDefaults()
29}
30
31// NewWithoutDefaults creates an instance of the BaseClient client.
32func NewWithoutDefaults() BaseClient {
33	return BaseClient{
34		Client: autorest.NewClientWithUserAgent(UserAgent()),
35	}
36}
37
38// BackupKey the Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation
39// does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key
40// material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is
41// to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into
42// another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from
43// Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within
44// geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another
45// geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical
46// area. This operation requires the key/backup permission.
47// Parameters:
48// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
49// keyName - the name of the key.
50func (client BaseClient) BackupKey(ctx context.Context, vaultBaseURL string, keyName string) (result BackupKeyResult, err error) {
51	if tracing.IsEnabled() {
52		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupKey")
53		defer func() {
54			sc := -1
55			if result.Response.Response != nil {
56				sc = result.Response.Response.StatusCode
57			}
58			tracing.EndSpan(ctx, sc, err)
59		}()
60	}
61	req, err := client.BackupKeyPreparer(ctx, vaultBaseURL, keyName)
62	if err != nil {
63		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", nil, "Failure preparing request")
64		return
65	}
66
67	resp, err := client.BackupKeySender(req)
68	if err != nil {
69		result.Response = autorest.Response{Response: resp}
70		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure sending request")
71		return
72	}
73
74	result, err = client.BackupKeyResponder(resp)
75	if err != nil {
76		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure responding to request")
77		return
78	}
79
80	return
81}
82
83// BackupKeyPreparer prepares the BackupKey request.
84func (client BaseClient) BackupKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) {
85	urlParameters := map[string]interface{}{
86		"vaultBaseUrl": vaultBaseURL,
87	}
88
89	pathParameters := map[string]interface{}{
90		"key-name": autorest.Encode("path", keyName),
91	}
92
93	const APIVersion = "2016-10-01"
94	queryParameters := map[string]interface{}{
95		"api-version": APIVersion,
96	}
97
98	preparer := autorest.CreatePreparer(
99		autorest.AsPost(),
100		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
101		autorest.WithPathParameters("/keys/{key-name}/backup", pathParameters),
102		autorest.WithQueryParameters(queryParameters))
103	return preparer.Prepare((&http.Request{}).WithContext(ctx))
104}
105
106// BackupKeySender sends the BackupKey request. The method will close the
107// http.Response Body if it receives an error.
108func (client BaseClient) BackupKeySender(req *http.Request) (*http.Response, error) {
109	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
110}
111
112// BackupKeyResponder handles the response to the BackupKey request. The method always
113// closes the http.Response Body.
114func (client BaseClient) BackupKeyResponder(resp *http.Response) (result BackupKeyResult, err error) {
115	err = autorest.Respond(
116		resp,
117		azure.WithErrorUnlessStatusCode(http.StatusOK),
118		autorest.ByUnmarshallingJSON(&result),
119		autorest.ByClosing())
120	result.Response = autorest.Response{Response: resp}
121	return
122}
123
124// BackupSecret requests that a backup of the specified secret be downloaded to the client. All versions of the secret
125// will be downloaded. This operation requires the secrets/backup permission.
126// Parameters:
127// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
128// secretName - the name of the secret.
129func (client BaseClient) BackupSecret(ctx context.Context, vaultBaseURL string, secretName string) (result BackupSecretResult, err error) {
130	if tracing.IsEnabled() {
131		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupSecret")
132		defer func() {
133			sc := -1
134			if result.Response.Response != nil {
135				sc = result.Response.Response.StatusCode
136			}
137			tracing.EndSpan(ctx, sc, err)
138		}()
139	}
140	req, err := client.BackupSecretPreparer(ctx, vaultBaseURL, secretName)
141	if err != nil {
142		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", nil, "Failure preparing request")
143		return
144	}
145
146	resp, err := client.BackupSecretSender(req)
147	if err != nil {
148		result.Response = autorest.Response{Response: resp}
149		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure sending request")
150		return
151	}
152
153	result, err = client.BackupSecretResponder(resp)
154	if err != nil {
155		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure responding to request")
156		return
157	}
158
159	return
160}
161
162// BackupSecretPreparer prepares the BackupSecret request.
163func (client BaseClient) BackupSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) {
164	urlParameters := map[string]interface{}{
165		"vaultBaseUrl": vaultBaseURL,
166	}
167
168	pathParameters := map[string]interface{}{
169		"secret-name": autorest.Encode("path", secretName),
170	}
171
172	const APIVersion = "2016-10-01"
173	queryParameters := map[string]interface{}{
174		"api-version": APIVersion,
175	}
176
177	preparer := autorest.CreatePreparer(
178		autorest.AsPost(),
179		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
180		autorest.WithPathParameters("/secrets/{secret-name}/backup", pathParameters),
181		autorest.WithQueryParameters(queryParameters))
182	return preparer.Prepare((&http.Request{}).WithContext(ctx))
183}
184
185// BackupSecretSender sends the BackupSecret request. The method will close the
186// http.Response Body if it receives an error.
187func (client BaseClient) BackupSecretSender(req *http.Request) (*http.Response, error) {
188	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
189}
190
191// BackupSecretResponder handles the response to the BackupSecret request. The method always
192// closes the http.Response Body.
193func (client BaseClient) BackupSecretResponder(resp *http.Response) (result BackupSecretResult, err error) {
194	err = autorest.Respond(
195		resp,
196		azure.WithErrorUnlessStatusCode(http.StatusOK),
197		autorest.ByUnmarshallingJSON(&result),
198		autorest.ByClosing())
199	result.Response = autorest.Response{Response: resp}
200	return
201}
202
203// CreateCertificate if this is the first version, the certificate resource is created. This operation requires the
204// certificates/create permission.
205// Parameters:
206// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
207// certificateName - the name of the certificate.
208// parameters - the parameters to create a certificate.
209func (client BaseClient) CreateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (result CertificateOperation, err error) {
210	if tracing.IsEnabled() {
211		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateCertificate")
212		defer func() {
213			sc := -1
214			if result.Response.Response != nil {
215				sc = result.Response.Response.StatusCode
216			}
217			tracing.EndSpan(ctx, sc, err)
218		}()
219	}
220	if err := validation.Validate([]validation.Validation{
221		{TargetValue: certificateName,
222			Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}},
223		{TargetValue: parameters,
224			Constraints: []validation.Constraint{{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false,
225				Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false,
226					Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false,
227						Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}},
228					}},
229				}}}}}); err != nil {
230		return result, validation.NewError("keyvault.BaseClient", "CreateCertificate", err.Error())
231	}
232
233	req, err := client.CreateCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters)
234	if err != nil {
235		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", nil, "Failure preparing request")
236		return
237	}
238
239	resp, err := client.CreateCertificateSender(req)
240	if err != nil {
241		result.Response = autorest.Response{Response: resp}
242		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure sending request")
243		return
244	}
245
246	result, err = client.CreateCertificateResponder(resp)
247	if err != nil {
248		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure responding to request")
249		return
250	}
251
252	return
253}
254
255// CreateCertificatePreparer prepares the CreateCertificate request.
256func (client BaseClient) CreateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (*http.Request, error) {
257	urlParameters := map[string]interface{}{
258		"vaultBaseUrl": vaultBaseURL,
259	}
260
261	pathParameters := map[string]interface{}{
262		"certificate-name": autorest.Encode("path", certificateName),
263	}
264
265	const APIVersion = "2016-10-01"
266	queryParameters := map[string]interface{}{
267		"api-version": APIVersion,
268	}
269
270	preparer := autorest.CreatePreparer(
271		autorest.AsContentType("application/json; charset=utf-8"),
272		autorest.AsPost(),
273		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
274		autorest.WithPathParameters("/certificates/{certificate-name}/create", pathParameters),
275		autorest.WithJSON(parameters),
276		autorest.WithQueryParameters(queryParameters))
277	return preparer.Prepare((&http.Request{}).WithContext(ctx))
278}
279
280// CreateCertificateSender sends the CreateCertificate request. The method will close the
281// http.Response Body if it receives an error.
282func (client BaseClient) CreateCertificateSender(req *http.Request) (*http.Response, error) {
283	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
284}
285
286// CreateCertificateResponder handles the response to the CreateCertificate request. The method always
287// closes the http.Response Body.
288func (client BaseClient) CreateCertificateResponder(resp *http.Response) (result CertificateOperation, err error) {
289	err = autorest.Respond(
290		resp,
291		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
292		autorest.ByUnmarshallingJSON(&result),
293		autorest.ByClosing())
294	result.Response = autorest.Response{Response: resp}
295	return
296}
297
298// CreateKey the create key operation can be used to create any key type in Azure Key Vault. If the named key already
299// exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission.
300// Parameters:
301// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
302// keyName - the name for the new key. The system will generate the version name for the new key.
303// parameters - the parameters to create a key.
304func (client BaseClient) CreateKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (result KeyBundle, err error) {
305	if tracing.IsEnabled() {
306		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateKey")
307		defer func() {
308			sc := -1
309			if result.Response.Response != nil {
310				sc = result.Response.Response.StatusCode
311			}
312			tracing.EndSpan(ctx, sc, err)
313		}()
314	}
315	if err := validation.Validate([]validation.Validation{
316		{TargetValue: keyName,
317			Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}}); err != nil {
318		return result, validation.NewError("keyvault.BaseClient", "CreateKey", err.Error())
319	}
320
321	req, err := client.CreateKeyPreparer(ctx, vaultBaseURL, keyName, parameters)
322	if err != nil {
323		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", nil, "Failure preparing request")
324		return
325	}
326
327	resp, err := client.CreateKeySender(req)
328	if err != nil {
329		result.Response = autorest.Response{Response: resp}
330		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure sending request")
331		return
332	}
333
334	result, err = client.CreateKeyResponder(resp)
335	if err != nil {
336		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure responding to request")
337		return
338	}
339
340	return
341}
342
343// CreateKeyPreparer prepares the CreateKey request.
344func (client BaseClient) CreateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (*http.Request, error) {
345	urlParameters := map[string]interface{}{
346		"vaultBaseUrl": vaultBaseURL,
347	}
348
349	pathParameters := map[string]interface{}{
350		"key-name": autorest.Encode("path", keyName),
351	}
352
353	const APIVersion = "2016-10-01"
354	queryParameters := map[string]interface{}{
355		"api-version": APIVersion,
356	}
357
358	preparer := autorest.CreatePreparer(
359		autorest.AsContentType("application/json; charset=utf-8"),
360		autorest.AsPost(),
361		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
362		autorest.WithPathParameters("/keys/{key-name}/create", pathParameters),
363		autorest.WithJSON(parameters),
364		autorest.WithQueryParameters(queryParameters))
365	return preparer.Prepare((&http.Request{}).WithContext(ctx))
366}
367
368// CreateKeySender sends the CreateKey request. The method will close the
369// http.Response Body if it receives an error.
370func (client BaseClient) CreateKeySender(req *http.Request) (*http.Response, error) {
371	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
372}
373
374// CreateKeyResponder handles the response to the CreateKey request. The method always
375// closes the http.Response Body.
376func (client BaseClient) CreateKeyResponder(resp *http.Response) (result KeyBundle, err error) {
377	err = autorest.Respond(
378		resp,
379		azure.WithErrorUnlessStatusCode(http.StatusOK),
380		autorest.ByUnmarshallingJSON(&result),
381		autorest.ByClosing())
382	result.Response = autorest.Response{Response: resp}
383	return
384}
385
386// Decrypt the DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and
387// specified algorithm. This operation is the reverse of the ENCRYPT operation; only a single block of data may be
388// decrypted, the size of this block is dependent on the target key and the algorithm to be used. The DECRYPT operation
389// applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key.
390// This operation requires the keys/decrypt permission.
391// Parameters:
392// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
393// keyName - the name of the key.
394// keyVersion - the version of the key.
395// parameters - the parameters for the decryption operation.
396func (client BaseClient) Decrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) {
397	if tracing.IsEnabled() {
398		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Decrypt")
399		defer func() {
400			sc := -1
401			if result.Response.Response != nil {
402				sc = result.Response.Response.StatusCode
403			}
404			tracing.EndSpan(ctx, sc, err)
405		}()
406	}
407	if err := validation.Validate([]validation.Validation{
408		{TargetValue: parameters,
409			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
410		return result, validation.NewError("keyvault.BaseClient", "Decrypt", err.Error())
411	}
412
413	req, err := client.DecryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
414	if err != nil {
415		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", nil, "Failure preparing request")
416		return
417	}
418
419	resp, err := client.DecryptSender(req)
420	if err != nil {
421		result.Response = autorest.Response{Response: resp}
422		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure sending request")
423		return
424	}
425
426	result, err = client.DecryptResponder(resp)
427	if err != nil {
428		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure responding to request")
429		return
430	}
431
432	return
433}
434
435// DecryptPreparer prepares the Decrypt request.
436func (client BaseClient) DecryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) {
437	urlParameters := map[string]interface{}{
438		"vaultBaseUrl": vaultBaseURL,
439	}
440
441	pathParameters := map[string]interface{}{
442		"key-name":    autorest.Encode("path", keyName),
443		"key-version": autorest.Encode("path", keyVersion),
444	}
445
446	const APIVersion = "2016-10-01"
447	queryParameters := map[string]interface{}{
448		"api-version": APIVersion,
449	}
450
451	preparer := autorest.CreatePreparer(
452		autorest.AsContentType("application/json; charset=utf-8"),
453		autorest.AsPost(),
454		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
455		autorest.WithPathParameters("/keys/{key-name}/{key-version}/decrypt", pathParameters),
456		autorest.WithJSON(parameters),
457		autorest.WithQueryParameters(queryParameters))
458	return preparer.Prepare((&http.Request{}).WithContext(ctx))
459}
460
461// DecryptSender sends the Decrypt request. The method will close the
462// http.Response Body if it receives an error.
463func (client BaseClient) DecryptSender(req *http.Request) (*http.Response, error) {
464	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
465}
466
467// DecryptResponder handles the response to the Decrypt request. The method always
468// closes the http.Response Body.
469func (client BaseClient) DecryptResponder(resp *http.Response) (result KeyOperationResult, err error) {
470	err = autorest.Respond(
471		resp,
472		azure.WithErrorUnlessStatusCode(http.StatusOK),
473		autorest.ByUnmarshallingJSON(&result),
474		autorest.ByClosing())
475	result.Response = autorest.Response{Response: resp}
476	return
477}
478
479// DeleteCertificate deletes all versions of a certificate object along with its associated policy. Delete certificate
480// cannot be used to remove individual versions of a certificate object. This operation requires the
481// certificates/delete permission.
482// Parameters:
483// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
484// certificateName - the name of the certificate.
485func (client BaseClient) DeleteCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) {
486	if tracing.IsEnabled() {
487		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificate")
488		defer func() {
489			sc := -1
490			if result.Response.Response != nil {
491				sc = result.Response.Response.StatusCode
492			}
493			tracing.EndSpan(ctx, sc, err)
494		}()
495	}
496	req, err := client.DeleteCertificatePreparer(ctx, vaultBaseURL, certificateName)
497	if err != nil {
498		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", nil, "Failure preparing request")
499		return
500	}
501
502	resp, err := client.DeleteCertificateSender(req)
503	if err != nil {
504		result.Response = autorest.Response{Response: resp}
505		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure sending request")
506		return
507	}
508
509	result, err = client.DeleteCertificateResponder(resp)
510	if err != nil {
511		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure responding to request")
512		return
513	}
514
515	return
516}
517
518// DeleteCertificatePreparer prepares the DeleteCertificate request.
519func (client BaseClient) DeleteCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
520	urlParameters := map[string]interface{}{
521		"vaultBaseUrl": vaultBaseURL,
522	}
523
524	pathParameters := map[string]interface{}{
525		"certificate-name": autorest.Encode("path", certificateName),
526	}
527
528	const APIVersion = "2016-10-01"
529	queryParameters := map[string]interface{}{
530		"api-version": APIVersion,
531	}
532
533	preparer := autorest.CreatePreparer(
534		autorest.AsDelete(),
535		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
536		autorest.WithPathParameters("/certificates/{certificate-name}", pathParameters),
537		autorest.WithQueryParameters(queryParameters))
538	return preparer.Prepare((&http.Request{}).WithContext(ctx))
539}
540
541// DeleteCertificateSender sends the DeleteCertificate request. The method will close the
542// http.Response Body if it receives an error.
543func (client BaseClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) {
544	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
545}
546
547// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always
548// closes the http.Response Body.
549func (client BaseClient) DeleteCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) {
550	err = autorest.Respond(
551		resp,
552		azure.WithErrorUnlessStatusCode(http.StatusOK),
553		autorest.ByUnmarshallingJSON(&result),
554		autorest.ByClosing())
555	result.Response = autorest.Response{Response: resp}
556	return
557}
558
559// DeleteCertificateContacts deletes the certificate contacts for a specified key vault certificate. This operation
560// requires the certificates/managecontacts permission.
561// Parameters:
562// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
563func (client BaseClient) DeleteCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) {
564	if tracing.IsEnabled() {
565		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateContacts")
566		defer func() {
567			sc := -1
568			if result.Response.Response != nil {
569				sc = result.Response.Response.StatusCode
570			}
571			tracing.EndSpan(ctx, sc, err)
572		}()
573	}
574	req, err := client.DeleteCertificateContactsPreparer(ctx, vaultBaseURL)
575	if err != nil {
576		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", nil, "Failure preparing request")
577		return
578	}
579
580	resp, err := client.DeleteCertificateContactsSender(req)
581	if err != nil {
582		result.Response = autorest.Response{Response: resp}
583		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure sending request")
584		return
585	}
586
587	result, err = client.DeleteCertificateContactsResponder(resp)
588	if err != nil {
589		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure responding to request")
590		return
591	}
592
593	return
594}
595
596// DeleteCertificateContactsPreparer prepares the DeleteCertificateContacts request.
597func (client BaseClient) DeleteCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) {
598	urlParameters := map[string]interface{}{
599		"vaultBaseUrl": vaultBaseURL,
600	}
601
602	const APIVersion = "2016-10-01"
603	queryParameters := map[string]interface{}{
604		"api-version": APIVersion,
605	}
606
607	preparer := autorest.CreatePreparer(
608		autorest.AsDelete(),
609		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
610		autorest.WithPath("/certificates/contacts"),
611		autorest.WithQueryParameters(queryParameters))
612	return preparer.Prepare((&http.Request{}).WithContext(ctx))
613}
614
615// DeleteCertificateContactsSender sends the DeleteCertificateContacts request. The method will close the
616// http.Response Body if it receives an error.
617func (client BaseClient) DeleteCertificateContactsSender(req *http.Request) (*http.Response, error) {
618	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
619}
620
621// DeleteCertificateContactsResponder handles the response to the DeleteCertificateContacts request. The method always
622// closes the http.Response Body.
623func (client BaseClient) DeleteCertificateContactsResponder(resp *http.Response) (result Contacts, err error) {
624	err = autorest.Respond(
625		resp,
626		azure.WithErrorUnlessStatusCode(http.StatusOK),
627		autorest.ByUnmarshallingJSON(&result),
628		autorest.ByClosing())
629	result.Response = autorest.Response{Response: resp}
630	return
631}
632
633// DeleteCertificateIssuer the DeleteCertificateIssuer operation permanently removes the specified certificate issuer
634// from the vault. This operation requires the certificates/manageissuers/deleteissuers permission.
635// Parameters:
636// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
637// issuerName - the name of the issuer.
638func (client BaseClient) DeleteCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) {
639	if tracing.IsEnabled() {
640		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateIssuer")
641		defer func() {
642			sc := -1
643			if result.Response.Response != nil {
644				sc = result.Response.Response.StatusCode
645			}
646			tracing.EndSpan(ctx, sc, err)
647		}()
648	}
649	req, err := client.DeleteCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName)
650	if err != nil {
651		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", nil, "Failure preparing request")
652		return
653	}
654
655	resp, err := client.DeleteCertificateIssuerSender(req)
656	if err != nil {
657		result.Response = autorest.Response{Response: resp}
658		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure sending request")
659		return
660	}
661
662	result, err = client.DeleteCertificateIssuerResponder(resp)
663	if err != nil {
664		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure responding to request")
665		return
666	}
667
668	return
669}
670
671// DeleteCertificateIssuerPreparer prepares the DeleteCertificateIssuer request.
672func (client BaseClient) DeleteCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) {
673	urlParameters := map[string]interface{}{
674		"vaultBaseUrl": vaultBaseURL,
675	}
676
677	pathParameters := map[string]interface{}{
678		"issuer-name": autorest.Encode("path", issuerName),
679	}
680
681	const APIVersion = "2016-10-01"
682	queryParameters := map[string]interface{}{
683		"api-version": APIVersion,
684	}
685
686	preparer := autorest.CreatePreparer(
687		autorest.AsDelete(),
688		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
689		autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters),
690		autorest.WithQueryParameters(queryParameters))
691	return preparer.Prepare((&http.Request{}).WithContext(ctx))
692}
693
694// DeleteCertificateIssuerSender sends the DeleteCertificateIssuer request. The method will close the
695// http.Response Body if it receives an error.
696func (client BaseClient) DeleteCertificateIssuerSender(req *http.Request) (*http.Response, error) {
697	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
698}
699
700// DeleteCertificateIssuerResponder handles the response to the DeleteCertificateIssuer request. The method always
701// closes the http.Response Body.
702func (client BaseClient) DeleteCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) {
703	err = autorest.Respond(
704		resp,
705		azure.WithErrorUnlessStatusCode(http.StatusOK),
706		autorest.ByUnmarshallingJSON(&result),
707		autorest.ByClosing())
708	result.Response = autorest.Response{Response: resp}
709	return
710}
711
712// DeleteCertificateOperation deletes the creation operation for a specified certificate that is in the process of
713// being created. The certificate is no longer created. This operation requires the certificates/update permission.
714// Parameters:
715// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
716// certificateName - the name of the certificate.
717func (client BaseClient) DeleteCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) {
718	if tracing.IsEnabled() {
719		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateOperation")
720		defer func() {
721			sc := -1
722			if result.Response.Response != nil {
723				sc = result.Response.Response.StatusCode
724			}
725			tracing.EndSpan(ctx, sc, err)
726		}()
727	}
728	req, err := client.DeleteCertificateOperationPreparer(ctx, vaultBaseURL, certificateName)
729	if err != nil {
730		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", nil, "Failure preparing request")
731		return
732	}
733
734	resp, err := client.DeleteCertificateOperationSender(req)
735	if err != nil {
736		result.Response = autorest.Response{Response: resp}
737		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure sending request")
738		return
739	}
740
741	result, err = client.DeleteCertificateOperationResponder(resp)
742	if err != nil {
743		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure responding to request")
744		return
745	}
746
747	return
748}
749
750// DeleteCertificateOperationPreparer prepares the DeleteCertificateOperation request.
751func (client BaseClient) DeleteCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
752	urlParameters := map[string]interface{}{
753		"vaultBaseUrl": vaultBaseURL,
754	}
755
756	pathParameters := map[string]interface{}{
757		"certificate-name": autorest.Encode("path", certificateName),
758	}
759
760	const APIVersion = "2016-10-01"
761	queryParameters := map[string]interface{}{
762		"api-version": APIVersion,
763	}
764
765	preparer := autorest.CreatePreparer(
766		autorest.AsDelete(),
767		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
768		autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters),
769		autorest.WithQueryParameters(queryParameters))
770	return preparer.Prepare((&http.Request{}).WithContext(ctx))
771}
772
773// DeleteCertificateOperationSender sends the DeleteCertificateOperation request. The method will close the
774// http.Response Body if it receives an error.
775func (client BaseClient) DeleteCertificateOperationSender(req *http.Request) (*http.Response, error) {
776	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
777}
778
779// DeleteCertificateOperationResponder handles the response to the DeleteCertificateOperation request. The method always
780// closes the http.Response Body.
781func (client BaseClient) DeleteCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) {
782	err = autorest.Respond(
783		resp,
784		azure.WithErrorUnlessStatusCode(http.StatusOK),
785		autorest.ByUnmarshallingJSON(&result),
786		autorest.ByClosing())
787	result.Response = autorest.Response{Response: resp}
788	return
789}
790
791// DeleteKey the delete key operation cannot be used to remove individual versions of a key. This operation removes the
792// cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or
793// Encrypt/Decrypt operations. This operation requires the keys/delete permission.
794// Parameters:
795// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
796// keyName - the name of the key to delete.
797func (client BaseClient) DeleteKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) {
798	if tracing.IsEnabled() {
799		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteKey")
800		defer func() {
801			sc := -1
802			if result.Response.Response != nil {
803				sc = result.Response.Response.StatusCode
804			}
805			tracing.EndSpan(ctx, sc, err)
806		}()
807	}
808	req, err := client.DeleteKeyPreparer(ctx, vaultBaseURL, keyName)
809	if err != nil {
810		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", nil, "Failure preparing request")
811		return
812	}
813
814	resp, err := client.DeleteKeySender(req)
815	if err != nil {
816		result.Response = autorest.Response{Response: resp}
817		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure sending request")
818		return
819	}
820
821	result, err = client.DeleteKeyResponder(resp)
822	if err != nil {
823		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure responding to request")
824		return
825	}
826
827	return
828}
829
830// DeleteKeyPreparer prepares the DeleteKey request.
831func (client BaseClient) DeleteKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) {
832	urlParameters := map[string]interface{}{
833		"vaultBaseUrl": vaultBaseURL,
834	}
835
836	pathParameters := map[string]interface{}{
837		"key-name": autorest.Encode("path", keyName),
838	}
839
840	const APIVersion = "2016-10-01"
841	queryParameters := map[string]interface{}{
842		"api-version": APIVersion,
843	}
844
845	preparer := autorest.CreatePreparer(
846		autorest.AsDelete(),
847		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
848		autorest.WithPathParameters("/keys/{key-name}", pathParameters),
849		autorest.WithQueryParameters(queryParameters))
850	return preparer.Prepare((&http.Request{}).WithContext(ctx))
851}
852
853// DeleteKeySender sends the DeleteKey request. The method will close the
854// http.Response Body if it receives an error.
855func (client BaseClient) DeleteKeySender(req *http.Request) (*http.Response, error) {
856	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
857}
858
859// DeleteKeyResponder handles the response to the DeleteKey request. The method always
860// closes the http.Response Body.
861func (client BaseClient) DeleteKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) {
862	err = autorest.Respond(
863		resp,
864		azure.WithErrorUnlessStatusCode(http.StatusOK),
865		autorest.ByUnmarshallingJSON(&result),
866		autorest.ByClosing())
867	result.Response = autorest.Response{Response: resp}
868	return
869}
870
871// DeleteSasDefinition deletes a SAS definition from a specified storage account. This operation requires the
872// storage/deletesas permission.
873// Parameters:
874// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
875// storageAccountName - the name of the storage account.
876// sasDefinitionName - the name of the SAS definition.
877func (client BaseClient) DeleteSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) {
878	if tracing.IsEnabled() {
879		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteSasDefinition")
880		defer func() {
881			sc := -1
882			if result.Response.Response != nil {
883				sc = result.Response.Response.StatusCode
884			}
885			tracing.EndSpan(ctx, sc, err)
886		}()
887	}
888	if err := validation.Validate([]validation.Validation{
889		{TargetValue: storageAccountName,
890			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
891		{TargetValue: sasDefinitionName,
892			Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
893		return result, validation.NewError("keyvault.BaseClient", "DeleteSasDefinition", err.Error())
894	}
895
896	req, err := client.DeleteSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName)
897	if err != nil {
898		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", nil, "Failure preparing request")
899		return
900	}
901
902	resp, err := client.DeleteSasDefinitionSender(req)
903	if err != nil {
904		result.Response = autorest.Response{Response: resp}
905		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure sending request")
906		return
907	}
908
909	result, err = client.DeleteSasDefinitionResponder(resp)
910	if err != nil {
911		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure responding to request")
912		return
913	}
914
915	return
916}
917
918// DeleteSasDefinitionPreparer prepares the DeleteSasDefinition request.
919func (client BaseClient) DeleteSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) {
920	urlParameters := map[string]interface{}{
921		"vaultBaseUrl": vaultBaseURL,
922	}
923
924	pathParameters := map[string]interface{}{
925		"sas-definition-name":  autorest.Encode("path", sasDefinitionName),
926		"storage-account-name": autorest.Encode("path", storageAccountName),
927	}
928
929	const APIVersion = "2016-10-01"
930	queryParameters := map[string]interface{}{
931		"api-version": APIVersion,
932	}
933
934	preparer := autorest.CreatePreparer(
935		autorest.AsDelete(),
936		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
937		autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters),
938		autorest.WithQueryParameters(queryParameters))
939	return preparer.Prepare((&http.Request{}).WithContext(ctx))
940}
941
942// DeleteSasDefinitionSender sends the DeleteSasDefinition request. The method will close the
943// http.Response Body if it receives an error.
944func (client BaseClient) DeleteSasDefinitionSender(req *http.Request) (*http.Response, error) {
945	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
946}
947
948// DeleteSasDefinitionResponder handles the response to the DeleteSasDefinition request. The method always
949// closes the http.Response Body.
950func (client BaseClient) DeleteSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) {
951	err = autorest.Respond(
952		resp,
953		azure.WithErrorUnlessStatusCode(http.StatusOK),
954		autorest.ByUnmarshallingJSON(&result),
955		autorest.ByClosing())
956	result.Response = autorest.Response{Response: resp}
957	return
958}
959
960// DeleteSecret the DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an
961// individual version of a secret. This operation requires the secrets/delete permission.
962// Parameters:
963// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
964// secretName - the name of the secret.
965func (client BaseClient) DeleteSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) {
966	if tracing.IsEnabled() {
967		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteSecret")
968		defer func() {
969			sc := -1
970			if result.Response.Response != nil {
971				sc = result.Response.Response.StatusCode
972			}
973			tracing.EndSpan(ctx, sc, err)
974		}()
975	}
976	req, err := client.DeleteSecretPreparer(ctx, vaultBaseURL, secretName)
977	if err != nil {
978		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", nil, "Failure preparing request")
979		return
980	}
981
982	resp, err := client.DeleteSecretSender(req)
983	if err != nil {
984		result.Response = autorest.Response{Response: resp}
985		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure sending request")
986		return
987	}
988
989	result, err = client.DeleteSecretResponder(resp)
990	if err != nil {
991		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure responding to request")
992		return
993	}
994
995	return
996}
997
998// DeleteSecretPreparer prepares the DeleteSecret request.
999func (client BaseClient) DeleteSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) {
1000	urlParameters := map[string]interface{}{
1001		"vaultBaseUrl": vaultBaseURL,
1002	}
1003
1004	pathParameters := map[string]interface{}{
1005		"secret-name": autorest.Encode("path", secretName),
1006	}
1007
1008	const APIVersion = "2016-10-01"
1009	queryParameters := map[string]interface{}{
1010		"api-version": APIVersion,
1011	}
1012
1013	preparer := autorest.CreatePreparer(
1014		autorest.AsDelete(),
1015		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1016		autorest.WithPathParameters("/secrets/{secret-name}", pathParameters),
1017		autorest.WithQueryParameters(queryParameters))
1018	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1019}
1020
1021// DeleteSecretSender sends the DeleteSecret request. The method will close the
1022// http.Response Body if it receives an error.
1023func (client BaseClient) DeleteSecretSender(req *http.Request) (*http.Response, error) {
1024	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1025}
1026
1027// DeleteSecretResponder handles the response to the DeleteSecret request. The method always
1028// closes the http.Response Body.
1029func (client BaseClient) DeleteSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) {
1030	err = autorest.Respond(
1031		resp,
1032		azure.WithErrorUnlessStatusCode(http.StatusOK),
1033		autorest.ByUnmarshallingJSON(&result),
1034		autorest.ByClosing())
1035	result.Response = autorest.Response{Response: resp}
1036	return
1037}
1038
1039// DeleteStorageAccount deletes a storage account. This operation requires the storage/delete permission.
1040// Parameters:
1041// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1042// storageAccountName - the name of the storage account.
1043func (client BaseClient) DeleteStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) {
1044	if tracing.IsEnabled() {
1045		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteStorageAccount")
1046		defer func() {
1047			sc := -1
1048			if result.Response.Response != nil {
1049				sc = result.Response.Response.StatusCode
1050			}
1051			tracing.EndSpan(ctx, sc, err)
1052		}()
1053	}
1054	if err := validation.Validate([]validation.Validation{
1055		{TargetValue: storageAccountName,
1056			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
1057		return result, validation.NewError("keyvault.BaseClient", "DeleteStorageAccount", err.Error())
1058	}
1059
1060	req, err := client.DeleteStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName)
1061	if err != nil {
1062		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", nil, "Failure preparing request")
1063		return
1064	}
1065
1066	resp, err := client.DeleteStorageAccountSender(req)
1067	if err != nil {
1068		result.Response = autorest.Response{Response: resp}
1069		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure sending request")
1070		return
1071	}
1072
1073	result, err = client.DeleteStorageAccountResponder(resp)
1074	if err != nil {
1075		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure responding to request")
1076		return
1077	}
1078
1079	return
1080}
1081
1082// DeleteStorageAccountPreparer prepares the DeleteStorageAccount request.
1083func (client BaseClient) DeleteStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) {
1084	urlParameters := map[string]interface{}{
1085		"vaultBaseUrl": vaultBaseURL,
1086	}
1087
1088	pathParameters := map[string]interface{}{
1089		"storage-account-name": autorest.Encode("path", storageAccountName),
1090	}
1091
1092	const APIVersion = "2016-10-01"
1093	queryParameters := map[string]interface{}{
1094		"api-version": APIVersion,
1095	}
1096
1097	preparer := autorest.CreatePreparer(
1098		autorest.AsDelete(),
1099		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1100		autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters),
1101		autorest.WithQueryParameters(queryParameters))
1102	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1103}
1104
1105// DeleteStorageAccountSender sends the DeleteStorageAccount request. The method will close the
1106// http.Response Body if it receives an error.
1107func (client BaseClient) DeleteStorageAccountSender(req *http.Request) (*http.Response, error) {
1108	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1109}
1110
1111// DeleteStorageAccountResponder handles the response to the DeleteStorageAccount request. The method always
1112// closes the http.Response Body.
1113func (client BaseClient) DeleteStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) {
1114	err = autorest.Respond(
1115		resp,
1116		azure.WithErrorUnlessStatusCode(http.StatusOK),
1117		autorest.ByUnmarshallingJSON(&result),
1118		autorest.ByClosing())
1119	result.Response = autorest.Response{Response: resp}
1120	return
1121}
1122
1123// Encrypt the ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in
1124// Azure Key Vault. Note that the ENCRYPT operation only supports a single block of data, the size of which is
1125// dependent on the target key and the encryption algorithm to be used. The ENCRYPT operation is only strictly
1126// necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed
1127// using public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that
1128// have a key-reference but do not have access to the public key material. This operation requires the keys/encrypt
1129// permission.
1130// Parameters:
1131// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1132// keyName - the name of the key.
1133// keyVersion - the version of the key.
1134// parameters - the parameters for the encryption operation.
1135func (client BaseClient) Encrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) {
1136	if tracing.IsEnabled() {
1137		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Encrypt")
1138		defer func() {
1139			sc := -1
1140			if result.Response.Response != nil {
1141				sc = result.Response.Response.StatusCode
1142			}
1143			tracing.EndSpan(ctx, sc, err)
1144		}()
1145	}
1146	if err := validation.Validate([]validation.Validation{
1147		{TargetValue: parameters,
1148			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1149		return result, validation.NewError("keyvault.BaseClient", "Encrypt", err.Error())
1150	}
1151
1152	req, err := client.EncryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
1153	if err != nil {
1154		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", nil, "Failure preparing request")
1155		return
1156	}
1157
1158	resp, err := client.EncryptSender(req)
1159	if err != nil {
1160		result.Response = autorest.Response{Response: resp}
1161		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure sending request")
1162		return
1163	}
1164
1165	result, err = client.EncryptResponder(resp)
1166	if err != nil {
1167		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure responding to request")
1168		return
1169	}
1170
1171	return
1172}
1173
1174// EncryptPreparer prepares the Encrypt request.
1175func (client BaseClient) EncryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) {
1176	urlParameters := map[string]interface{}{
1177		"vaultBaseUrl": vaultBaseURL,
1178	}
1179
1180	pathParameters := map[string]interface{}{
1181		"key-name":    autorest.Encode("path", keyName),
1182		"key-version": autorest.Encode("path", keyVersion),
1183	}
1184
1185	const APIVersion = "2016-10-01"
1186	queryParameters := map[string]interface{}{
1187		"api-version": APIVersion,
1188	}
1189
1190	preparer := autorest.CreatePreparer(
1191		autorest.AsContentType("application/json; charset=utf-8"),
1192		autorest.AsPost(),
1193		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1194		autorest.WithPathParameters("/keys/{key-name}/{key-version}/encrypt", pathParameters),
1195		autorest.WithJSON(parameters),
1196		autorest.WithQueryParameters(queryParameters))
1197	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1198}
1199
1200// EncryptSender sends the Encrypt request. The method will close the
1201// http.Response Body if it receives an error.
1202func (client BaseClient) EncryptSender(req *http.Request) (*http.Response, error) {
1203	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1204}
1205
1206// EncryptResponder handles the response to the Encrypt request. The method always
1207// closes the http.Response Body.
1208func (client BaseClient) EncryptResponder(resp *http.Response) (result KeyOperationResult, err error) {
1209	err = autorest.Respond(
1210		resp,
1211		azure.WithErrorUnlessStatusCode(http.StatusOK),
1212		autorest.ByUnmarshallingJSON(&result),
1213		autorest.ByClosing())
1214	result.Response = autorest.Response{Response: resp}
1215	return
1216}
1217
1218// GetCertificate gets information about a specific certificate. This operation requires the certificates/get
1219// permission.
1220// Parameters:
1221// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1222// certificateName - the name of the certificate in the given vault.
1223// certificateVersion - the version of the certificate.
1224func (client BaseClient) GetCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) {
1225	if tracing.IsEnabled() {
1226		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificate")
1227		defer func() {
1228			sc := -1
1229			if result.Response.Response != nil {
1230				sc = result.Response.Response.StatusCode
1231			}
1232			tracing.EndSpan(ctx, sc, err)
1233		}()
1234	}
1235	req, err := client.GetCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion)
1236	if err != nil {
1237		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", nil, "Failure preparing request")
1238		return
1239	}
1240
1241	resp, err := client.GetCertificateSender(req)
1242	if err != nil {
1243		result.Response = autorest.Response{Response: resp}
1244		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure sending request")
1245		return
1246	}
1247
1248	result, err = client.GetCertificateResponder(resp)
1249	if err != nil {
1250		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure responding to request")
1251		return
1252	}
1253
1254	return
1255}
1256
1257// GetCertificatePreparer prepares the GetCertificate request.
1258func (client BaseClient) GetCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (*http.Request, error) {
1259	urlParameters := map[string]interface{}{
1260		"vaultBaseUrl": vaultBaseURL,
1261	}
1262
1263	pathParameters := map[string]interface{}{
1264		"certificate-name":    autorest.Encode("path", certificateName),
1265		"certificate-version": autorest.Encode("path", certificateVersion),
1266	}
1267
1268	const APIVersion = "2016-10-01"
1269	queryParameters := map[string]interface{}{
1270		"api-version": APIVersion,
1271	}
1272
1273	preparer := autorest.CreatePreparer(
1274		autorest.AsGet(),
1275		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1276		autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters),
1277		autorest.WithQueryParameters(queryParameters))
1278	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1279}
1280
1281// GetCertificateSender sends the GetCertificate request. The method will close the
1282// http.Response Body if it receives an error.
1283func (client BaseClient) GetCertificateSender(req *http.Request) (*http.Response, error) {
1284	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1285}
1286
1287// GetCertificateResponder handles the response to the GetCertificate request. The method always
1288// closes the http.Response Body.
1289func (client BaseClient) GetCertificateResponder(resp *http.Response) (result CertificateBundle, err error) {
1290	err = autorest.Respond(
1291		resp,
1292		azure.WithErrorUnlessStatusCode(http.StatusOK),
1293		autorest.ByUnmarshallingJSON(&result),
1294		autorest.ByClosing())
1295	result.Response = autorest.Response{Response: resp}
1296	return
1297}
1298
1299// GetCertificateContacts the GetCertificateContacts operation returns the set of certificate contact resources in the
1300// specified key vault. This operation requires the certificates/managecontacts permission.
1301// Parameters:
1302// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1303func (client BaseClient) GetCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) {
1304	if tracing.IsEnabled() {
1305		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateContacts")
1306		defer func() {
1307			sc := -1
1308			if result.Response.Response != nil {
1309				sc = result.Response.Response.StatusCode
1310			}
1311			tracing.EndSpan(ctx, sc, err)
1312		}()
1313	}
1314	req, err := client.GetCertificateContactsPreparer(ctx, vaultBaseURL)
1315	if err != nil {
1316		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", nil, "Failure preparing request")
1317		return
1318	}
1319
1320	resp, err := client.GetCertificateContactsSender(req)
1321	if err != nil {
1322		result.Response = autorest.Response{Response: resp}
1323		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure sending request")
1324		return
1325	}
1326
1327	result, err = client.GetCertificateContactsResponder(resp)
1328	if err != nil {
1329		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure responding to request")
1330		return
1331	}
1332
1333	return
1334}
1335
1336// GetCertificateContactsPreparer prepares the GetCertificateContacts request.
1337func (client BaseClient) GetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) {
1338	urlParameters := map[string]interface{}{
1339		"vaultBaseUrl": vaultBaseURL,
1340	}
1341
1342	const APIVersion = "2016-10-01"
1343	queryParameters := map[string]interface{}{
1344		"api-version": APIVersion,
1345	}
1346
1347	preparer := autorest.CreatePreparer(
1348		autorest.AsGet(),
1349		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1350		autorest.WithPath("/certificates/contacts"),
1351		autorest.WithQueryParameters(queryParameters))
1352	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1353}
1354
1355// GetCertificateContactsSender sends the GetCertificateContacts request. The method will close the
1356// http.Response Body if it receives an error.
1357func (client BaseClient) GetCertificateContactsSender(req *http.Request) (*http.Response, error) {
1358	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1359}
1360
1361// GetCertificateContactsResponder handles the response to the GetCertificateContacts request. The method always
1362// closes the http.Response Body.
1363func (client BaseClient) GetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) {
1364	err = autorest.Respond(
1365		resp,
1366		azure.WithErrorUnlessStatusCode(http.StatusOK),
1367		autorest.ByUnmarshallingJSON(&result),
1368		autorest.ByClosing())
1369	result.Response = autorest.Response{Response: resp}
1370	return
1371}
1372
1373// GetCertificateIssuer the GetCertificateIssuer operation returns the specified certificate issuer resources in the
1374// specified key vault. This operation requires the certificates/manageissuers/getissuers permission.
1375// Parameters:
1376// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1377// issuerName - the name of the issuer.
1378func (client BaseClient) GetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) {
1379	if tracing.IsEnabled() {
1380		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuer")
1381		defer func() {
1382			sc := -1
1383			if result.Response.Response != nil {
1384				sc = result.Response.Response.StatusCode
1385			}
1386			tracing.EndSpan(ctx, sc, err)
1387		}()
1388	}
1389	req, err := client.GetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName)
1390	if err != nil {
1391		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", nil, "Failure preparing request")
1392		return
1393	}
1394
1395	resp, err := client.GetCertificateIssuerSender(req)
1396	if err != nil {
1397		result.Response = autorest.Response{Response: resp}
1398		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure sending request")
1399		return
1400	}
1401
1402	result, err = client.GetCertificateIssuerResponder(resp)
1403	if err != nil {
1404		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure responding to request")
1405		return
1406	}
1407
1408	return
1409}
1410
1411// GetCertificateIssuerPreparer prepares the GetCertificateIssuer request.
1412func (client BaseClient) GetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) {
1413	urlParameters := map[string]interface{}{
1414		"vaultBaseUrl": vaultBaseURL,
1415	}
1416
1417	pathParameters := map[string]interface{}{
1418		"issuer-name": autorest.Encode("path", issuerName),
1419	}
1420
1421	const APIVersion = "2016-10-01"
1422	queryParameters := map[string]interface{}{
1423		"api-version": APIVersion,
1424	}
1425
1426	preparer := autorest.CreatePreparer(
1427		autorest.AsGet(),
1428		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1429		autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters),
1430		autorest.WithQueryParameters(queryParameters))
1431	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1432}
1433
1434// GetCertificateIssuerSender sends the GetCertificateIssuer request. The method will close the
1435// http.Response Body if it receives an error.
1436func (client BaseClient) GetCertificateIssuerSender(req *http.Request) (*http.Response, error) {
1437	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1438}
1439
1440// GetCertificateIssuerResponder handles the response to the GetCertificateIssuer request. The method always
1441// closes the http.Response Body.
1442func (client BaseClient) GetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) {
1443	err = autorest.Respond(
1444		resp,
1445		azure.WithErrorUnlessStatusCode(http.StatusOK),
1446		autorest.ByUnmarshallingJSON(&result),
1447		autorest.ByClosing())
1448	result.Response = autorest.Response{Response: resp}
1449	return
1450}
1451
1452// GetCertificateIssuers the GetCertificateIssuers operation returns the set of certificate issuer resources in the
1453// specified key vault. This operation requires the certificates/manageissuers/getissuers permission.
1454// Parameters:
1455// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1456// maxresults - maximum number of results to return in a page. If not specified the service will return up to
1457// 25 results.
1458func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultPage, err error) {
1459	if tracing.IsEnabled() {
1460		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuers")
1461		defer func() {
1462			sc := -1
1463			if result.cilr.Response.Response != nil {
1464				sc = result.cilr.Response.Response.StatusCode
1465			}
1466			tracing.EndSpan(ctx, sc, err)
1467		}()
1468	}
1469	if err := validation.Validate([]validation.Validation{
1470		{TargetValue: maxresults,
1471			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
1472				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
1473					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
1474				}}}}}); err != nil {
1475		return result, validation.NewError("keyvault.BaseClient", "GetCertificateIssuers", err.Error())
1476	}
1477
1478	result.fn = client.getCertificateIssuersNextResults
1479	req, err := client.GetCertificateIssuersPreparer(ctx, vaultBaseURL, maxresults)
1480	if err != nil {
1481		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", nil, "Failure preparing request")
1482		return
1483	}
1484
1485	resp, err := client.GetCertificateIssuersSender(req)
1486	if err != nil {
1487		result.cilr.Response = autorest.Response{Response: resp}
1488		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure sending request")
1489		return
1490	}
1491
1492	result.cilr, err = client.GetCertificateIssuersResponder(resp)
1493	if err != nil {
1494		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure responding to request")
1495		return
1496	}
1497	if result.cilr.hasNextLink() && result.cilr.IsEmpty() {
1498		err = result.NextWithContext(ctx)
1499		return
1500	}
1501
1502	return
1503}
1504
1505// GetCertificateIssuersPreparer prepares the GetCertificateIssuers request.
1506func (client BaseClient) GetCertificateIssuersPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
1507	urlParameters := map[string]interface{}{
1508		"vaultBaseUrl": vaultBaseURL,
1509	}
1510
1511	const APIVersion = "2016-10-01"
1512	queryParameters := map[string]interface{}{
1513		"api-version": APIVersion,
1514	}
1515	if maxresults != nil {
1516		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
1517	}
1518
1519	preparer := autorest.CreatePreparer(
1520		autorest.AsGet(),
1521		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1522		autorest.WithPath("/certificates/issuers"),
1523		autorest.WithQueryParameters(queryParameters))
1524	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1525}
1526
1527// GetCertificateIssuersSender sends the GetCertificateIssuers request. The method will close the
1528// http.Response Body if it receives an error.
1529func (client BaseClient) GetCertificateIssuersSender(req *http.Request) (*http.Response, error) {
1530	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1531}
1532
1533// GetCertificateIssuersResponder handles the response to the GetCertificateIssuers request. The method always
1534// closes the http.Response Body.
1535func (client BaseClient) GetCertificateIssuersResponder(resp *http.Response) (result CertificateIssuerListResult, err error) {
1536	err = autorest.Respond(
1537		resp,
1538		azure.WithErrorUnlessStatusCode(http.StatusOK),
1539		autorest.ByUnmarshallingJSON(&result),
1540		autorest.ByClosing())
1541	result.Response = autorest.Response{Response: resp}
1542	return
1543}
1544
1545// getCertificateIssuersNextResults retrieves the next set of results, if any.
1546func (client BaseClient) getCertificateIssuersNextResults(ctx context.Context, lastResults CertificateIssuerListResult) (result CertificateIssuerListResult, err error) {
1547	req, err := lastResults.certificateIssuerListResultPreparer(ctx)
1548	if err != nil {
1549		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", nil, "Failure preparing next results request")
1550	}
1551	if req == nil {
1552		return
1553	}
1554	resp, err := client.GetCertificateIssuersSender(req)
1555	if err != nil {
1556		result.Response = autorest.Response{Response: resp}
1557		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure sending next results request")
1558	}
1559	result, err = client.GetCertificateIssuersResponder(resp)
1560	if err != nil {
1561		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure responding to next results request")
1562	}
1563	return
1564}
1565
1566// GetCertificateIssuersComplete enumerates all values, automatically crossing page boundaries as required.
1567func (client BaseClient) GetCertificateIssuersComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultIterator, err error) {
1568	if tracing.IsEnabled() {
1569		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuers")
1570		defer func() {
1571			sc := -1
1572			if result.Response().Response.Response != nil {
1573				sc = result.page.Response().Response.Response.StatusCode
1574			}
1575			tracing.EndSpan(ctx, sc, err)
1576		}()
1577	}
1578	result.page, err = client.GetCertificateIssuers(ctx, vaultBaseURL, maxresults)
1579	return
1580}
1581
1582// GetCertificateOperation gets the creation operation associated with a specified certificate. This operation requires
1583// the certificates/get permission.
1584// Parameters:
1585// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1586// certificateName - the name of the certificate.
1587func (client BaseClient) GetCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) {
1588	if tracing.IsEnabled() {
1589		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateOperation")
1590		defer func() {
1591			sc := -1
1592			if result.Response.Response != nil {
1593				sc = result.Response.Response.StatusCode
1594			}
1595			tracing.EndSpan(ctx, sc, err)
1596		}()
1597	}
1598	req, err := client.GetCertificateOperationPreparer(ctx, vaultBaseURL, certificateName)
1599	if err != nil {
1600		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", nil, "Failure preparing request")
1601		return
1602	}
1603
1604	resp, err := client.GetCertificateOperationSender(req)
1605	if err != nil {
1606		result.Response = autorest.Response{Response: resp}
1607		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure sending request")
1608		return
1609	}
1610
1611	result, err = client.GetCertificateOperationResponder(resp)
1612	if err != nil {
1613		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure responding to request")
1614		return
1615	}
1616
1617	return
1618}
1619
1620// GetCertificateOperationPreparer prepares the GetCertificateOperation request.
1621func (client BaseClient) GetCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
1622	urlParameters := map[string]interface{}{
1623		"vaultBaseUrl": vaultBaseURL,
1624	}
1625
1626	pathParameters := map[string]interface{}{
1627		"certificate-name": autorest.Encode("path", certificateName),
1628	}
1629
1630	const APIVersion = "2016-10-01"
1631	queryParameters := map[string]interface{}{
1632		"api-version": APIVersion,
1633	}
1634
1635	preparer := autorest.CreatePreparer(
1636		autorest.AsGet(),
1637		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1638		autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters),
1639		autorest.WithQueryParameters(queryParameters))
1640	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1641}
1642
1643// GetCertificateOperationSender sends the GetCertificateOperation request. The method will close the
1644// http.Response Body if it receives an error.
1645func (client BaseClient) GetCertificateOperationSender(req *http.Request) (*http.Response, error) {
1646	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1647}
1648
1649// GetCertificateOperationResponder handles the response to the GetCertificateOperation request. The method always
1650// closes the http.Response Body.
1651func (client BaseClient) GetCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) {
1652	err = autorest.Respond(
1653		resp,
1654		azure.WithErrorUnlessStatusCode(http.StatusOK),
1655		autorest.ByUnmarshallingJSON(&result),
1656		autorest.ByClosing())
1657	result.Response = autorest.Response{Response: resp}
1658	return
1659}
1660
1661// GetCertificatePolicy the GetCertificatePolicy operation returns the specified certificate policy resources in the
1662// specified key vault. This operation requires the certificates/get permission.
1663// Parameters:
1664// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1665// certificateName - the name of the certificate in a given key vault.
1666func (client BaseClient) GetCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificatePolicy, err error) {
1667	if tracing.IsEnabled() {
1668		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificatePolicy")
1669		defer func() {
1670			sc := -1
1671			if result.Response.Response != nil {
1672				sc = result.Response.Response.StatusCode
1673			}
1674			tracing.EndSpan(ctx, sc, err)
1675		}()
1676	}
1677	req, err := client.GetCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName)
1678	if err != nil {
1679		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", nil, "Failure preparing request")
1680		return
1681	}
1682
1683	resp, err := client.GetCertificatePolicySender(req)
1684	if err != nil {
1685		result.Response = autorest.Response{Response: resp}
1686		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure sending request")
1687		return
1688	}
1689
1690	result, err = client.GetCertificatePolicyResponder(resp)
1691	if err != nil {
1692		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure responding to request")
1693		return
1694	}
1695
1696	return
1697}
1698
1699// GetCertificatePolicyPreparer prepares the GetCertificatePolicy request.
1700func (client BaseClient) GetCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
1701	urlParameters := map[string]interface{}{
1702		"vaultBaseUrl": vaultBaseURL,
1703	}
1704
1705	pathParameters := map[string]interface{}{
1706		"certificate-name": autorest.Encode("path", certificateName),
1707	}
1708
1709	const APIVersion = "2016-10-01"
1710	queryParameters := map[string]interface{}{
1711		"api-version": APIVersion,
1712	}
1713
1714	preparer := autorest.CreatePreparer(
1715		autorest.AsGet(),
1716		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1717		autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters),
1718		autorest.WithQueryParameters(queryParameters))
1719	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1720}
1721
1722// GetCertificatePolicySender sends the GetCertificatePolicy request. The method will close the
1723// http.Response Body if it receives an error.
1724func (client BaseClient) GetCertificatePolicySender(req *http.Request) (*http.Response, error) {
1725	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1726}
1727
1728// GetCertificatePolicyResponder handles the response to the GetCertificatePolicy request. The method always
1729// closes the http.Response Body.
1730func (client BaseClient) GetCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) {
1731	err = autorest.Respond(
1732		resp,
1733		azure.WithErrorUnlessStatusCode(http.StatusOK),
1734		autorest.ByUnmarshallingJSON(&result),
1735		autorest.ByClosing())
1736	result.Response = autorest.Response{Response: resp}
1737	return
1738}
1739
1740// GetCertificates the GetCertificates operation returns the set of certificates resources in the specified key vault.
1741// This operation requires the certificates/list permission.
1742// Parameters:
1743// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1744// maxresults - maximum number of results to return in a page. If not specified the service will return up to
1745// 25 results.
1746func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateListResultPage, err error) {
1747	if tracing.IsEnabled() {
1748		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificates")
1749		defer func() {
1750			sc := -1
1751			if result.clr.Response.Response != nil {
1752				sc = result.clr.Response.Response.StatusCode
1753			}
1754			tracing.EndSpan(ctx, sc, err)
1755		}()
1756	}
1757	if err := validation.Validate([]validation.Validation{
1758		{TargetValue: maxresults,
1759			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
1760				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
1761					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
1762				}}}}}); err != nil {
1763		return result, validation.NewError("keyvault.BaseClient", "GetCertificates", err.Error())
1764	}
1765
1766	result.fn = client.getCertificatesNextResults
1767	req, err := client.GetCertificatesPreparer(ctx, vaultBaseURL, maxresults)
1768	if err != nil {
1769		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", nil, "Failure preparing request")
1770		return
1771	}
1772
1773	resp, err := client.GetCertificatesSender(req)
1774	if err != nil {
1775		result.clr.Response = autorest.Response{Response: resp}
1776		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure sending request")
1777		return
1778	}
1779
1780	result.clr, err = client.GetCertificatesResponder(resp)
1781	if err != nil {
1782		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure responding to request")
1783		return
1784	}
1785	if result.clr.hasNextLink() && result.clr.IsEmpty() {
1786		err = result.NextWithContext(ctx)
1787		return
1788	}
1789
1790	return
1791}
1792
1793// GetCertificatesPreparer prepares the GetCertificates request.
1794func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
1795	urlParameters := map[string]interface{}{
1796		"vaultBaseUrl": vaultBaseURL,
1797	}
1798
1799	const APIVersion = "2016-10-01"
1800	queryParameters := map[string]interface{}{
1801		"api-version": APIVersion,
1802	}
1803	if maxresults != nil {
1804		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
1805	}
1806
1807	preparer := autorest.CreatePreparer(
1808		autorest.AsGet(),
1809		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1810		autorest.WithPath("/certificates"),
1811		autorest.WithQueryParameters(queryParameters))
1812	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1813}
1814
1815// GetCertificatesSender sends the GetCertificates request. The method will close the
1816// http.Response Body if it receives an error.
1817func (client BaseClient) GetCertificatesSender(req *http.Request) (*http.Response, error) {
1818	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1819}
1820
1821// GetCertificatesResponder handles the response to the GetCertificates request. The method always
1822// closes the http.Response Body.
1823func (client BaseClient) GetCertificatesResponder(resp *http.Response) (result CertificateListResult, err error) {
1824	err = autorest.Respond(
1825		resp,
1826		azure.WithErrorUnlessStatusCode(http.StatusOK),
1827		autorest.ByUnmarshallingJSON(&result),
1828		autorest.ByClosing())
1829	result.Response = autorest.Response{Response: resp}
1830	return
1831}
1832
1833// getCertificatesNextResults retrieves the next set of results, if any.
1834func (client BaseClient) getCertificatesNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) {
1835	req, err := lastResults.certificateListResultPreparer(ctx)
1836	if err != nil {
1837		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", nil, "Failure preparing next results request")
1838	}
1839	if req == nil {
1840		return
1841	}
1842	resp, err := client.GetCertificatesSender(req)
1843	if err != nil {
1844		result.Response = autorest.Response{Response: resp}
1845		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure sending next results request")
1846	}
1847	result, err = client.GetCertificatesResponder(resp)
1848	if err != nil {
1849		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure responding to next results request")
1850	}
1851	return
1852}
1853
1854// GetCertificatesComplete enumerates all values, automatically crossing page boundaries as required.
1855func (client BaseClient) GetCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateListResultIterator, err error) {
1856	if tracing.IsEnabled() {
1857		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificates")
1858		defer func() {
1859			sc := -1
1860			if result.Response().Response.Response != nil {
1861				sc = result.page.Response().Response.Response.StatusCode
1862			}
1863			tracing.EndSpan(ctx, sc, err)
1864		}()
1865	}
1866	result.page, err = client.GetCertificates(ctx, vaultBaseURL, maxresults)
1867	return
1868}
1869
1870// GetCertificateVersions the GetCertificateVersions operation returns the versions of a certificate in the specified
1871// key vault. This operation requires the certificates/list permission.
1872// Parameters:
1873// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
1874// certificateName - the name of the certificate.
1875// maxresults - maximum number of results to return in a page. If not specified the service will return up to
1876// 25 results.
1877func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultPage, err error) {
1878	if tracing.IsEnabled() {
1879		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateVersions")
1880		defer func() {
1881			sc := -1
1882			if result.clr.Response.Response != nil {
1883				sc = result.clr.Response.Response.StatusCode
1884			}
1885			tracing.EndSpan(ctx, sc, err)
1886		}()
1887	}
1888	if err := validation.Validate([]validation.Validation{
1889		{TargetValue: maxresults,
1890			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
1891				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
1892					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
1893				}}}}}); err != nil {
1894		return result, validation.NewError("keyvault.BaseClient", "GetCertificateVersions", err.Error())
1895	}
1896
1897	result.fn = client.getCertificateVersionsNextResults
1898	req, err := client.GetCertificateVersionsPreparer(ctx, vaultBaseURL, certificateName, maxresults)
1899	if err != nil {
1900		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", nil, "Failure preparing request")
1901		return
1902	}
1903
1904	resp, err := client.GetCertificateVersionsSender(req)
1905	if err != nil {
1906		result.clr.Response = autorest.Response{Response: resp}
1907		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure sending request")
1908		return
1909	}
1910
1911	result.clr, err = client.GetCertificateVersionsResponder(resp)
1912	if err != nil {
1913		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure responding to request")
1914		return
1915	}
1916	if result.clr.hasNextLink() && result.clr.IsEmpty() {
1917		err = result.NextWithContext(ctx)
1918		return
1919	}
1920
1921	return
1922}
1923
1924// GetCertificateVersionsPreparer prepares the GetCertificateVersions request.
1925func (client BaseClient) GetCertificateVersionsPreparer(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (*http.Request, error) {
1926	urlParameters := map[string]interface{}{
1927		"vaultBaseUrl": vaultBaseURL,
1928	}
1929
1930	pathParameters := map[string]interface{}{
1931		"certificate-name": autorest.Encode("path", certificateName),
1932	}
1933
1934	const APIVersion = "2016-10-01"
1935	queryParameters := map[string]interface{}{
1936		"api-version": APIVersion,
1937	}
1938	if maxresults != nil {
1939		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
1940	}
1941
1942	preparer := autorest.CreatePreparer(
1943		autorest.AsGet(),
1944		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
1945		autorest.WithPathParameters("/certificates/{certificate-name}/versions", pathParameters),
1946		autorest.WithQueryParameters(queryParameters))
1947	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1948}
1949
1950// GetCertificateVersionsSender sends the GetCertificateVersions request. The method will close the
1951// http.Response Body if it receives an error.
1952func (client BaseClient) GetCertificateVersionsSender(req *http.Request) (*http.Response, error) {
1953	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1954}
1955
1956// GetCertificateVersionsResponder handles the response to the GetCertificateVersions request. The method always
1957// closes the http.Response Body.
1958func (client BaseClient) GetCertificateVersionsResponder(resp *http.Response) (result CertificateListResult, err error) {
1959	err = autorest.Respond(
1960		resp,
1961		azure.WithErrorUnlessStatusCode(http.StatusOK),
1962		autorest.ByUnmarshallingJSON(&result),
1963		autorest.ByClosing())
1964	result.Response = autorest.Response{Response: resp}
1965	return
1966}
1967
1968// getCertificateVersionsNextResults retrieves the next set of results, if any.
1969func (client BaseClient) getCertificateVersionsNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) {
1970	req, err := lastResults.certificateListResultPreparer(ctx)
1971	if err != nil {
1972		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", nil, "Failure preparing next results request")
1973	}
1974	if req == nil {
1975		return
1976	}
1977	resp, err := client.GetCertificateVersionsSender(req)
1978	if err != nil {
1979		result.Response = autorest.Response{Response: resp}
1980		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure sending next results request")
1981	}
1982	result, err = client.GetCertificateVersionsResponder(resp)
1983	if err != nil {
1984		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure responding to next results request")
1985	}
1986	return
1987}
1988
1989// GetCertificateVersionsComplete enumerates all values, automatically crossing page boundaries as required.
1990func (client BaseClient) GetCertificateVersionsComplete(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultIterator, err error) {
1991	if tracing.IsEnabled() {
1992		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateVersions")
1993		defer func() {
1994			sc := -1
1995			if result.Response().Response.Response != nil {
1996				sc = result.page.Response().Response.Response.StatusCode
1997			}
1998			tracing.EndSpan(ctx, sc, err)
1999		}()
2000	}
2001	result.page, err = client.GetCertificateVersions(ctx, vaultBaseURL, certificateName, maxresults)
2002	return
2003}
2004
2005// GetDeletedCertificate the GetDeletedCertificate operation retrieves the deleted certificate information plus its
2006// attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This
2007// operation requires the certificates/get permission.
2008// Parameters:
2009// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2010// certificateName - the name of the certificate
2011func (client BaseClient) GetDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) {
2012	if tracing.IsEnabled() {
2013		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificate")
2014		defer func() {
2015			sc := -1
2016			if result.Response.Response != nil {
2017				sc = result.Response.Response.StatusCode
2018			}
2019			tracing.EndSpan(ctx, sc, err)
2020		}()
2021	}
2022	req, err := client.GetDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName)
2023	if err != nil {
2024		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", nil, "Failure preparing request")
2025		return
2026	}
2027
2028	resp, err := client.GetDeletedCertificateSender(req)
2029	if err != nil {
2030		result.Response = autorest.Response{Response: resp}
2031		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure sending request")
2032		return
2033	}
2034
2035	result, err = client.GetDeletedCertificateResponder(resp)
2036	if err != nil {
2037		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure responding to request")
2038		return
2039	}
2040
2041	return
2042}
2043
2044// GetDeletedCertificatePreparer prepares the GetDeletedCertificate request.
2045func (client BaseClient) GetDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
2046	urlParameters := map[string]interface{}{
2047		"vaultBaseUrl": vaultBaseURL,
2048	}
2049
2050	pathParameters := map[string]interface{}{
2051		"certificate-name": autorest.Encode("path", certificateName),
2052	}
2053
2054	const APIVersion = "2016-10-01"
2055	queryParameters := map[string]interface{}{
2056		"api-version": APIVersion,
2057	}
2058
2059	preparer := autorest.CreatePreparer(
2060		autorest.AsGet(),
2061		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2062		autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters),
2063		autorest.WithQueryParameters(queryParameters))
2064	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2065}
2066
2067// GetDeletedCertificateSender sends the GetDeletedCertificate request. The method will close the
2068// http.Response Body if it receives an error.
2069func (client BaseClient) GetDeletedCertificateSender(req *http.Request) (*http.Response, error) {
2070	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2071}
2072
2073// GetDeletedCertificateResponder handles the response to the GetDeletedCertificate request. The method always
2074// closes the http.Response Body.
2075func (client BaseClient) GetDeletedCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) {
2076	err = autorest.Respond(
2077		resp,
2078		azure.WithErrorUnlessStatusCode(http.StatusOK),
2079		autorest.ByUnmarshallingJSON(&result),
2080		autorest.ByClosing())
2081	result.Response = autorest.Response{Response: resp}
2082	return
2083}
2084
2085// GetDeletedCertificates the GetDeletedCertificates operation retrieves the certificates in the current vault which
2086// are in a deleted state and ready for recovery or purging. This operation includes deletion-specific information.
2087// This operation requires the certificates/get/list permission. This operation can only be enabled on soft-delete
2088// enabled vaults.
2089// Parameters:
2090// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2091// maxresults - maximum number of results to return in a page. If not specified the service will return up to
2092// 25 results.
2093func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedCertificateListResultPage, err error) {
2094	if tracing.IsEnabled() {
2095		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificates")
2096		defer func() {
2097			sc := -1
2098			if result.dclr.Response.Response != nil {
2099				sc = result.dclr.Response.Response.StatusCode
2100			}
2101			tracing.EndSpan(ctx, sc, err)
2102		}()
2103	}
2104	if err := validation.Validate([]validation.Validation{
2105		{TargetValue: maxresults,
2106			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
2107				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
2108					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
2109				}}}}}); err != nil {
2110		return result, validation.NewError("keyvault.BaseClient", "GetDeletedCertificates", err.Error())
2111	}
2112
2113	result.fn = client.getDeletedCertificatesNextResults
2114	req, err := client.GetDeletedCertificatesPreparer(ctx, vaultBaseURL, maxresults)
2115	if err != nil {
2116		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", nil, "Failure preparing request")
2117		return
2118	}
2119
2120	resp, err := client.GetDeletedCertificatesSender(req)
2121	if err != nil {
2122		result.dclr.Response = autorest.Response{Response: resp}
2123		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure sending request")
2124		return
2125	}
2126
2127	result.dclr, err = client.GetDeletedCertificatesResponder(resp)
2128	if err != nil {
2129		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure responding to request")
2130		return
2131	}
2132	if result.dclr.hasNextLink() && result.dclr.IsEmpty() {
2133		err = result.NextWithContext(ctx)
2134		return
2135	}
2136
2137	return
2138}
2139
2140// GetDeletedCertificatesPreparer prepares the GetDeletedCertificates request.
2141func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
2142	urlParameters := map[string]interface{}{
2143		"vaultBaseUrl": vaultBaseURL,
2144	}
2145
2146	const APIVersion = "2016-10-01"
2147	queryParameters := map[string]interface{}{
2148		"api-version": APIVersion,
2149	}
2150	if maxresults != nil {
2151		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
2152	}
2153
2154	preparer := autorest.CreatePreparer(
2155		autorest.AsGet(),
2156		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2157		autorest.WithPath("/deletedcertificates"),
2158		autorest.WithQueryParameters(queryParameters))
2159	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2160}
2161
2162// GetDeletedCertificatesSender sends the GetDeletedCertificates request. The method will close the
2163// http.Response Body if it receives an error.
2164func (client BaseClient) GetDeletedCertificatesSender(req *http.Request) (*http.Response, error) {
2165	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2166}
2167
2168// GetDeletedCertificatesResponder handles the response to the GetDeletedCertificates request. The method always
2169// closes the http.Response Body.
2170func (client BaseClient) GetDeletedCertificatesResponder(resp *http.Response) (result DeletedCertificateListResult, err error) {
2171	err = autorest.Respond(
2172		resp,
2173		azure.WithErrorUnlessStatusCode(http.StatusOK),
2174		autorest.ByUnmarshallingJSON(&result),
2175		autorest.ByClosing())
2176	result.Response = autorest.Response{Response: resp}
2177	return
2178}
2179
2180// getDeletedCertificatesNextResults retrieves the next set of results, if any.
2181func (client BaseClient) getDeletedCertificatesNextResults(ctx context.Context, lastResults DeletedCertificateListResult) (result DeletedCertificateListResult, err error) {
2182	req, err := lastResults.deletedCertificateListResultPreparer(ctx)
2183	if err != nil {
2184		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", nil, "Failure preparing next results request")
2185	}
2186	if req == nil {
2187		return
2188	}
2189	resp, err := client.GetDeletedCertificatesSender(req)
2190	if err != nil {
2191		result.Response = autorest.Response{Response: resp}
2192		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure sending next results request")
2193	}
2194	result, err = client.GetDeletedCertificatesResponder(resp)
2195	if err != nil {
2196		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure responding to next results request")
2197	}
2198	return
2199}
2200
2201// GetDeletedCertificatesComplete enumerates all values, automatically crossing page boundaries as required.
2202func (client BaseClient) GetDeletedCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedCertificateListResultIterator, err error) {
2203	if tracing.IsEnabled() {
2204		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificates")
2205		defer func() {
2206			sc := -1
2207			if result.Response().Response.Response != nil {
2208				sc = result.page.Response().Response.Response.StatusCode
2209			}
2210			tracing.EndSpan(ctx, sc, err)
2211		}()
2212	}
2213	result.page, err = client.GetDeletedCertificates(ctx, vaultBaseURL, maxresults)
2214	return
2215}
2216
2217// GetDeletedKey the Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be
2218// invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires
2219// the keys/get permission.
2220// Parameters:
2221// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2222// keyName - the name of the key.
2223func (client BaseClient) GetDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) {
2224	if tracing.IsEnabled() {
2225		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKey")
2226		defer func() {
2227			sc := -1
2228			if result.Response.Response != nil {
2229				sc = result.Response.Response.StatusCode
2230			}
2231			tracing.EndSpan(ctx, sc, err)
2232		}()
2233	}
2234	req, err := client.GetDeletedKeyPreparer(ctx, vaultBaseURL, keyName)
2235	if err != nil {
2236		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", nil, "Failure preparing request")
2237		return
2238	}
2239
2240	resp, err := client.GetDeletedKeySender(req)
2241	if err != nil {
2242		result.Response = autorest.Response{Response: resp}
2243		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure sending request")
2244		return
2245	}
2246
2247	result, err = client.GetDeletedKeyResponder(resp)
2248	if err != nil {
2249		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure responding to request")
2250		return
2251	}
2252
2253	return
2254}
2255
2256// GetDeletedKeyPreparer prepares the GetDeletedKey request.
2257func (client BaseClient) GetDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) {
2258	urlParameters := map[string]interface{}{
2259		"vaultBaseUrl": vaultBaseURL,
2260	}
2261
2262	pathParameters := map[string]interface{}{
2263		"key-name": autorest.Encode("path", keyName),
2264	}
2265
2266	const APIVersion = "2016-10-01"
2267	queryParameters := map[string]interface{}{
2268		"api-version": APIVersion,
2269	}
2270
2271	preparer := autorest.CreatePreparer(
2272		autorest.AsGet(),
2273		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2274		autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters),
2275		autorest.WithQueryParameters(queryParameters))
2276	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2277}
2278
2279// GetDeletedKeySender sends the GetDeletedKey request. The method will close the
2280// http.Response Body if it receives an error.
2281func (client BaseClient) GetDeletedKeySender(req *http.Request) (*http.Response, error) {
2282	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2283}
2284
2285// GetDeletedKeyResponder handles the response to the GetDeletedKey request. The method always
2286// closes the http.Response Body.
2287func (client BaseClient) GetDeletedKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) {
2288	err = autorest.Respond(
2289		resp,
2290		azure.WithErrorUnlessStatusCode(http.StatusOK),
2291		autorest.ByUnmarshallingJSON(&result),
2292		autorest.ByClosing())
2293	result.Response = autorest.Response{Response: resp}
2294	return
2295}
2296
2297// GetDeletedKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part
2298// of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is
2299// applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an
2300// error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission.
2301// Parameters:
2302// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2303// maxresults - maximum number of results to return in a page. If not specified the service will return up to
2304// 25 results.
2305func (client BaseClient) GetDeletedKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultPage, err error) {
2306	if tracing.IsEnabled() {
2307		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKeys")
2308		defer func() {
2309			sc := -1
2310			if result.dklr.Response.Response != nil {
2311				sc = result.dklr.Response.Response.StatusCode
2312			}
2313			tracing.EndSpan(ctx, sc, err)
2314		}()
2315	}
2316	if err := validation.Validate([]validation.Validation{
2317		{TargetValue: maxresults,
2318			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
2319				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
2320					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
2321				}}}}}); err != nil {
2322		return result, validation.NewError("keyvault.BaseClient", "GetDeletedKeys", err.Error())
2323	}
2324
2325	result.fn = client.getDeletedKeysNextResults
2326	req, err := client.GetDeletedKeysPreparer(ctx, vaultBaseURL, maxresults)
2327	if err != nil {
2328		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", nil, "Failure preparing request")
2329		return
2330	}
2331
2332	resp, err := client.GetDeletedKeysSender(req)
2333	if err != nil {
2334		result.dklr.Response = autorest.Response{Response: resp}
2335		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure sending request")
2336		return
2337	}
2338
2339	result.dklr, err = client.GetDeletedKeysResponder(resp)
2340	if err != nil {
2341		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure responding to request")
2342		return
2343	}
2344	if result.dklr.hasNextLink() && result.dklr.IsEmpty() {
2345		err = result.NextWithContext(ctx)
2346		return
2347	}
2348
2349	return
2350}
2351
2352// GetDeletedKeysPreparer prepares the GetDeletedKeys request.
2353func (client BaseClient) GetDeletedKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
2354	urlParameters := map[string]interface{}{
2355		"vaultBaseUrl": vaultBaseURL,
2356	}
2357
2358	const APIVersion = "2016-10-01"
2359	queryParameters := map[string]interface{}{
2360		"api-version": APIVersion,
2361	}
2362	if maxresults != nil {
2363		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
2364	}
2365
2366	preparer := autorest.CreatePreparer(
2367		autorest.AsGet(),
2368		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2369		autorest.WithPath("/deletedkeys"),
2370		autorest.WithQueryParameters(queryParameters))
2371	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2372}
2373
2374// GetDeletedKeysSender sends the GetDeletedKeys request. The method will close the
2375// http.Response Body if it receives an error.
2376func (client BaseClient) GetDeletedKeysSender(req *http.Request) (*http.Response, error) {
2377	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2378}
2379
2380// GetDeletedKeysResponder handles the response to the GetDeletedKeys request. The method always
2381// closes the http.Response Body.
2382func (client BaseClient) GetDeletedKeysResponder(resp *http.Response) (result DeletedKeyListResult, err error) {
2383	err = autorest.Respond(
2384		resp,
2385		azure.WithErrorUnlessStatusCode(http.StatusOK),
2386		autorest.ByUnmarshallingJSON(&result),
2387		autorest.ByClosing())
2388	result.Response = autorest.Response{Response: resp}
2389	return
2390}
2391
2392// getDeletedKeysNextResults retrieves the next set of results, if any.
2393func (client BaseClient) getDeletedKeysNextResults(ctx context.Context, lastResults DeletedKeyListResult) (result DeletedKeyListResult, err error) {
2394	req, err := lastResults.deletedKeyListResultPreparer(ctx)
2395	if err != nil {
2396		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", nil, "Failure preparing next results request")
2397	}
2398	if req == nil {
2399		return
2400	}
2401	resp, err := client.GetDeletedKeysSender(req)
2402	if err != nil {
2403		result.Response = autorest.Response{Response: resp}
2404		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure sending next results request")
2405	}
2406	result, err = client.GetDeletedKeysResponder(resp)
2407	if err != nil {
2408		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure responding to next results request")
2409	}
2410	return
2411}
2412
2413// GetDeletedKeysComplete enumerates all values, automatically crossing page boundaries as required.
2414func (client BaseClient) GetDeletedKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultIterator, err error) {
2415	if tracing.IsEnabled() {
2416		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKeys")
2417		defer func() {
2418			sc := -1
2419			if result.Response().Response.Response != nil {
2420				sc = result.page.Response().Response.Response.StatusCode
2421			}
2422			tracing.EndSpan(ctx, sc, err)
2423		}()
2424	}
2425	result.page, err = client.GetDeletedKeys(ctx, vaultBaseURL, maxresults)
2426	return
2427}
2428
2429// GetDeletedSecret the Get Deleted Secret operation returns the specified deleted secret along with its attributes.
2430// This operation requires the secrets/get permission.
2431// Parameters:
2432// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2433// secretName - the name of the secret.
2434func (client BaseClient) GetDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) {
2435	if tracing.IsEnabled() {
2436		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecret")
2437		defer func() {
2438			sc := -1
2439			if result.Response.Response != nil {
2440				sc = result.Response.Response.StatusCode
2441			}
2442			tracing.EndSpan(ctx, sc, err)
2443		}()
2444	}
2445	req, err := client.GetDeletedSecretPreparer(ctx, vaultBaseURL, secretName)
2446	if err != nil {
2447		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", nil, "Failure preparing request")
2448		return
2449	}
2450
2451	resp, err := client.GetDeletedSecretSender(req)
2452	if err != nil {
2453		result.Response = autorest.Response{Response: resp}
2454		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure sending request")
2455		return
2456	}
2457
2458	result, err = client.GetDeletedSecretResponder(resp)
2459	if err != nil {
2460		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure responding to request")
2461		return
2462	}
2463
2464	return
2465}
2466
2467// GetDeletedSecretPreparer prepares the GetDeletedSecret request.
2468func (client BaseClient) GetDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) {
2469	urlParameters := map[string]interface{}{
2470		"vaultBaseUrl": vaultBaseURL,
2471	}
2472
2473	pathParameters := map[string]interface{}{
2474		"secret-name": autorest.Encode("path", secretName),
2475	}
2476
2477	const APIVersion = "2016-10-01"
2478	queryParameters := map[string]interface{}{
2479		"api-version": APIVersion,
2480	}
2481
2482	preparer := autorest.CreatePreparer(
2483		autorest.AsGet(),
2484		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2485		autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters),
2486		autorest.WithQueryParameters(queryParameters))
2487	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2488}
2489
2490// GetDeletedSecretSender sends the GetDeletedSecret request. The method will close the
2491// http.Response Body if it receives an error.
2492func (client BaseClient) GetDeletedSecretSender(req *http.Request) (*http.Response, error) {
2493	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2494}
2495
2496// GetDeletedSecretResponder handles the response to the GetDeletedSecret request. The method always
2497// closes the http.Response Body.
2498func (client BaseClient) GetDeletedSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) {
2499	err = autorest.Respond(
2500		resp,
2501		azure.WithErrorUnlessStatusCode(http.StatusOK),
2502		autorest.ByUnmarshallingJSON(&result),
2503		autorest.ByClosing())
2504	result.Response = autorest.Response{Response: resp}
2505	return
2506}
2507
2508// GetDeletedSecrets the Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled
2509// for soft-delete. This operation requires the secrets/list permission.
2510// Parameters:
2511// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2512// maxresults - maximum number of results to return in a page. If not specified the service will return up to
2513// 25 results.
2514func (client BaseClient) GetDeletedSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultPage, err error) {
2515	if tracing.IsEnabled() {
2516		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecrets")
2517		defer func() {
2518			sc := -1
2519			if result.dslr.Response.Response != nil {
2520				sc = result.dslr.Response.Response.StatusCode
2521			}
2522			tracing.EndSpan(ctx, sc, err)
2523		}()
2524	}
2525	if err := validation.Validate([]validation.Validation{
2526		{TargetValue: maxresults,
2527			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
2528				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
2529					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
2530				}}}}}); err != nil {
2531		return result, validation.NewError("keyvault.BaseClient", "GetDeletedSecrets", err.Error())
2532	}
2533
2534	result.fn = client.getDeletedSecretsNextResults
2535	req, err := client.GetDeletedSecretsPreparer(ctx, vaultBaseURL, maxresults)
2536	if err != nil {
2537		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", nil, "Failure preparing request")
2538		return
2539	}
2540
2541	resp, err := client.GetDeletedSecretsSender(req)
2542	if err != nil {
2543		result.dslr.Response = autorest.Response{Response: resp}
2544		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure sending request")
2545		return
2546	}
2547
2548	result.dslr, err = client.GetDeletedSecretsResponder(resp)
2549	if err != nil {
2550		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure responding to request")
2551		return
2552	}
2553	if result.dslr.hasNextLink() && result.dslr.IsEmpty() {
2554		err = result.NextWithContext(ctx)
2555		return
2556	}
2557
2558	return
2559}
2560
2561// GetDeletedSecretsPreparer prepares the GetDeletedSecrets request.
2562func (client BaseClient) GetDeletedSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
2563	urlParameters := map[string]interface{}{
2564		"vaultBaseUrl": vaultBaseURL,
2565	}
2566
2567	const APIVersion = "2016-10-01"
2568	queryParameters := map[string]interface{}{
2569		"api-version": APIVersion,
2570	}
2571	if maxresults != nil {
2572		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
2573	}
2574
2575	preparer := autorest.CreatePreparer(
2576		autorest.AsGet(),
2577		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2578		autorest.WithPath("/deletedsecrets"),
2579		autorest.WithQueryParameters(queryParameters))
2580	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2581}
2582
2583// GetDeletedSecretsSender sends the GetDeletedSecrets request. The method will close the
2584// http.Response Body if it receives an error.
2585func (client BaseClient) GetDeletedSecretsSender(req *http.Request) (*http.Response, error) {
2586	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2587}
2588
2589// GetDeletedSecretsResponder handles the response to the GetDeletedSecrets request. The method always
2590// closes the http.Response Body.
2591func (client BaseClient) GetDeletedSecretsResponder(resp *http.Response) (result DeletedSecretListResult, err error) {
2592	err = autorest.Respond(
2593		resp,
2594		azure.WithErrorUnlessStatusCode(http.StatusOK),
2595		autorest.ByUnmarshallingJSON(&result),
2596		autorest.ByClosing())
2597	result.Response = autorest.Response{Response: resp}
2598	return
2599}
2600
2601// getDeletedSecretsNextResults retrieves the next set of results, if any.
2602func (client BaseClient) getDeletedSecretsNextResults(ctx context.Context, lastResults DeletedSecretListResult) (result DeletedSecretListResult, err error) {
2603	req, err := lastResults.deletedSecretListResultPreparer(ctx)
2604	if err != nil {
2605		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", nil, "Failure preparing next results request")
2606	}
2607	if req == nil {
2608		return
2609	}
2610	resp, err := client.GetDeletedSecretsSender(req)
2611	if err != nil {
2612		result.Response = autorest.Response{Response: resp}
2613		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure sending next results request")
2614	}
2615	result, err = client.GetDeletedSecretsResponder(resp)
2616	if err != nil {
2617		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure responding to next results request")
2618	}
2619	return
2620}
2621
2622// GetDeletedSecretsComplete enumerates all values, automatically crossing page boundaries as required.
2623func (client BaseClient) GetDeletedSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultIterator, err error) {
2624	if tracing.IsEnabled() {
2625		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecrets")
2626		defer func() {
2627			sc := -1
2628			if result.Response().Response.Response != nil {
2629				sc = result.page.Response().Response.Response.StatusCode
2630			}
2631			tracing.EndSpan(ctx, sc, err)
2632		}()
2633	}
2634	result.page, err = client.GetDeletedSecrets(ctx, vaultBaseURL, maxresults)
2635	return
2636}
2637
2638// GetKey the get key operation is applicable to all key types. If the requested key is symmetric, then no key material
2639// is released in the response. This operation requires the keys/get permission.
2640// Parameters:
2641// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2642// keyName - the name of the key to get.
2643// keyVersion - adding the version parameter retrieves a specific version of a key.
2644func (client BaseClient) GetKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) {
2645	if tracing.IsEnabled() {
2646		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKey")
2647		defer func() {
2648			sc := -1
2649			if result.Response.Response != nil {
2650				sc = result.Response.Response.StatusCode
2651			}
2652			tracing.EndSpan(ctx, sc, err)
2653		}()
2654	}
2655	req, err := client.GetKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion)
2656	if err != nil {
2657		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", nil, "Failure preparing request")
2658		return
2659	}
2660
2661	resp, err := client.GetKeySender(req)
2662	if err != nil {
2663		result.Response = autorest.Response{Response: resp}
2664		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure sending request")
2665		return
2666	}
2667
2668	result, err = client.GetKeyResponder(resp)
2669	if err != nil {
2670		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure responding to request")
2671		return
2672	}
2673
2674	return
2675}
2676
2677// GetKeyPreparer prepares the GetKey request.
2678func (client BaseClient) GetKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (*http.Request, error) {
2679	urlParameters := map[string]interface{}{
2680		"vaultBaseUrl": vaultBaseURL,
2681	}
2682
2683	pathParameters := map[string]interface{}{
2684		"key-name":    autorest.Encode("path", keyName),
2685		"key-version": autorest.Encode("path", keyVersion),
2686	}
2687
2688	const APIVersion = "2016-10-01"
2689	queryParameters := map[string]interface{}{
2690		"api-version": APIVersion,
2691	}
2692
2693	preparer := autorest.CreatePreparer(
2694		autorest.AsGet(),
2695		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2696		autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters),
2697		autorest.WithQueryParameters(queryParameters))
2698	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2699}
2700
2701// GetKeySender sends the GetKey request. The method will close the
2702// http.Response Body if it receives an error.
2703func (client BaseClient) GetKeySender(req *http.Request) (*http.Response, error) {
2704	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2705}
2706
2707// GetKeyResponder handles the response to the GetKey request. The method always
2708// closes the http.Response Body.
2709func (client BaseClient) GetKeyResponder(resp *http.Response) (result KeyBundle, err error) {
2710	err = autorest.Respond(
2711		resp,
2712		azure.WithErrorUnlessStatusCode(http.StatusOK),
2713		autorest.ByUnmarshallingJSON(&result),
2714		autorest.ByClosing())
2715	result.Response = autorest.Response{Response: resp}
2716	return
2717}
2718
2719// GetKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a
2720// stored key. The LIST operation is applicable to all key types, however only the base key identifier, attributes, and
2721// tags are provided in the response. Individual versions of a key are not listed in the response. This operation
2722// requires the keys/list permission.
2723// Parameters:
2724// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2725// maxresults - maximum number of results to return in a page. If not specified the service will return up to
2726// 25 results.
2727func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultPage, err error) {
2728	if tracing.IsEnabled() {
2729		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeys")
2730		defer func() {
2731			sc := -1
2732			if result.klr.Response.Response != nil {
2733				sc = result.klr.Response.Response.StatusCode
2734			}
2735			tracing.EndSpan(ctx, sc, err)
2736		}()
2737	}
2738	if err := validation.Validate([]validation.Validation{
2739		{TargetValue: maxresults,
2740			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
2741				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
2742					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
2743				}}}}}); err != nil {
2744		return result, validation.NewError("keyvault.BaseClient", "GetKeys", err.Error())
2745	}
2746
2747	result.fn = client.getKeysNextResults
2748	req, err := client.GetKeysPreparer(ctx, vaultBaseURL, maxresults)
2749	if err != nil {
2750		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", nil, "Failure preparing request")
2751		return
2752	}
2753
2754	resp, err := client.GetKeysSender(req)
2755	if err != nil {
2756		result.klr.Response = autorest.Response{Response: resp}
2757		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure sending request")
2758		return
2759	}
2760
2761	result.klr, err = client.GetKeysResponder(resp)
2762	if err != nil {
2763		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure responding to request")
2764		return
2765	}
2766	if result.klr.hasNextLink() && result.klr.IsEmpty() {
2767		err = result.NextWithContext(ctx)
2768		return
2769	}
2770
2771	return
2772}
2773
2774// GetKeysPreparer prepares the GetKeys request.
2775func (client BaseClient) GetKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
2776	urlParameters := map[string]interface{}{
2777		"vaultBaseUrl": vaultBaseURL,
2778	}
2779
2780	const APIVersion = "2016-10-01"
2781	queryParameters := map[string]interface{}{
2782		"api-version": APIVersion,
2783	}
2784	if maxresults != nil {
2785		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
2786	}
2787
2788	preparer := autorest.CreatePreparer(
2789		autorest.AsGet(),
2790		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2791		autorest.WithPath("/keys"),
2792		autorest.WithQueryParameters(queryParameters))
2793	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2794}
2795
2796// GetKeysSender sends the GetKeys request. The method will close the
2797// http.Response Body if it receives an error.
2798func (client BaseClient) GetKeysSender(req *http.Request) (*http.Response, error) {
2799	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2800}
2801
2802// GetKeysResponder handles the response to the GetKeys request. The method always
2803// closes the http.Response Body.
2804func (client BaseClient) GetKeysResponder(resp *http.Response) (result KeyListResult, err error) {
2805	err = autorest.Respond(
2806		resp,
2807		azure.WithErrorUnlessStatusCode(http.StatusOK),
2808		autorest.ByUnmarshallingJSON(&result),
2809		autorest.ByClosing())
2810	result.Response = autorest.Response{Response: resp}
2811	return
2812}
2813
2814// getKeysNextResults retrieves the next set of results, if any.
2815func (client BaseClient) getKeysNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) {
2816	req, err := lastResults.keyListResultPreparer(ctx)
2817	if err != nil {
2818		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", nil, "Failure preparing next results request")
2819	}
2820	if req == nil {
2821		return
2822	}
2823	resp, err := client.GetKeysSender(req)
2824	if err != nil {
2825		result.Response = autorest.Response{Response: resp}
2826		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure sending next results request")
2827	}
2828	result, err = client.GetKeysResponder(resp)
2829	if err != nil {
2830		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure responding to next results request")
2831	}
2832	return
2833}
2834
2835// GetKeysComplete enumerates all values, automatically crossing page boundaries as required.
2836func (client BaseClient) GetKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultIterator, err error) {
2837	if tracing.IsEnabled() {
2838		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeys")
2839		defer func() {
2840			sc := -1
2841			if result.Response().Response.Response != nil {
2842				sc = result.page.Response().Response.Response.StatusCode
2843			}
2844			tracing.EndSpan(ctx, sc, err)
2845		}()
2846	}
2847	result.page, err = client.GetKeys(ctx, vaultBaseURL, maxresults)
2848	return
2849}
2850
2851// GetKeyVersions the full key identifier, attributes, and tags are provided in the response. This operation requires
2852// the keys/list permission.
2853// Parameters:
2854// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2855// keyName - the name of the key.
2856// maxresults - maximum number of results to return in a page. If not specified the service will return up to
2857// 25 results.
2858func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultPage, err error) {
2859	if tracing.IsEnabled() {
2860		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeyVersions")
2861		defer func() {
2862			sc := -1
2863			if result.klr.Response.Response != nil {
2864				sc = result.klr.Response.Response.StatusCode
2865			}
2866			tracing.EndSpan(ctx, sc, err)
2867		}()
2868	}
2869	if err := validation.Validate([]validation.Validation{
2870		{TargetValue: maxresults,
2871			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
2872				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
2873					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
2874				}}}}}); err != nil {
2875		return result, validation.NewError("keyvault.BaseClient", "GetKeyVersions", err.Error())
2876	}
2877
2878	result.fn = client.getKeyVersionsNextResults
2879	req, err := client.GetKeyVersionsPreparer(ctx, vaultBaseURL, keyName, maxresults)
2880	if err != nil {
2881		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", nil, "Failure preparing request")
2882		return
2883	}
2884
2885	resp, err := client.GetKeyVersionsSender(req)
2886	if err != nil {
2887		result.klr.Response = autorest.Response{Response: resp}
2888		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure sending request")
2889		return
2890	}
2891
2892	result.klr, err = client.GetKeyVersionsResponder(resp)
2893	if err != nil {
2894		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure responding to request")
2895		return
2896	}
2897	if result.klr.hasNextLink() && result.klr.IsEmpty() {
2898		err = result.NextWithContext(ctx)
2899		return
2900	}
2901
2902	return
2903}
2904
2905// GetKeyVersionsPreparer prepares the GetKeyVersions request.
2906func (client BaseClient) GetKeyVersionsPreparer(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (*http.Request, error) {
2907	urlParameters := map[string]interface{}{
2908		"vaultBaseUrl": vaultBaseURL,
2909	}
2910
2911	pathParameters := map[string]interface{}{
2912		"key-name": autorest.Encode("path", keyName),
2913	}
2914
2915	const APIVersion = "2016-10-01"
2916	queryParameters := map[string]interface{}{
2917		"api-version": APIVersion,
2918	}
2919	if maxresults != nil {
2920		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
2921	}
2922
2923	preparer := autorest.CreatePreparer(
2924		autorest.AsGet(),
2925		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
2926		autorest.WithPathParameters("/keys/{key-name}/versions", pathParameters),
2927		autorest.WithQueryParameters(queryParameters))
2928	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2929}
2930
2931// GetKeyVersionsSender sends the GetKeyVersions request. The method will close the
2932// http.Response Body if it receives an error.
2933func (client BaseClient) GetKeyVersionsSender(req *http.Request) (*http.Response, error) {
2934	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2935}
2936
2937// GetKeyVersionsResponder handles the response to the GetKeyVersions request. The method always
2938// closes the http.Response Body.
2939func (client BaseClient) GetKeyVersionsResponder(resp *http.Response) (result KeyListResult, err error) {
2940	err = autorest.Respond(
2941		resp,
2942		azure.WithErrorUnlessStatusCode(http.StatusOK),
2943		autorest.ByUnmarshallingJSON(&result),
2944		autorest.ByClosing())
2945	result.Response = autorest.Response{Response: resp}
2946	return
2947}
2948
2949// getKeyVersionsNextResults retrieves the next set of results, if any.
2950func (client BaseClient) getKeyVersionsNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) {
2951	req, err := lastResults.keyListResultPreparer(ctx)
2952	if err != nil {
2953		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", nil, "Failure preparing next results request")
2954	}
2955	if req == nil {
2956		return
2957	}
2958	resp, err := client.GetKeyVersionsSender(req)
2959	if err != nil {
2960		result.Response = autorest.Response{Response: resp}
2961		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure sending next results request")
2962	}
2963	result, err = client.GetKeyVersionsResponder(resp)
2964	if err != nil {
2965		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure responding to next results request")
2966	}
2967	return
2968}
2969
2970// GetKeyVersionsComplete enumerates all values, automatically crossing page boundaries as required.
2971func (client BaseClient) GetKeyVersionsComplete(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultIterator, err error) {
2972	if tracing.IsEnabled() {
2973		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeyVersions")
2974		defer func() {
2975			sc := -1
2976			if result.Response().Response.Response != nil {
2977				sc = result.page.Response().Response.Response.StatusCode
2978			}
2979			tracing.EndSpan(ctx, sc, err)
2980		}()
2981	}
2982	result.page, err = client.GetKeyVersions(ctx, vaultBaseURL, keyName, maxresults)
2983	return
2984}
2985
2986// GetSasDefinition gets information about a SAS definition for the specified storage account. This operation requires
2987// the storage/getsas permission.
2988// Parameters:
2989// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
2990// storageAccountName - the name of the storage account.
2991// sasDefinitionName - the name of the SAS definition.
2992func (client BaseClient) GetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) {
2993	if tracing.IsEnabled() {
2994		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinition")
2995		defer func() {
2996			sc := -1
2997			if result.Response.Response != nil {
2998				sc = result.Response.Response.StatusCode
2999			}
3000			tracing.EndSpan(ctx, sc, err)
3001		}()
3002	}
3003	if err := validation.Validate([]validation.Validation{
3004		{TargetValue: storageAccountName,
3005			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
3006		{TargetValue: sasDefinitionName,
3007			Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
3008		return result, validation.NewError("keyvault.BaseClient", "GetSasDefinition", err.Error())
3009	}
3010
3011	req, err := client.GetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName)
3012	if err != nil {
3013		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", nil, "Failure preparing request")
3014		return
3015	}
3016
3017	resp, err := client.GetSasDefinitionSender(req)
3018	if err != nil {
3019		result.Response = autorest.Response{Response: resp}
3020		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure sending request")
3021		return
3022	}
3023
3024	result, err = client.GetSasDefinitionResponder(resp)
3025	if err != nil {
3026		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure responding to request")
3027		return
3028	}
3029
3030	return
3031}
3032
3033// GetSasDefinitionPreparer prepares the GetSasDefinition request.
3034func (client BaseClient) GetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) {
3035	urlParameters := map[string]interface{}{
3036		"vaultBaseUrl": vaultBaseURL,
3037	}
3038
3039	pathParameters := map[string]interface{}{
3040		"sas-definition-name":  autorest.Encode("path", sasDefinitionName),
3041		"storage-account-name": autorest.Encode("path", storageAccountName),
3042	}
3043
3044	const APIVersion = "2016-10-01"
3045	queryParameters := map[string]interface{}{
3046		"api-version": APIVersion,
3047	}
3048
3049	preparer := autorest.CreatePreparer(
3050		autorest.AsGet(),
3051		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3052		autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters),
3053		autorest.WithQueryParameters(queryParameters))
3054	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3055}
3056
3057// GetSasDefinitionSender sends the GetSasDefinition request. The method will close the
3058// http.Response Body if it receives an error.
3059func (client BaseClient) GetSasDefinitionSender(req *http.Request) (*http.Response, error) {
3060	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3061}
3062
3063// GetSasDefinitionResponder handles the response to the GetSasDefinition request. The method always
3064// closes the http.Response Body.
3065func (client BaseClient) GetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) {
3066	err = autorest.Respond(
3067		resp,
3068		azure.WithErrorUnlessStatusCode(http.StatusOK),
3069		autorest.ByUnmarshallingJSON(&result),
3070		autorest.ByClosing())
3071	result.Response = autorest.Response{Response: resp}
3072	return
3073}
3074
3075// GetSasDefinitions list storage SAS definitions for the given storage account. This operation requires the
3076// storage/listsas permission.
3077// Parameters:
3078// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3079// storageAccountName - the name of the storage account.
3080// maxresults - maximum number of results to return in a page. If not specified the service will return up to
3081// 25 results.
3082func (client BaseClient) GetSasDefinitions(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultPage, err error) {
3083	if tracing.IsEnabled() {
3084		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinitions")
3085		defer func() {
3086			sc := -1
3087			if result.sdlr.Response.Response != nil {
3088				sc = result.sdlr.Response.Response.StatusCode
3089			}
3090			tracing.EndSpan(ctx, sc, err)
3091		}()
3092	}
3093	if err := validation.Validate([]validation.Validation{
3094		{TargetValue: storageAccountName,
3095			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
3096		{TargetValue: maxresults,
3097			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
3098				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
3099					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
3100				}}}}}); err != nil {
3101		return result, validation.NewError("keyvault.BaseClient", "GetSasDefinitions", err.Error())
3102	}
3103
3104	result.fn = client.getSasDefinitionsNextResults
3105	req, err := client.GetSasDefinitionsPreparer(ctx, vaultBaseURL, storageAccountName, maxresults)
3106	if err != nil {
3107		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", nil, "Failure preparing request")
3108		return
3109	}
3110
3111	resp, err := client.GetSasDefinitionsSender(req)
3112	if err != nil {
3113		result.sdlr.Response = autorest.Response{Response: resp}
3114		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure sending request")
3115		return
3116	}
3117
3118	result.sdlr, err = client.GetSasDefinitionsResponder(resp)
3119	if err != nil {
3120		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure responding to request")
3121		return
3122	}
3123	if result.sdlr.hasNextLink() && result.sdlr.IsEmpty() {
3124		err = result.NextWithContext(ctx)
3125		return
3126	}
3127
3128	return
3129}
3130
3131// GetSasDefinitionsPreparer prepares the GetSasDefinitions request.
3132func (client BaseClient) GetSasDefinitionsPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (*http.Request, error) {
3133	urlParameters := map[string]interface{}{
3134		"vaultBaseUrl": vaultBaseURL,
3135	}
3136
3137	pathParameters := map[string]interface{}{
3138		"storage-account-name": autorest.Encode("path", storageAccountName),
3139	}
3140
3141	const APIVersion = "2016-10-01"
3142	queryParameters := map[string]interface{}{
3143		"api-version": APIVersion,
3144	}
3145	if maxresults != nil {
3146		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
3147	}
3148
3149	preparer := autorest.CreatePreparer(
3150		autorest.AsGet(),
3151		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3152		autorest.WithPathParameters("/storage/{storage-account-name}/sas", pathParameters),
3153		autorest.WithQueryParameters(queryParameters))
3154	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3155}
3156
3157// GetSasDefinitionsSender sends the GetSasDefinitions request. The method will close the
3158// http.Response Body if it receives an error.
3159func (client BaseClient) GetSasDefinitionsSender(req *http.Request) (*http.Response, error) {
3160	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3161}
3162
3163// GetSasDefinitionsResponder handles the response to the GetSasDefinitions request. The method always
3164// closes the http.Response Body.
3165func (client BaseClient) GetSasDefinitionsResponder(resp *http.Response) (result SasDefinitionListResult, err error) {
3166	err = autorest.Respond(
3167		resp,
3168		azure.WithErrorUnlessStatusCode(http.StatusOK),
3169		autorest.ByUnmarshallingJSON(&result),
3170		autorest.ByClosing())
3171	result.Response = autorest.Response{Response: resp}
3172	return
3173}
3174
3175// getSasDefinitionsNextResults retrieves the next set of results, if any.
3176func (client BaseClient) getSasDefinitionsNextResults(ctx context.Context, lastResults SasDefinitionListResult) (result SasDefinitionListResult, err error) {
3177	req, err := lastResults.sasDefinitionListResultPreparer(ctx)
3178	if err != nil {
3179		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", nil, "Failure preparing next results request")
3180	}
3181	if req == nil {
3182		return
3183	}
3184	resp, err := client.GetSasDefinitionsSender(req)
3185	if err != nil {
3186		result.Response = autorest.Response{Response: resp}
3187		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure sending next results request")
3188	}
3189	result, err = client.GetSasDefinitionsResponder(resp)
3190	if err != nil {
3191		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure responding to next results request")
3192	}
3193	return
3194}
3195
3196// GetSasDefinitionsComplete enumerates all values, automatically crossing page boundaries as required.
3197func (client BaseClient) GetSasDefinitionsComplete(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultIterator, err error) {
3198	if tracing.IsEnabled() {
3199		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinitions")
3200		defer func() {
3201			sc := -1
3202			if result.Response().Response.Response != nil {
3203				sc = result.page.Response().Response.Response.StatusCode
3204			}
3205			tracing.EndSpan(ctx, sc, err)
3206		}()
3207	}
3208	result.page, err = client.GetSasDefinitions(ctx, vaultBaseURL, storageAccountName, maxresults)
3209	return
3210}
3211
3212// GetSecret the GET operation is applicable to any secret stored in Azure Key Vault. This operation requires the
3213// secrets/get permission.
3214// Parameters:
3215// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3216// secretName - the name of the secret.
3217// secretVersion - the version of the secret.
3218func (client BaseClient) GetSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) {
3219	if tracing.IsEnabled() {
3220		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecret")
3221		defer func() {
3222			sc := -1
3223			if result.Response.Response != nil {
3224				sc = result.Response.Response.StatusCode
3225			}
3226			tracing.EndSpan(ctx, sc, err)
3227		}()
3228	}
3229	req, err := client.GetSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion)
3230	if err != nil {
3231		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", nil, "Failure preparing request")
3232		return
3233	}
3234
3235	resp, err := client.GetSecretSender(req)
3236	if err != nil {
3237		result.Response = autorest.Response{Response: resp}
3238		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure sending request")
3239		return
3240	}
3241
3242	result, err = client.GetSecretResponder(resp)
3243	if err != nil {
3244		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure responding to request")
3245		return
3246	}
3247
3248	return
3249}
3250
3251// GetSecretPreparer prepares the GetSecret request.
3252func (client BaseClient) GetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (*http.Request, error) {
3253	urlParameters := map[string]interface{}{
3254		"vaultBaseUrl": vaultBaseURL,
3255	}
3256
3257	pathParameters := map[string]interface{}{
3258		"secret-name":    autorest.Encode("path", secretName),
3259		"secret-version": autorest.Encode("path", secretVersion),
3260	}
3261
3262	const APIVersion = "2016-10-01"
3263	queryParameters := map[string]interface{}{
3264		"api-version": APIVersion,
3265	}
3266
3267	preparer := autorest.CreatePreparer(
3268		autorest.AsGet(),
3269		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3270		autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters),
3271		autorest.WithQueryParameters(queryParameters))
3272	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3273}
3274
3275// GetSecretSender sends the GetSecret request. The method will close the
3276// http.Response Body if it receives an error.
3277func (client BaseClient) GetSecretSender(req *http.Request) (*http.Response, error) {
3278	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3279}
3280
3281// GetSecretResponder handles the response to the GetSecret request. The method always
3282// closes the http.Response Body.
3283func (client BaseClient) GetSecretResponder(resp *http.Response) (result SecretBundle, err error) {
3284	err = autorest.Respond(
3285		resp,
3286		azure.WithErrorUnlessStatusCode(http.StatusOK),
3287		autorest.ByUnmarshallingJSON(&result),
3288		autorest.ByClosing())
3289	result.Response = autorest.Response{Response: resp}
3290	return
3291}
3292
3293// GetSecrets the Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and
3294// its attributes are provided in the response. Individual secret versions are not listed in the response. This
3295// operation requires the secrets/list permission.
3296// Parameters:
3297// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3298// maxresults - maximum number of results to return in a page. If not specified, the service will return up to
3299// 25 results.
3300func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultPage, err error) {
3301	if tracing.IsEnabled() {
3302		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecrets")
3303		defer func() {
3304			sc := -1
3305			if result.slr.Response.Response != nil {
3306				sc = result.slr.Response.Response.StatusCode
3307			}
3308			tracing.EndSpan(ctx, sc, err)
3309		}()
3310	}
3311	if err := validation.Validate([]validation.Validation{
3312		{TargetValue: maxresults,
3313			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
3314				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
3315					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
3316				}}}}}); err != nil {
3317		return result, validation.NewError("keyvault.BaseClient", "GetSecrets", err.Error())
3318	}
3319
3320	result.fn = client.getSecretsNextResults
3321	req, err := client.GetSecretsPreparer(ctx, vaultBaseURL, maxresults)
3322	if err != nil {
3323		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", nil, "Failure preparing request")
3324		return
3325	}
3326
3327	resp, err := client.GetSecretsSender(req)
3328	if err != nil {
3329		result.slr.Response = autorest.Response{Response: resp}
3330		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure sending request")
3331		return
3332	}
3333
3334	result.slr, err = client.GetSecretsResponder(resp)
3335	if err != nil {
3336		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure responding to request")
3337		return
3338	}
3339	if result.slr.hasNextLink() && result.slr.IsEmpty() {
3340		err = result.NextWithContext(ctx)
3341		return
3342	}
3343
3344	return
3345}
3346
3347// GetSecretsPreparer prepares the GetSecrets request.
3348func (client BaseClient) GetSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
3349	urlParameters := map[string]interface{}{
3350		"vaultBaseUrl": vaultBaseURL,
3351	}
3352
3353	const APIVersion = "2016-10-01"
3354	queryParameters := map[string]interface{}{
3355		"api-version": APIVersion,
3356	}
3357	if maxresults != nil {
3358		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
3359	}
3360
3361	preparer := autorest.CreatePreparer(
3362		autorest.AsGet(),
3363		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3364		autorest.WithPath("/secrets"),
3365		autorest.WithQueryParameters(queryParameters))
3366	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3367}
3368
3369// GetSecretsSender sends the GetSecrets request. The method will close the
3370// http.Response Body if it receives an error.
3371func (client BaseClient) GetSecretsSender(req *http.Request) (*http.Response, error) {
3372	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3373}
3374
3375// GetSecretsResponder handles the response to the GetSecrets request. The method always
3376// closes the http.Response Body.
3377func (client BaseClient) GetSecretsResponder(resp *http.Response) (result SecretListResult, err error) {
3378	err = autorest.Respond(
3379		resp,
3380		azure.WithErrorUnlessStatusCode(http.StatusOK),
3381		autorest.ByUnmarshallingJSON(&result),
3382		autorest.ByClosing())
3383	result.Response = autorest.Response{Response: resp}
3384	return
3385}
3386
3387// getSecretsNextResults retrieves the next set of results, if any.
3388func (client BaseClient) getSecretsNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) {
3389	req, err := lastResults.secretListResultPreparer(ctx)
3390	if err != nil {
3391		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", nil, "Failure preparing next results request")
3392	}
3393	if req == nil {
3394		return
3395	}
3396	resp, err := client.GetSecretsSender(req)
3397	if err != nil {
3398		result.Response = autorest.Response{Response: resp}
3399		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure sending next results request")
3400	}
3401	result, err = client.GetSecretsResponder(resp)
3402	if err != nil {
3403		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure responding to next results request")
3404	}
3405	return
3406}
3407
3408// GetSecretsComplete enumerates all values, automatically crossing page boundaries as required.
3409func (client BaseClient) GetSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultIterator, err error) {
3410	if tracing.IsEnabled() {
3411		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecrets")
3412		defer func() {
3413			sc := -1
3414			if result.Response().Response.Response != nil {
3415				sc = result.page.Response().Response.Response.StatusCode
3416			}
3417			tracing.EndSpan(ctx, sc, err)
3418		}()
3419	}
3420	result.page, err = client.GetSecrets(ctx, vaultBaseURL, maxresults)
3421	return
3422}
3423
3424// GetSecretVersions the full secret identifier and attributes are provided in the response. No values are returned for
3425// the secrets. This operations requires the secrets/list permission.
3426// Parameters:
3427// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3428// secretName - the name of the secret.
3429// maxresults - maximum number of results to return in a page. If not specified, the service will return up to
3430// 25 results.
3431func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultPage, err error) {
3432	if tracing.IsEnabled() {
3433		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecretVersions")
3434		defer func() {
3435			sc := -1
3436			if result.slr.Response.Response != nil {
3437				sc = result.slr.Response.Response.StatusCode
3438			}
3439			tracing.EndSpan(ctx, sc, err)
3440		}()
3441	}
3442	if err := validation.Validate([]validation.Validation{
3443		{TargetValue: maxresults,
3444			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
3445				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
3446					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
3447				}}}}}); err != nil {
3448		return result, validation.NewError("keyvault.BaseClient", "GetSecretVersions", err.Error())
3449	}
3450
3451	result.fn = client.getSecretVersionsNextResults
3452	req, err := client.GetSecretVersionsPreparer(ctx, vaultBaseURL, secretName, maxresults)
3453	if err != nil {
3454		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", nil, "Failure preparing request")
3455		return
3456	}
3457
3458	resp, err := client.GetSecretVersionsSender(req)
3459	if err != nil {
3460		result.slr.Response = autorest.Response{Response: resp}
3461		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure sending request")
3462		return
3463	}
3464
3465	result.slr, err = client.GetSecretVersionsResponder(resp)
3466	if err != nil {
3467		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure responding to request")
3468		return
3469	}
3470	if result.slr.hasNextLink() && result.slr.IsEmpty() {
3471		err = result.NextWithContext(ctx)
3472		return
3473	}
3474
3475	return
3476}
3477
3478// GetSecretVersionsPreparer prepares the GetSecretVersions request.
3479func (client BaseClient) GetSecretVersionsPreparer(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (*http.Request, error) {
3480	urlParameters := map[string]interface{}{
3481		"vaultBaseUrl": vaultBaseURL,
3482	}
3483
3484	pathParameters := map[string]interface{}{
3485		"secret-name": autorest.Encode("path", secretName),
3486	}
3487
3488	const APIVersion = "2016-10-01"
3489	queryParameters := map[string]interface{}{
3490		"api-version": APIVersion,
3491	}
3492	if maxresults != nil {
3493		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
3494	}
3495
3496	preparer := autorest.CreatePreparer(
3497		autorest.AsGet(),
3498		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3499		autorest.WithPathParameters("/secrets/{secret-name}/versions", pathParameters),
3500		autorest.WithQueryParameters(queryParameters))
3501	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3502}
3503
3504// GetSecretVersionsSender sends the GetSecretVersions request. The method will close the
3505// http.Response Body if it receives an error.
3506func (client BaseClient) GetSecretVersionsSender(req *http.Request) (*http.Response, error) {
3507	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3508}
3509
3510// GetSecretVersionsResponder handles the response to the GetSecretVersions request. The method always
3511// closes the http.Response Body.
3512func (client BaseClient) GetSecretVersionsResponder(resp *http.Response) (result SecretListResult, err error) {
3513	err = autorest.Respond(
3514		resp,
3515		azure.WithErrorUnlessStatusCode(http.StatusOK),
3516		autorest.ByUnmarshallingJSON(&result),
3517		autorest.ByClosing())
3518	result.Response = autorest.Response{Response: resp}
3519	return
3520}
3521
3522// getSecretVersionsNextResults retrieves the next set of results, if any.
3523func (client BaseClient) getSecretVersionsNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) {
3524	req, err := lastResults.secretListResultPreparer(ctx)
3525	if err != nil {
3526		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", nil, "Failure preparing next results request")
3527	}
3528	if req == nil {
3529		return
3530	}
3531	resp, err := client.GetSecretVersionsSender(req)
3532	if err != nil {
3533		result.Response = autorest.Response{Response: resp}
3534		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure sending next results request")
3535	}
3536	result, err = client.GetSecretVersionsResponder(resp)
3537	if err != nil {
3538		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure responding to next results request")
3539	}
3540	return
3541}
3542
3543// GetSecretVersionsComplete enumerates all values, automatically crossing page boundaries as required.
3544func (client BaseClient) GetSecretVersionsComplete(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultIterator, err error) {
3545	if tracing.IsEnabled() {
3546		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecretVersions")
3547		defer func() {
3548			sc := -1
3549			if result.Response().Response.Response != nil {
3550				sc = result.page.Response().Response.Response.StatusCode
3551			}
3552			tracing.EndSpan(ctx, sc, err)
3553		}()
3554	}
3555	result.page, err = client.GetSecretVersions(ctx, vaultBaseURL, secretName, maxresults)
3556	return
3557}
3558
3559// GetStorageAccount gets information about a specified storage account. This operation requires the storage/get
3560// permission.
3561// Parameters:
3562// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3563// storageAccountName - the name of the storage account.
3564func (client BaseClient) GetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) {
3565	if tracing.IsEnabled() {
3566		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccount")
3567		defer func() {
3568			sc := -1
3569			if result.Response.Response != nil {
3570				sc = result.Response.Response.StatusCode
3571			}
3572			tracing.EndSpan(ctx, sc, err)
3573		}()
3574	}
3575	if err := validation.Validate([]validation.Validation{
3576		{TargetValue: storageAccountName,
3577			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
3578		return result, validation.NewError("keyvault.BaseClient", "GetStorageAccount", err.Error())
3579	}
3580
3581	req, err := client.GetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName)
3582	if err != nil {
3583		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", nil, "Failure preparing request")
3584		return
3585	}
3586
3587	resp, err := client.GetStorageAccountSender(req)
3588	if err != nil {
3589		result.Response = autorest.Response{Response: resp}
3590		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure sending request")
3591		return
3592	}
3593
3594	result, err = client.GetStorageAccountResponder(resp)
3595	if err != nil {
3596		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure responding to request")
3597		return
3598	}
3599
3600	return
3601}
3602
3603// GetStorageAccountPreparer prepares the GetStorageAccount request.
3604func (client BaseClient) GetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) {
3605	urlParameters := map[string]interface{}{
3606		"vaultBaseUrl": vaultBaseURL,
3607	}
3608
3609	pathParameters := map[string]interface{}{
3610		"storage-account-name": autorest.Encode("path", storageAccountName),
3611	}
3612
3613	const APIVersion = "2016-10-01"
3614	queryParameters := map[string]interface{}{
3615		"api-version": APIVersion,
3616	}
3617
3618	preparer := autorest.CreatePreparer(
3619		autorest.AsGet(),
3620		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3621		autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters),
3622		autorest.WithQueryParameters(queryParameters))
3623	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3624}
3625
3626// GetStorageAccountSender sends the GetStorageAccount request. The method will close the
3627// http.Response Body if it receives an error.
3628func (client BaseClient) GetStorageAccountSender(req *http.Request) (*http.Response, error) {
3629	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3630}
3631
3632// GetStorageAccountResponder handles the response to the GetStorageAccount request. The method always
3633// closes the http.Response Body.
3634func (client BaseClient) GetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) {
3635	err = autorest.Respond(
3636		resp,
3637		azure.WithErrorUnlessStatusCode(http.StatusOK),
3638		autorest.ByUnmarshallingJSON(&result),
3639		autorest.ByClosing())
3640	result.Response = autorest.Response{Response: resp}
3641	return
3642}
3643
3644// GetStorageAccounts list storage accounts managed by the specified key vault. This operation requires the
3645// storage/list permission.
3646// Parameters:
3647// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3648// maxresults - maximum number of results to return in a page. If not specified the service will return up to
3649// 25 results.
3650func (client BaseClient) GetStorageAccounts(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultPage, err error) {
3651	if tracing.IsEnabled() {
3652		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccounts")
3653		defer func() {
3654			sc := -1
3655			if result.slr.Response.Response != nil {
3656				sc = result.slr.Response.Response.StatusCode
3657			}
3658			tracing.EndSpan(ctx, sc, err)
3659		}()
3660	}
3661	if err := validation.Validate([]validation.Validation{
3662		{TargetValue: maxresults,
3663			Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false,
3664				Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil},
3665					{Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
3666				}}}}}); err != nil {
3667		return result, validation.NewError("keyvault.BaseClient", "GetStorageAccounts", err.Error())
3668	}
3669
3670	result.fn = client.getStorageAccountsNextResults
3671	req, err := client.GetStorageAccountsPreparer(ctx, vaultBaseURL, maxresults)
3672	if err != nil {
3673		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", nil, "Failure preparing request")
3674		return
3675	}
3676
3677	resp, err := client.GetStorageAccountsSender(req)
3678	if err != nil {
3679		result.slr.Response = autorest.Response{Response: resp}
3680		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure sending request")
3681		return
3682	}
3683
3684	result.slr, err = client.GetStorageAccountsResponder(resp)
3685	if err != nil {
3686		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure responding to request")
3687		return
3688	}
3689	if result.slr.hasNextLink() && result.slr.IsEmpty() {
3690		err = result.NextWithContext(ctx)
3691		return
3692	}
3693
3694	return
3695}
3696
3697// GetStorageAccountsPreparer prepares the GetStorageAccounts request.
3698func (client BaseClient) GetStorageAccountsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) {
3699	urlParameters := map[string]interface{}{
3700		"vaultBaseUrl": vaultBaseURL,
3701	}
3702
3703	const APIVersion = "2016-10-01"
3704	queryParameters := map[string]interface{}{
3705		"api-version": APIVersion,
3706	}
3707	if maxresults != nil {
3708		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
3709	}
3710
3711	preparer := autorest.CreatePreparer(
3712		autorest.AsGet(),
3713		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3714		autorest.WithPath("/storage"),
3715		autorest.WithQueryParameters(queryParameters))
3716	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3717}
3718
3719// GetStorageAccountsSender sends the GetStorageAccounts request. The method will close the
3720// http.Response Body if it receives an error.
3721func (client BaseClient) GetStorageAccountsSender(req *http.Request) (*http.Response, error) {
3722	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3723}
3724
3725// GetStorageAccountsResponder handles the response to the GetStorageAccounts request. The method always
3726// closes the http.Response Body.
3727func (client BaseClient) GetStorageAccountsResponder(resp *http.Response) (result StorageListResult, err error) {
3728	err = autorest.Respond(
3729		resp,
3730		azure.WithErrorUnlessStatusCode(http.StatusOK),
3731		autorest.ByUnmarshallingJSON(&result),
3732		autorest.ByClosing())
3733	result.Response = autorest.Response{Response: resp}
3734	return
3735}
3736
3737// getStorageAccountsNextResults retrieves the next set of results, if any.
3738func (client BaseClient) getStorageAccountsNextResults(ctx context.Context, lastResults StorageListResult) (result StorageListResult, err error) {
3739	req, err := lastResults.storageListResultPreparer(ctx)
3740	if err != nil {
3741		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", nil, "Failure preparing next results request")
3742	}
3743	if req == nil {
3744		return
3745	}
3746	resp, err := client.GetStorageAccountsSender(req)
3747	if err != nil {
3748		result.Response = autorest.Response{Response: resp}
3749		return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure sending next results request")
3750	}
3751	result, err = client.GetStorageAccountsResponder(resp)
3752	if err != nil {
3753		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure responding to next results request")
3754	}
3755	return
3756}
3757
3758// GetStorageAccountsComplete enumerates all values, automatically crossing page boundaries as required.
3759func (client BaseClient) GetStorageAccountsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultIterator, err error) {
3760	if tracing.IsEnabled() {
3761		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccounts")
3762		defer func() {
3763			sc := -1
3764			if result.Response().Response.Response != nil {
3765				sc = result.page.Response().Response.Response.StatusCode
3766			}
3767			tracing.EndSpan(ctx, sc, err)
3768		}()
3769	}
3770	result.page, err = client.GetStorageAccounts(ctx, vaultBaseURL, maxresults)
3771	return
3772}
3773
3774// ImportCertificate imports an existing valid certificate, containing a private key, into Azure Key Vault. The
3775// certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must
3776// contain the key as well as x509 certificates. This operation requires the certificates/import permission.
3777// Parameters:
3778// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3779// certificateName - the name of the certificate.
3780// parameters - the parameters to import the certificate.
3781func (client BaseClient) ImportCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (result CertificateBundle, err error) {
3782	if tracing.IsEnabled() {
3783		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ImportCertificate")
3784		defer func() {
3785			sc := -1
3786			if result.Response.Response != nil {
3787				sc = result.Response.Response.StatusCode
3788			}
3789			tracing.EndSpan(ctx, sc, err)
3790		}()
3791	}
3792	if err := validation.Validate([]validation.Validation{
3793		{TargetValue: certificateName,
3794			Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}},
3795		{TargetValue: parameters,
3796			Constraints: []validation.Constraint{{Target: "parameters.Base64EncodedCertificate", Name: validation.Null, Rule: true, Chain: nil},
3797				{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false,
3798					Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false,
3799						Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false,
3800							Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}},
3801						}},
3802					}}}}}); err != nil {
3803		return result, validation.NewError("keyvault.BaseClient", "ImportCertificate", err.Error())
3804	}
3805
3806	req, err := client.ImportCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters)
3807	if err != nil {
3808		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", nil, "Failure preparing request")
3809		return
3810	}
3811
3812	resp, err := client.ImportCertificateSender(req)
3813	if err != nil {
3814		result.Response = autorest.Response{Response: resp}
3815		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure sending request")
3816		return
3817	}
3818
3819	result, err = client.ImportCertificateResponder(resp)
3820	if err != nil {
3821		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure responding to request")
3822		return
3823	}
3824
3825	return
3826}
3827
3828// ImportCertificatePreparer prepares the ImportCertificate request.
3829func (client BaseClient) ImportCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (*http.Request, error) {
3830	urlParameters := map[string]interface{}{
3831		"vaultBaseUrl": vaultBaseURL,
3832	}
3833
3834	pathParameters := map[string]interface{}{
3835		"certificate-name": autorest.Encode("path", certificateName),
3836	}
3837
3838	const APIVersion = "2016-10-01"
3839	queryParameters := map[string]interface{}{
3840		"api-version": APIVersion,
3841	}
3842
3843	preparer := autorest.CreatePreparer(
3844		autorest.AsContentType("application/json; charset=utf-8"),
3845		autorest.AsPost(),
3846		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3847		autorest.WithPathParameters("/certificates/{certificate-name}/import", pathParameters),
3848		autorest.WithJSON(parameters),
3849		autorest.WithQueryParameters(queryParameters))
3850	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3851}
3852
3853// ImportCertificateSender sends the ImportCertificate request. The method will close the
3854// http.Response Body if it receives an error.
3855func (client BaseClient) ImportCertificateSender(req *http.Request) (*http.Response, error) {
3856	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3857}
3858
3859// ImportCertificateResponder handles the response to the ImportCertificate request. The method always
3860// closes the http.Response Body.
3861func (client BaseClient) ImportCertificateResponder(resp *http.Response) (result CertificateBundle, err error) {
3862	err = autorest.Respond(
3863		resp,
3864		azure.WithErrorUnlessStatusCode(http.StatusOK),
3865		autorest.ByUnmarshallingJSON(&result),
3866		autorest.ByClosing())
3867	result.Response = autorest.Response{Response: resp}
3868	return
3869}
3870
3871// ImportKey the import key operation may be used to import any key type into an Azure Key Vault. If the named key
3872// already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import
3873// permission.
3874// Parameters:
3875// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3876// keyName - name for the imported key.
3877// parameters - the parameters to import a key.
3878func (client BaseClient) ImportKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (result KeyBundle, err error) {
3879	if tracing.IsEnabled() {
3880		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ImportKey")
3881		defer func() {
3882			sc := -1
3883			if result.Response.Response != nil {
3884				sc = result.Response.Response.StatusCode
3885			}
3886			tracing.EndSpan(ctx, sc, err)
3887		}()
3888	}
3889	if err := validation.Validate([]validation.Validation{
3890		{TargetValue: keyName,
3891			Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}},
3892		{TargetValue: parameters,
3893			Constraints: []validation.Constraint{{Target: "parameters.Key", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
3894		return result, validation.NewError("keyvault.BaseClient", "ImportKey", err.Error())
3895	}
3896
3897	req, err := client.ImportKeyPreparer(ctx, vaultBaseURL, keyName, parameters)
3898	if err != nil {
3899		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", nil, "Failure preparing request")
3900		return
3901	}
3902
3903	resp, err := client.ImportKeySender(req)
3904	if err != nil {
3905		result.Response = autorest.Response{Response: resp}
3906		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure sending request")
3907		return
3908	}
3909
3910	result, err = client.ImportKeyResponder(resp)
3911	if err != nil {
3912		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure responding to request")
3913		return
3914	}
3915
3916	return
3917}
3918
3919// ImportKeyPreparer prepares the ImportKey request.
3920func (client BaseClient) ImportKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (*http.Request, error) {
3921	urlParameters := map[string]interface{}{
3922		"vaultBaseUrl": vaultBaseURL,
3923	}
3924
3925	pathParameters := map[string]interface{}{
3926		"key-name": autorest.Encode("path", keyName),
3927	}
3928
3929	const APIVersion = "2016-10-01"
3930	queryParameters := map[string]interface{}{
3931		"api-version": APIVersion,
3932	}
3933
3934	preparer := autorest.CreatePreparer(
3935		autorest.AsContentType("application/json; charset=utf-8"),
3936		autorest.AsPut(),
3937		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
3938		autorest.WithPathParameters("/keys/{key-name}", pathParameters),
3939		autorest.WithJSON(parameters),
3940		autorest.WithQueryParameters(queryParameters))
3941	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3942}
3943
3944// ImportKeySender sends the ImportKey request. The method will close the
3945// http.Response Body if it receives an error.
3946func (client BaseClient) ImportKeySender(req *http.Request) (*http.Response, error) {
3947	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3948}
3949
3950// ImportKeyResponder handles the response to the ImportKey request. The method always
3951// closes the http.Response Body.
3952func (client BaseClient) ImportKeyResponder(resp *http.Response) (result KeyBundle, err error) {
3953	err = autorest.Respond(
3954		resp,
3955		azure.WithErrorUnlessStatusCode(http.StatusOK),
3956		autorest.ByUnmarshallingJSON(&result),
3957		autorest.ByClosing())
3958	result.Response = autorest.Response{Response: resp}
3959	return
3960}
3961
3962// MergeCertificate the MergeCertificate operation performs the merging of a certificate or certificate chain with a
3963// key pair currently available in the service. This operation requires the certificates/create permission.
3964// Parameters:
3965// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
3966// certificateName - the name of the certificate.
3967// parameters - the parameters to merge certificate.
3968func (client BaseClient) MergeCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (result CertificateBundle, err error) {
3969	if tracing.IsEnabled() {
3970		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.MergeCertificate")
3971		defer func() {
3972			sc := -1
3973			if result.Response.Response != nil {
3974				sc = result.Response.Response.StatusCode
3975			}
3976			tracing.EndSpan(ctx, sc, err)
3977		}()
3978	}
3979	if err := validation.Validate([]validation.Validation{
3980		{TargetValue: parameters,
3981			Constraints: []validation.Constraint{{Target: "parameters.X509Certificates", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
3982		return result, validation.NewError("keyvault.BaseClient", "MergeCertificate", err.Error())
3983	}
3984
3985	req, err := client.MergeCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters)
3986	if err != nil {
3987		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", nil, "Failure preparing request")
3988		return
3989	}
3990
3991	resp, err := client.MergeCertificateSender(req)
3992	if err != nil {
3993		result.Response = autorest.Response{Response: resp}
3994		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure sending request")
3995		return
3996	}
3997
3998	result, err = client.MergeCertificateResponder(resp)
3999	if err != nil {
4000		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure responding to request")
4001		return
4002	}
4003
4004	return
4005}
4006
4007// MergeCertificatePreparer prepares the MergeCertificate request.
4008func (client BaseClient) MergeCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (*http.Request, error) {
4009	urlParameters := map[string]interface{}{
4010		"vaultBaseUrl": vaultBaseURL,
4011	}
4012
4013	pathParameters := map[string]interface{}{
4014		"certificate-name": autorest.Encode("path", certificateName),
4015	}
4016
4017	const APIVersion = "2016-10-01"
4018	queryParameters := map[string]interface{}{
4019		"api-version": APIVersion,
4020	}
4021
4022	preparer := autorest.CreatePreparer(
4023		autorest.AsContentType("application/json; charset=utf-8"),
4024		autorest.AsPost(),
4025		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4026		autorest.WithPathParameters("/certificates/{certificate-name}/pending/merge", pathParameters),
4027		autorest.WithJSON(parameters),
4028		autorest.WithQueryParameters(queryParameters))
4029	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4030}
4031
4032// MergeCertificateSender sends the MergeCertificate request. The method will close the
4033// http.Response Body if it receives an error.
4034func (client BaseClient) MergeCertificateSender(req *http.Request) (*http.Response, error) {
4035	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4036}
4037
4038// MergeCertificateResponder handles the response to the MergeCertificate request. The method always
4039// closes the http.Response Body.
4040func (client BaseClient) MergeCertificateResponder(resp *http.Response) (result CertificateBundle, err error) {
4041	err = autorest.Respond(
4042		resp,
4043		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
4044		autorest.ByUnmarshallingJSON(&result),
4045		autorest.ByClosing())
4046	result.Response = autorest.Response{Response: resp}
4047	return
4048}
4049
4050// PurgeDeletedCertificate the PurgeDeletedCertificate operation performs an irreversible deletion of the specified
4051// certificate, without possibility for recovery. The operation is not available if the recovery level does not specify
4052// 'Purgeable'. This operation requires the certificate/purge permission.
4053// Parameters:
4054// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4055// certificateName - the name of the certificate
4056func (client BaseClient) PurgeDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result autorest.Response, err error) {
4057	if tracing.IsEnabled() {
4058		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedCertificate")
4059		defer func() {
4060			sc := -1
4061			if result.Response != nil {
4062				sc = result.Response.StatusCode
4063			}
4064			tracing.EndSpan(ctx, sc, err)
4065		}()
4066	}
4067	req, err := client.PurgeDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName)
4068	if err != nil {
4069		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", nil, "Failure preparing request")
4070		return
4071	}
4072
4073	resp, err := client.PurgeDeletedCertificateSender(req)
4074	if err != nil {
4075		result.Response = resp
4076		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure sending request")
4077		return
4078	}
4079
4080	result, err = client.PurgeDeletedCertificateResponder(resp)
4081	if err != nil {
4082		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure responding to request")
4083		return
4084	}
4085
4086	return
4087}
4088
4089// PurgeDeletedCertificatePreparer prepares the PurgeDeletedCertificate request.
4090func (client BaseClient) PurgeDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
4091	urlParameters := map[string]interface{}{
4092		"vaultBaseUrl": vaultBaseURL,
4093	}
4094
4095	pathParameters := map[string]interface{}{
4096		"certificate-name": autorest.Encode("path", certificateName),
4097	}
4098
4099	const APIVersion = "2016-10-01"
4100	queryParameters := map[string]interface{}{
4101		"api-version": APIVersion,
4102	}
4103
4104	preparer := autorest.CreatePreparer(
4105		autorest.AsDelete(),
4106		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4107		autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters),
4108		autorest.WithQueryParameters(queryParameters))
4109	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4110}
4111
4112// PurgeDeletedCertificateSender sends the PurgeDeletedCertificate request. The method will close the
4113// http.Response Body if it receives an error.
4114func (client BaseClient) PurgeDeletedCertificateSender(req *http.Request) (*http.Response, error) {
4115	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4116}
4117
4118// PurgeDeletedCertificateResponder handles the response to the PurgeDeletedCertificate request. The method always
4119// closes the http.Response Body.
4120func (client BaseClient) PurgeDeletedCertificateResponder(resp *http.Response) (result autorest.Response, err error) {
4121	err = autorest.Respond(
4122		resp,
4123		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
4124		autorest.ByClosing())
4125	result.Response = resp
4126	return
4127}
4128
4129// PurgeDeletedKey the Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation
4130// can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation
4131// requires the keys/purge permission.
4132// Parameters:
4133// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4134// keyName - the name of the key
4135func (client BaseClient) PurgeDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result autorest.Response, err error) {
4136	if tracing.IsEnabled() {
4137		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedKey")
4138		defer func() {
4139			sc := -1
4140			if result.Response != nil {
4141				sc = result.Response.StatusCode
4142			}
4143			tracing.EndSpan(ctx, sc, err)
4144		}()
4145	}
4146	req, err := client.PurgeDeletedKeyPreparer(ctx, vaultBaseURL, keyName)
4147	if err != nil {
4148		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", nil, "Failure preparing request")
4149		return
4150	}
4151
4152	resp, err := client.PurgeDeletedKeySender(req)
4153	if err != nil {
4154		result.Response = resp
4155		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure sending request")
4156		return
4157	}
4158
4159	result, err = client.PurgeDeletedKeyResponder(resp)
4160	if err != nil {
4161		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure responding to request")
4162		return
4163	}
4164
4165	return
4166}
4167
4168// PurgeDeletedKeyPreparer prepares the PurgeDeletedKey request.
4169func (client BaseClient) PurgeDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) {
4170	urlParameters := map[string]interface{}{
4171		"vaultBaseUrl": vaultBaseURL,
4172	}
4173
4174	pathParameters := map[string]interface{}{
4175		"key-name": autorest.Encode("path", keyName),
4176	}
4177
4178	const APIVersion = "2016-10-01"
4179	queryParameters := map[string]interface{}{
4180		"api-version": APIVersion,
4181	}
4182
4183	preparer := autorest.CreatePreparer(
4184		autorest.AsDelete(),
4185		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4186		autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters),
4187		autorest.WithQueryParameters(queryParameters))
4188	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4189}
4190
4191// PurgeDeletedKeySender sends the PurgeDeletedKey request. The method will close the
4192// http.Response Body if it receives an error.
4193func (client BaseClient) PurgeDeletedKeySender(req *http.Request) (*http.Response, error) {
4194	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4195}
4196
4197// PurgeDeletedKeyResponder handles the response to the PurgeDeletedKey request. The method always
4198// closes the http.Response Body.
4199func (client BaseClient) PurgeDeletedKeyResponder(resp *http.Response) (result autorest.Response, err error) {
4200	err = autorest.Respond(
4201		resp,
4202		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
4203		autorest.ByClosing())
4204	result.Response = resp
4205	return
4206}
4207
4208// PurgeDeletedSecret the purge deleted secret operation removes the secret permanently, without the possibility of
4209// recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the
4210// secrets/purge permission.
4211// Parameters:
4212// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4213// secretName - the name of the secret.
4214func (client BaseClient) PurgeDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result autorest.Response, err error) {
4215	if tracing.IsEnabled() {
4216		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedSecret")
4217		defer func() {
4218			sc := -1
4219			if result.Response != nil {
4220				sc = result.Response.StatusCode
4221			}
4222			tracing.EndSpan(ctx, sc, err)
4223		}()
4224	}
4225	req, err := client.PurgeDeletedSecretPreparer(ctx, vaultBaseURL, secretName)
4226	if err != nil {
4227		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", nil, "Failure preparing request")
4228		return
4229	}
4230
4231	resp, err := client.PurgeDeletedSecretSender(req)
4232	if err != nil {
4233		result.Response = resp
4234		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure sending request")
4235		return
4236	}
4237
4238	result, err = client.PurgeDeletedSecretResponder(resp)
4239	if err != nil {
4240		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure responding to request")
4241		return
4242	}
4243
4244	return
4245}
4246
4247// PurgeDeletedSecretPreparer prepares the PurgeDeletedSecret request.
4248func (client BaseClient) PurgeDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) {
4249	urlParameters := map[string]interface{}{
4250		"vaultBaseUrl": vaultBaseURL,
4251	}
4252
4253	pathParameters := map[string]interface{}{
4254		"secret-name": autorest.Encode("path", secretName),
4255	}
4256
4257	const APIVersion = "2016-10-01"
4258	queryParameters := map[string]interface{}{
4259		"api-version": APIVersion,
4260	}
4261
4262	preparer := autorest.CreatePreparer(
4263		autorest.AsDelete(),
4264		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4265		autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters),
4266		autorest.WithQueryParameters(queryParameters))
4267	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4268}
4269
4270// PurgeDeletedSecretSender sends the PurgeDeletedSecret request. The method will close the
4271// http.Response Body if it receives an error.
4272func (client BaseClient) PurgeDeletedSecretSender(req *http.Request) (*http.Response, error) {
4273	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4274}
4275
4276// PurgeDeletedSecretResponder handles the response to the PurgeDeletedSecret request. The method always
4277// closes the http.Response Body.
4278func (client BaseClient) PurgeDeletedSecretResponder(resp *http.Response) (result autorest.Response, err error) {
4279	err = autorest.Respond(
4280		resp,
4281		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
4282		autorest.ByClosing())
4283	result.Response = resp
4284	return
4285}
4286
4287// RecoverDeletedCertificate the RecoverDeletedCertificate operation performs the reversal of the Delete operation. The
4288// operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval
4289// (available in the deleted certificate's attributes). This operation requires the certificates/recover permission.
4290// Parameters:
4291// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4292// certificateName - the name of the deleted certificate
4293func (client BaseClient) RecoverDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateBundle, err error) {
4294	if tracing.IsEnabled() {
4295		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedCertificate")
4296		defer func() {
4297			sc := -1
4298			if result.Response.Response != nil {
4299				sc = result.Response.Response.StatusCode
4300			}
4301			tracing.EndSpan(ctx, sc, err)
4302		}()
4303	}
4304	req, err := client.RecoverDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName)
4305	if err != nil {
4306		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", nil, "Failure preparing request")
4307		return
4308	}
4309
4310	resp, err := client.RecoverDeletedCertificateSender(req)
4311	if err != nil {
4312		result.Response = autorest.Response{Response: resp}
4313		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure sending request")
4314		return
4315	}
4316
4317	result, err = client.RecoverDeletedCertificateResponder(resp)
4318	if err != nil {
4319		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure responding to request")
4320		return
4321	}
4322
4323	return
4324}
4325
4326// RecoverDeletedCertificatePreparer prepares the RecoverDeletedCertificate request.
4327func (client BaseClient) RecoverDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) {
4328	urlParameters := map[string]interface{}{
4329		"vaultBaseUrl": vaultBaseURL,
4330	}
4331
4332	pathParameters := map[string]interface{}{
4333		"certificate-name": autorest.Encode("path", certificateName),
4334	}
4335
4336	const APIVersion = "2016-10-01"
4337	queryParameters := map[string]interface{}{
4338		"api-version": APIVersion,
4339	}
4340
4341	preparer := autorest.CreatePreparer(
4342		autorest.AsPost(),
4343		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4344		autorest.WithPathParameters("/deletedcertificates/{certificate-name}/recover", pathParameters),
4345		autorest.WithQueryParameters(queryParameters))
4346	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4347}
4348
4349// RecoverDeletedCertificateSender sends the RecoverDeletedCertificate request. The method will close the
4350// http.Response Body if it receives an error.
4351func (client BaseClient) RecoverDeletedCertificateSender(req *http.Request) (*http.Response, error) {
4352	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4353}
4354
4355// RecoverDeletedCertificateResponder handles the response to the RecoverDeletedCertificate request. The method always
4356// closes the http.Response Body.
4357func (client BaseClient) RecoverDeletedCertificateResponder(resp *http.Response) (result CertificateBundle, err error) {
4358	err = autorest.Respond(
4359		resp,
4360		azure.WithErrorUnlessStatusCode(http.StatusOK),
4361		autorest.ByUnmarshallingJSON(&result),
4362		autorest.ByClosing())
4363	result.Response = autorest.Response{Response: resp}
4364	return
4365}
4366
4367// RecoverDeletedKey the Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It
4368// recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will
4369// return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation
4370// requires the keys/recover permission.
4371// Parameters:
4372// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4373// keyName - the name of the deleted key.
4374func (client BaseClient) RecoverDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result KeyBundle, err error) {
4375	if tracing.IsEnabled() {
4376		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedKey")
4377		defer func() {
4378			sc := -1
4379			if result.Response.Response != nil {
4380				sc = result.Response.Response.StatusCode
4381			}
4382			tracing.EndSpan(ctx, sc, err)
4383		}()
4384	}
4385	req, err := client.RecoverDeletedKeyPreparer(ctx, vaultBaseURL, keyName)
4386	if err != nil {
4387		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", nil, "Failure preparing request")
4388		return
4389	}
4390
4391	resp, err := client.RecoverDeletedKeySender(req)
4392	if err != nil {
4393		result.Response = autorest.Response{Response: resp}
4394		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure sending request")
4395		return
4396	}
4397
4398	result, err = client.RecoverDeletedKeyResponder(resp)
4399	if err != nil {
4400		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure responding to request")
4401		return
4402	}
4403
4404	return
4405}
4406
4407// RecoverDeletedKeyPreparer prepares the RecoverDeletedKey request.
4408func (client BaseClient) RecoverDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) {
4409	urlParameters := map[string]interface{}{
4410		"vaultBaseUrl": vaultBaseURL,
4411	}
4412
4413	pathParameters := map[string]interface{}{
4414		"key-name": autorest.Encode("path", keyName),
4415	}
4416
4417	const APIVersion = "2016-10-01"
4418	queryParameters := map[string]interface{}{
4419		"api-version": APIVersion,
4420	}
4421
4422	preparer := autorest.CreatePreparer(
4423		autorest.AsPost(),
4424		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4425		autorest.WithPathParameters("/deletedkeys/{key-name}/recover", pathParameters),
4426		autorest.WithQueryParameters(queryParameters))
4427	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4428}
4429
4430// RecoverDeletedKeySender sends the RecoverDeletedKey request. The method will close the
4431// http.Response Body if it receives an error.
4432func (client BaseClient) RecoverDeletedKeySender(req *http.Request) (*http.Response, error) {
4433	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4434}
4435
4436// RecoverDeletedKeyResponder handles the response to the RecoverDeletedKey request. The method always
4437// closes the http.Response Body.
4438func (client BaseClient) RecoverDeletedKeyResponder(resp *http.Response) (result KeyBundle, err error) {
4439	err = autorest.Respond(
4440		resp,
4441		azure.WithErrorUnlessStatusCode(http.StatusOK),
4442		autorest.ByUnmarshallingJSON(&result),
4443		autorest.ByClosing())
4444	result.Response = autorest.Response{Response: resp}
4445	return
4446}
4447
4448// RecoverDeletedSecret recovers the deleted secret in the specified vault. This operation can only be performed on a
4449// soft-delete enabled vault. This operation requires the secrets/recover permission.
4450// Parameters:
4451// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4452// secretName - the name of the deleted secret.
4453func (client BaseClient) RecoverDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result SecretBundle, err error) {
4454	if tracing.IsEnabled() {
4455		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedSecret")
4456		defer func() {
4457			sc := -1
4458			if result.Response.Response != nil {
4459				sc = result.Response.Response.StatusCode
4460			}
4461			tracing.EndSpan(ctx, sc, err)
4462		}()
4463	}
4464	req, err := client.RecoverDeletedSecretPreparer(ctx, vaultBaseURL, secretName)
4465	if err != nil {
4466		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", nil, "Failure preparing request")
4467		return
4468	}
4469
4470	resp, err := client.RecoverDeletedSecretSender(req)
4471	if err != nil {
4472		result.Response = autorest.Response{Response: resp}
4473		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure sending request")
4474		return
4475	}
4476
4477	result, err = client.RecoverDeletedSecretResponder(resp)
4478	if err != nil {
4479		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure responding to request")
4480		return
4481	}
4482
4483	return
4484}
4485
4486// RecoverDeletedSecretPreparer prepares the RecoverDeletedSecret request.
4487func (client BaseClient) RecoverDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) {
4488	urlParameters := map[string]interface{}{
4489		"vaultBaseUrl": vaultBaseURL,
4490	}
4491
4492	pathParameters := map[string]interface{}{
4493		"secret-name": autorest.Encode("path", secretName),
4494	}
4495
4496	const APIVersion = "2016-10-01"
4497	queryParameters := map[string]interface{}{
4498		"api-version": APIVersion,
4499	}
4500
4501	preparer := autorest.CreatePreparer(
4502		autorest.AsPost(),
4503		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4504		autorest.WithPathParameters("/deletedsecrets/{secret-name}/recover", pathParameters),
4505		autorest.WithQueryParameters(queryParameters))
4506	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4507}
4508
4509// RecoverDeletedSecretSender sends the RecoverDeletedSecret request. The method will close the
4510// http.Response Body if it receives an error.
4511func (client BaseClient) RecoverDeletedSecretSender(req *http.Request) (*http.Response, error) {
4512	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4513}
4514
4515// RecoverDeletedSecretResponder handles the response to the RecoverDeletedSecret request. The method always
4516// closes the http.Response Body.
4517func (client BaseClient) RecoverDeletedSecretResponder(resp *http.Response) (result SecretBundle, err error) {
4518	err = autorest.Respond(
4519		resp,
4520		azure.WithErrorUnlessStatusCode(http.StatusOK),
4521		autorest.ByUnmarshallingJSON(&result),
4522		autorest.ByClosing())
4523	result.Response = autorest.Response{Response: resp}
4524	return
4525}
4526
4527// RegenerateStorageAccountKey regenerates the specified key value for the given storage account. This operation
4528// requires the storage/regeneratekey permission.
4529// Parameters:
4530// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4531// storageAccountName - the name of the storage account.
4532// parameters - the parameters to regenerate storage account key.
4533func (client BaseClient) RegenerateStorageAccountKey(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (result StorageBundle, err error) {
4534	if tracing.IsEnabled() {
4535		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RegenerateStorageAccountKey")
4536		defer func() {
4537			sc := -1
4538			if result.Response.Response != nil {
4539				sc = result.Response.Response.StatusCode
4540			}
4541			tracing.EndSpan(ctx, sc, err)
4542		}()
4543	}
4544	if err := validation.Validate([]validation.Validation{
4545		{TargetValue: storageAccountName,
4546			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
4547		{TargetValue: parameters,
4548			Constraints: []validation.Constraint{{Target: "parameters.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
4549		return result, validation.NewError("keyvault.BaseClient", "RegenerateStorageAccountKey", err.Error())
4550	}
4551
4552	req, err := client.RegenerateStorageAccountKeyPreparer(ctx, vaultBaseURL, storageAccountName, parameters)
4553	if err != nil {
4554		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", nil, "Failure preparing request")
4555		return
4556	}
4557
4558	resp, err := client.RegenerateStorageAccountKeySender(req)
4559	if err != nil {
4560		result.Response = autorest.Response{Response: resp}
4561		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure sending request")
4562		return
4563	}
4564
4565	result, err = client.RegenerateStorageAccountKeyResponder(resp)
4566	if err != nil {
4567		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure responding to request")
4568		return
4569	}
4570
4571	return
4572}
4573
4574// RegenerateStorageAccountKeyPreparer prepares the RegenerateStorageAccountKey request.
4575func (client BaseClient) RegenerateStorageAccountKeyPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (*http.Request, error) {
4576	urlParameters := map[string]interface{}{
4577		"vaultBaseUrl": vaultBaseURL,
4578	}
4579
4580	pathParameters := map[string]interface{}{
4581		"storage-account-name": autorest.Encode("path", storageAccountName),
4582	}
4583
4584	const APIVersion = "2016-10-01"
4585	queryParameters := map[string]interface{}{
4586		"api-version": APIVersion,
4587	}
4588
4589	preparer := autorest.CreatePreparer(
4590		autorest.AsContentType("application/json; charset=utf-8"),
4591		autorest.AsPost(),
4592		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4593		autorest.WithPathParameters("/storage/{storage-account-name}/regeneratekey", pathParameters),
4594		autorest.WithJSON(parameters),
4595		autorest.WithQueryParameters(queryParameters))
4596	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4597}
4598
4599// RegenerateStorageAccountKeySender sends the RegenerateStorageAccountKey request. The method will close the
4600// http.Response Body if it receives an error.
4601func (client BaseClient) RegenerateStorageAccountKeySender(req *http.Request) (*http.Response, error) {
4602	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4603}
4604
4605// RegenerateStorageAccountKeyResponder handles the response to the RegenerateStorageAccountKey request. The method always
4606// closes the http.Response Body.
4607func (client BaseClient) RegenerateStorageAccountKeyResponder(resp *http.Response) (result StorageBundle, err error) {
4608	err = autorest.Respond(
4609		resp,
4610		azure.WithErrorUnlessStatusCode(http.StatusOK),
4611		autorest.ByUnmarshallingJSON(&result),
4612		autorest.ByClosing())
4613	result.Response = autorest.Response{Response: resp}
4614	return
4615}
4616
4617// RestoreKey imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier,
4618// attributes and access control policies. The RESTORE operation may be used to import a previously backed up key.
4619// Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it
4620// had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be
4621// rejected. While the key name is retained during restore, the final key identifier will change if the key is restored
4622// to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is
4623// subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the
4624// source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the
4625// keys/restore permission.
4626// Parameters:
4627// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4628// parameters - the parameters to restore the key.
4629func (client BaseClient) RestoreKey(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (result KeyBundle, err error) {
4630	if tracing.IsEnabled() {
4631		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreKey")
4632		defer func() {
4633			sc := -1
4634			if result.Response.Response != nil {
4635				sc = result.Response.Response.StatusCode
4636			}
4637			tracing.EndSpan(ctx, sc, err)
4638		}()
4639	}
4640	if err := validation.Validate([]validation.Validation{
4641		{TargetValue: parameters,
4642			Constraints: []validation.Constraint{{Target: "parameters.KeyBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
4643		return result, validation.NewError("keyvault.BaseClient", "RestoreKey", err.Error())
4644	}
4645
4646	req, err := client.RestoreKeyPreparer(ctx, vaultBaseURL, parameters)
4647	if err != nil {
4648		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", nil, "Failure preparing request")
4649		return
4650	}
4651
4652	resp, err := client.RestoreKeySender(req)
4653	if err != nil {
4654		result.Response = autorest.Response{Response: resp}
4655		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure sending request")
4656		return
4657	}
4658
4659	result, err = client.RestoreKeyResponder(resp)
4660	if err != nil {
4661		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure responding to request")
4662		return
4663	}
4664
4665	return
4666}
4667
4668// RestoreKeyPreparer prepares the RestoreKey request.
4669func (client BaseClient) RestoreKeyPreparer(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (*http.Request, error) {
4670	urlParameters := map[string]interface{}{
4671		"vaultBaseUrl": vaultBaseURL,
4672	}
4673
4674	const APIVersion = "2016-10-01"
4675	queryParameters := map[string]interface{}{
4676		"api-version": APIVersion,
4677	}
4678
4679	preparer := autorest.CreatePreparer(
4680		autorest.AsContentType("application/json; charset=utf-8"),
4681		autorest.AsPost(),
4682		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4683		autorest.WithPath("/keys/restore"),
4684		autorest.WithJSON(parameters),
4685		autorest.WithQueryParameters(queryParameters))
4686	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4687}
4688
4689// RestoreKeySender sends the RestoreKey request. The method will close the
4690// http.Response Body if it receives an error.
4691func (client BaseClient) RestoreKeySender(req *http.Request) (*http.Response, error) {
4692	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4693}
4694
4695// RestoreKeyResponder handles the response to the RestoreKey request. The method always
4696// closes the http.Response Body.
4697func (client BaseClient) RestoreKeyResponder(resp *http.Response) (result KeyBundle, err error) {
4698	err = autorest.Respond(
4699		resp,
4700		azure.WithErrorUnlessStatusCode(http.StatusOK),
4701		autorest.ByUnmarshallingJSON(&result),
4702		autorest.ByClosing())
4703	result.Response = autorest.Response{Response: resp}
4704	return
4705}
4706
4707// RestoreSecret restores a backed up secret, and all its versions, to a vault. This operation requires the
4708// secrets/restore permission.
4709// Parameters:
4710// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4711// parameters - the parameters to restore the secret.
4712func (client BaseClient) RestoreSecret(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (result SecretBundle, err error) {
4713	if tracing.IsEnabled() {
4714		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreSecret")
4715		defer func() {
4716			sc := -1
4717			if result.Response.Response != nil {
4718				sc = result.Response.Response.StatusCode
4719			}
4720			tracing.EndSpan(ctx, sc, err)
4721		}()
4722	}
4723	if err := validation.Validate([]validation.Validation{
4724		{TargetValue: parameters,
4725			Constraints: []validation.Constraint{{Target: "parameters.SecretBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
4726		return result, validation.NewError("keyvault.BaseClient", "RestoreSecret", err.Error())
4727	}
4728
4729	req, err := client.RestoreSecretPreparer(ctx, vaultBaseURL, parameters)
4730	if err != nil {
4731		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", nil, "Failure preparing request")
4732		return
4733	}
4734
4735	resp, err := client.RestoreSecretSender(req)
4736	if err != nil {
4737		result.Response = autorest.Response{Response: resp}
4738		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure sending request")
4739		return
4740	}
4741
4742	result, err = client.RestoreSecretResponder(resp)
4743	if err != nil {
4744		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure responding to request")
4745		return
4746	}
4747
4748	return
4749}
4750
4751// RestoreSecretPreparer prepares the RestoreSecret request.
4752func (client BaseClient) RestoreSecretPreparer(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (*http.Request, error) {
4753	urlParameters := map[string]interface{}{
4754		"vaultBaseUrl": vaultBaseURL,
4755	}
4756
4757	const APIVersion = "2016-10-01"
4758	queryParameters := map[string]interface{}{
4759		"api-version": APIVersion,
4760	}
4761
4762	preparer := autorest.CreatePreparer(
4763		autorest.AsContentType("application/json; charset=utf-8"),
4764		autorest.AsPost(),
4765		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4766		autorest.WithPath("/secrets/restore"),
4767		autorest.WithJSON(parameters),
4768		autorest.WithQueryParameters(queryParameters))
4769	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4770}
4771
4772// RestoreSecretSender sends the RestoreSecret request. The method will close the
4773// http.Response Body if it receives an error.
4774func (client BaseClient) RestoreSecretSender(req *http.Request) (*http.Response, error) {
4775	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4776}
4777
4778// RestoreSecretResponder handles the response to the RestoreSecret request. The method always
4779// closes the http.Response Body.
4780func (client BaseClient) RestoreSecretResponder(resp *http.Response) (result SecretBundle, err error) {
4781	err = autorest.Respond(
4782		resp,
4783		azure.WithErrorUnlessStatusCode(http.StatusOK),
4784		autorest.ByUnmarshallingJSON(&result),
4785		autorest.ByClosing())
4786	result.Response = autorest.Response{Response: resp}
4787	return
4788}
4789
4790// SetCertificateContacts sets the certificate contacts for the specified key vault. This operation requires the
4791// certificates/managecontacts permission.
4792// Parameters:
4793// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4794// contacts - the contacts for the key vault certificate.
4795func (client BaseClient) SetCertificateContacts(ctx context.Context, vaultBaseURL string, contacts Contacts) (result Contacts, err error) {
4796	if tracing.IsEnabled() {
4797		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetCertificateContacts")
4798		defer func() {
4799			sc := -1
4800			if result.Response.Response != nil {
4801				sc = result.Response.Response.StatusCode
4802			}
4803			tracing.EndSpan(ctx, sc, err)
4804		}()
4805	}
4806	req, err := client.SetCertificateContactsPreparer(ctx, vaultBaseURL, contacts)
4807	if err != nil {
4808		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", nil, "Failure preparing request")
4809		return
4810	}
4811
4812	resp, err := client.SetCertificateContactsSender(req)
4813	if err != nil {
4814		result.Response = autorest.Response{Response: resp}
4815		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure sending request")
4816		return
4817	}
4818
4819	result, err = client.SetCertificateContactsResponder(resp)
4820	if err != nil {
4821		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure responding to request")
4822		return
4823	}
4824
4825	return
4826}
4827
4828// SetCertificateContactsPreparer prepares the SetCertificateContacts request.
4829func (client BaseClient) SetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string, contacts Contacts) (*http.Request, error) {
4830	urlParameters := map[string]interface{}{
4831		"vaultBaseUrl": vaultBaseURL,
4832	}
4833
4834	const APIVersion = "2016-10-01"
4835	queryParameters := map[string]interface{}{
4836		"api-version": APIVersion,
4837	}
4838
4839	contacts.ID = nil
4840	preparer := autorest.CreatePreparer(
4841		autorest.AsContentType("application/json; charset=utf-8"),
4842		autorest.AsPut(),
4843		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4844		autorest.WithPath("/certificates/contacts"),
4845		autorest.WithJSON(contacts),
4846		autorest.WithQueryParameters(queryParameters))
4847	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4848}
4849
4850// SetCertificateContactsSender sends the SetCertificateContacts request. The method will close the
4851// http.Response Body if it receives an error.
4852func (client BaseClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) {
4853	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4854}
4855
4856// SetCertificateContactsResponder handles the response to the SetCertificateContacts request. The method always
4857// closes the http.Response Body.
4858func (client BaseClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) {
4859	err = autorest.Respond(
4860		resp,
4861		azure.WithErrorUnlessStatusCode(http.StatusOK),
4862		autorest.ByUnmarshallingJSON(&result),
4863		autorest.ByClosing())
4864	result.Response = autorest.Response{Response: resp}
4865	return
4866}
4867
4868// SetCertificateIssuer the SetCertificateIssuer operation adds or updates the specified certificate issuer. This
4869// operation requires the certificates/setissuers permission.
4870// Parameters:
4871// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4872// issuerName - the name of the issuer.
4873// parameter - certificate issuer set parameter.
4874func (client BaseClient) SetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (result IssuerBundle, err error) {
4875	if tracing.IsEnabled() {
4876		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetCertificateIssuer")
4877		defer func() {
4878			sc := -1
4879			if result.Response.Response != nil {
4880				sc = result.Response.Response.StatusCode
4881			}
4882			tracing.EndSpan(ctx, sc, err)
4883		}()
4884	}
4885	if err := validation.Validate([]validation.Validation{
4886		{TargetValue: parameter,
4887			Constraints: []validation.Constraint{{Target: "parameter.Provider", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
4888		return result, validation.NewError("keyvault.BaseClient", "SetCertificateIssuer", err.Error())
4889	}
4890
4891	req, err := client.SetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter)
4892	if err != nil {
4893		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", nil, "Failure preparing request")
4894		return
4895	}
4896
4897	resp, err := client.SetCertificateIssuerSender(req)
4898	if err != nil {
4899		result.Response = autorest.Response{Response: resp}
4900		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure sending request")
4901		return
4902	}
4903
4904	result, err = client.SetCertificateIssuerResponder(resp)
4905	if err != nil {
4906		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure responding to request")
4907		return
4908	}
4909
4910	return
4911}
4912
4913// SetCertificateIssuerPreparer prepares the SetCertificateIssuer request.
4914func (client BaseClient) SetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (*http.Request, error) {
4915	urlParameters := map[string]interface{}{
4916		"vaultBaseUrl": vaultBaseURL,
4917	}
4918
4919	pathParameters := map[string]interface{}{
4920		"issuer-name": autorest.Encode("path", issuerName),
4921	}
4922
4923	const APIVersion = "2016-10-01"
4924	queryParameters := map[string]interface{}{
4925		"api-version": APIVersion,
4926	}
4927
4928	preparer := autorest.CreatePreparer(
4929		autorest.AsContentType("application/json; charset=utf-8"),
4930		autorest.AsPut(),
4931		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
4932		autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters),
4933		autorest.WithJSON(parameter),
4934		autorest.WithQueryParameters(queryParameters))
4935	return preparer.Prepare((&http.Request{}).WithContext(ctx))
4936}
4937
4938// SetCertificateIssuerSender sends the SetCertificateIssuer request. The method will close the
4939// http.Response Body if it receives an error.
4940func (client BaseClient) SetCertificateIssuerSender(req *http.Request) (*http.Response, error) {
4941	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
4942}
4943
4944// SetCertificateIssuerResponder handles the response to the SetCertificateIssuer request. The method always
4945// closes the http.Response Body.
4946func (client BaseClient) SetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) {
4947	err = autorest.Respond(
4948		resp,
4949		azure.WithErrorUnlessStatusCode(http.StatusOK),
4950		autorest.ByUnmarshallingJSON(&result),
4951		autorest.ByClosing())
4952	result.Response = autorest.Response{Response: resp}
4953	return
4954}
4955
4956// SetSasDefinition creates or updates a new SAS definition for the specified storage account. This operation requires
4957// the storage/setsas permission.
4958// Parameters:
4959// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
4960// storageAccountName - the name of the storage account.
4961// sasDefinitionName - the name of the SAS definition.
4962// parameters - the parameters to create a SAS definition.
4963func (client BaseClient) SetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (result SasDefinitionBundle, err error) {
4964	if tracing.IsEnabled() {
4965		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetSasDefinition")
4966		defer func() {
4967			sc := -1
4968			if result.Response.Response != nil {
4969				sc = result.Response.Response.StatusCode
4970			}
4971			tracing.EndSpan(ctx, sc, err)
4972		}()
4973	}
4974	if err := validation.Validate([]validation.Validation{
4975		{TargetValue: storageAccountName,
4976			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
4977		{TargetValue: sasDefinitionName,
4978			Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
4979		{TargetValue: parameters,
4980			Constraints: []validation.Constraint{{Target: "parameters.Parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
4981		return result, validation.NewError("keyvault.BaseClient", "SetSasDefinition", err.Error())
4982	}
4983
4984	req, err := client.SetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters)
4985	if err != nil {
4986		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", nil, "Failure preparing request")
4987		return
4988	}
4989
4990	resp, err := client.SetSasDefinitionSender(req)
4991	if err != nil {
4992		result.Response = autorest.Response{Response: resp}
4993		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure sending request")
4994		return
4995	}
4996
4997	result, err = client.SetSasDefinitionResponder(resp)
4998	if err != nil {
4999		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure responding to request")
5000		return
5001	}
5002
5003	return
5004}
5005
5006// SetSasDefinitionPreparer prepares the SetSasDefinition request.
5007func (client BaseClient) SetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (*http.Request, error) {
5008	urlParameters := map[string]interface{}{
5009		"vaultBaseUrl": vaultBaseURL,
5010	}
5011
5012	pathParameters := map[string]interface{}{
5013		"sas-definition-name":  autorest.Encode("path", sasDefinitionName),
5014		"storage-account-name": autorest.Encode("path", storageAccountName),
5015	}
5016
5017	const APIVersion = "2016-10-01"
5018	queryParameters := map[string]interface{}{
5019		"api-version": APIVersion,
5020	}
5021
5022	preparer := autorest.CreatePreparer(
5023		autorest.AsContentType("application/json; charset=utf-8"),
5024		autorest.AsPut(),
5025		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5026		autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters),
5027		autorest.WithJSON(parameters),
5028		autorest.WithQueryParameters(queryParameters))
5029	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5030}
5031
5032// SetSasDefinitionSender sends the SetSasDefinition request. The method will close the
5033// http.Response Body if it receives an error.
5034func (client BaseClient) SetSasDefinitionSender(req *http.Request) (*http.Response, error) {
5035	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5036}
5037
5038// SetSasDefinitionResponder handles the response to the SetSasDefinition request. The method always
5039// closes the http.Response Body.
5040func (client BaseClient) SetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) {
5041	err = autorest.Respond(
5042		resp,
5043		azure.WithErrorUnlessStatusCode(http.StatusOK),
5044		autorest.ByUnmarshallingJSON(&result),
5045		autorest.ByClosing())
5046	result.Response = autorest.Response{Response: resp}
5047	return
5048}
5049
5050// SetSecret the SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key
5051// Vault creates a new version of that secret. This operation requires the secrets/set permission.
5052// Parameters:
5053// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5054// secretName - the name of the secret.
5055// parameters - the parameters for setting the secret.
5056func (client BaseClient) SetSecret(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (result SecretBundle, err error) {
5057	if tracing.IsEnabled() {
5058		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetSecret")
5059		defer func() {
5060			sc := -1
5061			if result.Response.Response != nil {
5062				sc = result.Response.Response.StatusCode
5063			}
5064			tracing.EndSpan(ctx, sc, err)
5065		}()
5066	}
5067	if err := validation.Validate([]validation.Validation{
5068		{TargetValue: secretName,
5069			Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}},
5070		{TargetValue: parameters,
5071			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
5072		return result, validation.NewError("keyvault.BaseClient", "SetSecret", err.Error())
5073	}
5074
5075	req, err := client.SetSecretPreparer(ctx, vaultBaseURL, secretName, parameters)
5076	if err != nil {
5077		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", nil, "Failure preparing request")
5078		return
5079	}
5080
5081	resp, err := client.SetSecretSender(req)
5082	if err != nil {
5083		result.Response = autorest.Response{Response: resp}
5084		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure sending request")
5085		return
5086	}
5087
5088	result, err = client.SetSecretResponder(resp)
5089	if err != nil {
5090		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure responding to request")
5091		return
5092	}
5093
5094	return
5095}
5096
5097// SetSecretPreparer prepares the SetSecret request.
5098func (client BaseClient) SetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (*http.Request, error) {
5099	urlParameters := map[string]interface{}{
5100		"vaultBaseUrl": vaultBaseURL,
5101	}
5102
5103	pathParameters := map[string]interface{}{
5104		"secret-name": autorest.Encode("path", secretName),
5105	}
5106
5107	const APIVersion = "2016-10-01"
5108	queryParameters := map[string]interface{}{
5109		"api-version": APIVersion,
5110	}
5111
5112	preparer := autorest.CreatePreparer(
5113		autorest.AsContentType("application/json; charset=utf-8"),
5114		autorest.AsPut(),
5115		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5116		autorest.WithPathParameters("/secrets/{secret-name}", pathParameters),
5117		autorest.WithJSON(parameters),
5118		autorest.WithQueryParameters(queryParameters))
5119	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5120}
5121
5122// SetSecretSender sends the SetSecret request. The method will close the
5123// http.Response Body if it receives an error.
5124func (client BaseClient) SetSecretSender(req *http.Request) (*http.Response, error) {
5125	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5126}
5127
5128// SetSecretResponder handles the response to the SetSecret request. The method always
5129// closes the http.Response Body.
5130func (client BaseClient) SetSecretResponder(resp *http.Response) (result SecretBundle, err error) {
5131	err = autorest.Respond(
5132		resp,
5133		azure.WithErrorUnlessStatusCode(http.StatusOK),
5134		autorest.ByUnmarshallingJSON(&result),
5135		autorest.ByClosing())
5136	result.Response = autorest.Response{Response: resp}
5137	return
5138}
5139
5140// SetStorageAccount creates or updates a new storage account. This operation requires the storage/set permission.
5141// Parameters:
5142// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5143// storageAccountName - the name of the storage account.
5144// parameters - the parameters to create a storage account.
5145func (client BaseClient) SetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (result StorageBundle, err error) {
5146	if tracing.IsEnabled() {
5147		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetStorageAccount")
5148		defer func() {
5149			sc := -1
5150			if result.Response.Response != nil {
5151				sc = result.Response.Response.StatusCode
5152			}
5153			tracing.EndSpan(ctx, sc, err)
5154		}()
5155	}
5156	if err := validation.Validate([]validation.Validation{
5157		{TargetValue: storageAccountName,
5158			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
5159		{TargetValue: parameters,
5160			Constraints: []validation.Constraint{{Target: "parameters.ResourceID", Name: validation.Null, Rule: true, Chain: nil},
5161				{Target: "parameters.ActiveKeyName", Name: validation.Null, Rule: true, Chain: nil},
5162				{Target: "parameters.AutoRegenerateKey", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
5163		return result, validation.NewError("keyvault.BaseClient", "SetStorageAccount", err.Error())
5164	}
5165
5166	req, err := client.SetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters)
5167	if err != nil {
5168		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", nil, "Failure preparing request")
5169		return
5170	}
5171
5172	resp, err := client.SetStorageAccountSender(req)
5173	if err != nil {
5174		result.Response = autorest.Response{Response: resp}
5175		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure sending request")
5176		return
5177	}
5178
5179	result, err = client.SetStorageAccountResponder(resp)
5180	if err != nil {
5181		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure responding to request")
5182		return
5183	}
5184
5185	return
5186}
5187
5188// SetStorageAccountPreparer prepares the SetStorageAccount request.
5189func (client BaseClient) SetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (*http.Request, error) {
5190	urlParameters := map[string]interface{}{
5191		"vaultBaseUrl": vaultBaseURL,
5192	}
5193
5194	pathParameters := map[string]interface{}{
5195		"storage-account-name": autorest.Encode("path", storageAccountName),
5196	}
5197
5198	const APIVersion = "2016-10-01"
5199	queryParameters := map[string]interface{}{
5200		"api-version": APIVersion,
5201	}
5202
5203	preparer := autorest.CreatePreparer(
5204		autorest.AsContentType("application/json; charset=utf-8"),
5205		autorest.AsPut(),
5206		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5207		autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters),
5208		autorest.WithJSON(parameters),
5209		autorest.WithQueryParameters(queryParameters))
5210	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5211}
5212
5213// SetStorageAccountSender sends the SetStorageAccount request. The method will close the
5214// http.Response Body if it receives an error.
5215func (client BaseClient) SetStorageAccountSender(req *http.Request) (*http.Response, error) {
5216	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5217}
5218
5219// SetStorageAccountResponder handles the response to the SetStorageAccount request. The method always
5220// closes the http.Response Body.
5221func (client BaseClient) SetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) {
5222	err = autorest.Respond(
5223		resp,
5224		azure.WithErrorUnlessStatusCode(http.StatusOK),
5225		autorest.ByUnmarshallingJSON(&result),
5226		autorest.ByClosing())
5227	result.Response = autorest.Response{Response: resp}
5228	return
5229}
5230
5231// Sign the SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this
5232// operation uses the private portion of the key. This operation requires the keys/sign permission.
5233// Parameters:
5234// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5235// keyName - the name of the key.
5236// keyVersion - the version of the key.
5237// parameters - the parameters for the signing operation.
5238func (client BaseClient) Sign(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (result KeyOperationResult, err error) {
5239	if tracing.IsEnabled() {
5240		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Sign")
5241		defer func() {
5242			sc := -1
5243			if result.Response.Response != nil {
5244				sc = result.Response.Response.StatusCode
5245			}
5246			tracing.EndSpan(ctx, sc, err)
5247		}()
5248	}
5249	if err := validation.Validate([]validation.Validation{
5250		{TargetValue: parameters,
5251			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
5252		return result, validation.NewError("keyvault.BaseClient", "Sign", err.Error())
5253	}
5254
5255	req, err := client.SignPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
5256	if err != nil {
5257		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", nil, "Failure preparing request")
5258		return
5259	}
5260
5261	resp, err := client.SignSender(req)
5262	if err != nil {
5263		result.Response = autorest.Response{Response: resp}
5264		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure sending request")
5265		return
5266	}
5267
5268	result, err = client.SignResponder(resp)
5269	if err != nil {
5270		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure responding to request")
5271		return
5272	}
5273
5274	return
5275}
5276
5277// SignPreparer prepares the Sign request.
5278func (client BaseClient) SignPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (*http.Request, error) {
5279	urlParameters := map[string]interface{}{
5280		"vaultBaseUrl": vaultBaseURL,
5281	}
5282
5283	pathParameters := map[string]interface{}{
5284		"key-name":    autorest.Encode("path", keyName),
5285		"key-version": autorest.Encode("path", keyVersion),
5286	}
5287
5288	const APIVersion = "2016-10-01"
5289	queryParameters := map[string]interface{}{
5290		"api-version": APIVersion,
5291	}
5292
5293	preparer := autorest.CreatePreparer(
5294		autorest.AsContentType("application/json; charset=utf-8"),
5295		autorest.AsPost(),
5296		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5297		autorest.WithPathParameters("/keys/{key-name}/{key-version}/sign", pathParameters),
5298		autorest.WithJSON(parameters),
5299		autorest.WithQueryParameters(queryParameters))
5300	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5301}
5302
5303// SignSender sends the Sign request. The method will close the
5304// http.Response Body if it receives an error.
5305func (client BaseClient) SignSender(req *http.Request) (*http.Response, error) {
5306	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5307}
5308
5309// SignResponder handles the response to the Sign request. The method always
5310// closes the http.Response Body.
5311func (client BaseClient) SignResponder(resp *http.Response) (result KeyOperationResult, err error) {
5312	err = autorest.Respond(
5313		resp,
5314		azure.WithErrorUnlessStatusCode(http.StatusOK),
5315		autorest.ByUnmarshallingJSON(&result),
5316		autorest.ByClosing())
5317	result.Response = autorest.Response{Response: resp}
5318	return
5319}
5320
5321// UnwrapKey the UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This
5322// operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored
5323// in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey
5324// permission.
5325// Parameters:
5326// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5327// keyName - the name of the key.
5328// keyVersion - the version of the key.
5329// parameters - the parameters for the key operation.
5330func (client BaseClient) UnwrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) {
5331	if tracing.IsEnabled() {
5332		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UnwrapKey")
5333		defer func() {
5334			sc := -1
5335			if result.Response.Response != nil {
5336				sc = result.Response.Response.StatusCode
5337			}
5338			tracing.EndSpan(ctx, sc, err)
5339		}()
5340	}
5341	if err := validation.Validate([]validation.Validation{
5342		{TargetValue: parameters,
5343			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
5344		return result, validation.NewError("keyvault.BaseClient", "UnwrapKey", err.Error())
5345	}
5346
5347	req, err := client.UnwrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
5348	if err != nil {
5349		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", nil, "Failure preparing request")
5350		return
5351	}
5352
5353	resp, err := client.UnwrapKeySender(req)
5354	if err != nil {
5355		result.Response = autorest.Response{Response: resp}
5356		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure sending request")
5357		return
5358	}
5359
5360	result, err = client.UnwrapKeyResponder(resp)
5361	if err != nil {
5362		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure responding to request")
5363		return
5364	}
5365
5366	return
5367}
5368
5369// UnwrapKeyPreparer prepares the UnwrapKey request.
5370func (client BaseClient) UnwrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) {
5371	urlParameters := map[string]interface{}{
5372		"vaultBaseUrl": vaultBaseURL,
5373	}
5374
5375	pathParameters := map[string]interface{}{
5376		"key-name":    autorest.Encode("path", keyName),
5377		"key-version": autorest.Encode("path", keyVersion),
5378	}
5379
5380	const APIVersion = "2016-10-01"
5381	queryParameters := map[string]interface{}{
5382		"api-version": APIVersion,
5383	}
5384
5385	preparer := autorest.CreatePreparer(
5386		autorest.AsContentType("application/json; charset=utf-8"),
5387		autorest.AsPost(),
5388		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5389		autorest.WithPathParameters("/keys/{key-name}/{key-version}/unwrapkey", pathParameters),
5390		autorest.WithJSON(parameters),
5391		autorest.WithQueryParameters(queryParameters))
5392	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5393}
5394
5395// UnwrapKeySender sends the UnwrapKey request. The method will close the
5396// http.Response Body if it receives an error.
5397func (client BaseClient) UnwrapKeySender(req *http.Request) (*http.Response, error) {
5398	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5399}
5400
5401// UnwrapKeyResponder handles the response to the UnwrapKey request. The method always
5402// closes the http.Response Body.
5403func (client BaseClient) UnwrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) {
5404	err = autorest.Respond(
5405		resp,
5406		azure.WithErrorUnlessStatusCode(http.StatusOK),
5407		autorest.ByUnmarshallingJSON(&result),
5408		autorest.ByClosing())
5409	result.Response = autorest.Response{Response: resp}
5410	return
5411}
5412
5413// UpdateCertificate the UpdateCertificate operation applies the specified update on the given certificate; the only
5414// elements updated are the certificate's attributes. This operation requires the certificates/update permission.
5415// Parameters:
5416// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5417// certificateName - the name of the certificate in the given key vault.
5418// certificateVersion - the version of the certificate.
5419// parameters - the parameters for certificate update.
5420func (client BaseClient) UpdateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (result CertificateBundle, err error) {
5421	if tracing.IsEnabled() {
5422		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificate")
5423		defer func() {
5424			sc := -1
5425			if result.Response.Response != nil {
5426				sc = result.Response.Response.StatusCode
5427			}
5428			tracing.EndSpan(ctx, sc, err)
5429		}()
5430	}
5431	req, err := client.UpdateCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion, parameters)
5432	if err != nil {
5433		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", nil, "Failure preparing request")
5434		return
5435	}
5436
5437	resp, err := client.UpdateCertificateSender(req)
5438	if err != nil {
5439		result.Response = autorest.Response{Response: resp}
5440		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure sending request")
5441		return
5442	}
5443
5444	result, err = client.UpdateCertificateResponder(resp)
5445	if err != nil {
5446		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure responding to request")
5447		return
5448	}
5449
5450	return
5451}
5452
5453// UpdateCertificatePreparer prepares the UpdateCertificate request.
5454func (client BaseClient) UpdateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (*http.Request, error) {
5455	urlParameters := map[string]interface{}{
5456		"vaultBaseUrl": vaultBaseURL,
5457	}
5458
5459	pathParameters := map[string]interface{}{
5460		"certificate-name":    autorest.Encode("path", certificateName),
5461		"certificate-version": autorest.Encode("path", certificateVersion),
5462	}
5463
5464	const APIVersion = "2016-10-01"
5465	queryParameters := map[string]interface{}{
5466		"api-version": APIVersion,
5467	}
5468
5469	preparer := autorest.CreatePreparer(
5470		autorest.AsContentType("application/json; charset=utf-8"),
5471		autorest.AsPatch(),
5472		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5473		autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters),
5474		autorest.WithJSON(parameters),
5475		autorest.WithQueryParameters(queryParameters))
5476	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5477}
5478
5479// UpdateCertificateSender sends the UpdateCertificate request. The method will close the
5480// http.Response Body if it receives an error.
5481func (client BaseClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) {
5482	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5483}
5484
5485// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always
5486// closes the http.Response Body.
5487func (client BaseClient) UpdateCertificateResponder(resp *http.Response) (result CertificateBundle, err error) {
5488	err = autorest.Respond(
5489		resp,
5490		azure.WithErrorUnlessStatusCode(http.StatusOK),
5491		autorest.ByUnmarshallingJSON(&result),
5492		autorest.ByClosing())
5493	result.Response = autorest.Response{Response: resp}
5494	return
5495}
5496
5497// UpdateCertificateIssuer the UpdateCertificateIssuer operation performs an update on the specified certificate issuer
5498// entity. This operation requires the certificates/setissuers permission.
5499// Parameters:
5500// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5501// issuerName - the name of the issuer.
5502// parameter - certificate issuer update parameter.
5503func (client BaseClient) UpdateCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (result IssuerBundle, err error) {
5504	if tracing.IsEnabled() {
5505		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificateIssuer")
5506		defer func() {
5507			sc := -1
5508			if result.Response.Response != nil {
5509				sc = result.Response.Response.StatusCode
5510			}
5511			tracing.EndSpan(ctx, sc, err)
5512		}()
5513	}
5514	req, err := client.UpdateCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter)
5515	if err != nil {
5516		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", nil, "Failure preparing request")
5517		return
5518	}
5519
5520	resp, err := client.UpdateCertificateIssuerSender(req)
5521	if err != nil {
5522		result.Response = autorest.Response{Response: resp}
5523		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure sending request")
5524		return
5525	}
5526
5527	result, err = client.UpdateCertificateIssuerResponder(resp)
5528	if err != nil {
5529		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure responding to request")
5530		return
5531	}
5532
5533	return
5534}
5535
5536// UpdateCertificateIssuerPreparer prepares the UpdateCertificateIssuer request.
5537func (client BaseClient) UpdateCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (*http.Request, error) {
5538	urlParameters := map[string]interface{}{
5539		"vaultBaseUrl": vaultBaseURL,
5540	}
5541
5542	pathParameters := map[string]interface{}{
5543		"issuer-name": autorest.Encode("path", issuerName),
5544	}
5545
5546	const APIVersion = "2016-10-01"
5547	queryParameters := map[string]interface{}{
5548		"api-version": APIVersion,
5549	}
5550
5551	preparer := autorest.CreatePreparer(
5552		autorest.AsContentType("application/json; charset=utf-8"),
5553		autorest.AsPatch(),
5554		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5555		autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters),
5556		autorest.WithJSON(parameter),
5557		autorest.WithQueryParameters(queryParameters))
5558	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5559}
5560
5561// UpdateCertificateIssuerSender sends the UpdateCertificateIssuer request. The method will close the
5562// http.Response Body if it receives an error.
5563func (client BaseClient) UpdateCertificateIssuerSender(req *http.Request) (*http.Response, error) {
5564	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5565}
5566
5567// UpdateCertificateIssuerResponder handles the response to the UpdateCertificateIssuer request. The method always
5568// closes the http.Response Body.
5569func (client BaseClient) UpdateCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) {
5570	err = autorest.Respond(
5571		resp,
5572		azure.WithErrorUnlessStatusCode(http.StatusOK),
5573		autorest.ByUnmarshallingJSON(&result),
5574		autorest.ByClosing())
5575	result.Response = autorest.Response{Response: resp}
5576	return
5577}
5578
5579// UpdateCertificateOperation updates a certificate creation operation that is already in progress. This operation
5580// requires the certificates/update permission.
5581// Parameters:
5582// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5583// certificateName - the name of the certificate.
5584// certificateOperation - the certificate operation response.
5585func (client BaseClient) UpdateCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (result CertificateOperation, err error) {
5586	if tracing.IsEnabled() {
5587		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificateOperation")
5588		defer func() {
5589			sc := -1
5590			if result.Response.Response != nil {
5591				sc = result.Response.Response.StatusCode
5592			}
5593			tracing.EndSpan(ctx, sc, err)
5594		}()
5595	}
5596	req, err := client.UpdateCertificateOperationPreparer(ctx, vaultBaseURL, certificateName, certificateOperation)
5597	if err != nil {
5598		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", nil, "Failure preparing request")
5599		return
5600	}
5601
5602	resp, err := client.UpdateCertificateOperationSender(req)
5603	if err != nil {
5604		result.Response = autorest.Response{Response: resp}
5605		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure sending request")
5606		return
5607	}
5608
5609	result, err = client.UpdateCertificateOperationResponder(resp)
5610	if err != nil {
5611		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure responding to request")
5612		return
5613	}
5614
5615	return
5616}
5617
5618// UpdateCertificateOperationPreparer prepares the UpdateCertificateOperation request.
5619func (client BaseClient) UpdateCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (*http.Request, error) {
5620	urlParameters := map[string]interface{}{
5621		"vaultBaseUrl": vaultBaseURL,
5622	}
5623
5624	pathParameters := map[string]interface{}{
5625		"certificate-name": autorest.Encode("path", certificateName),
5626	}
5627
5628	const APIVersion = "2016-10-01"
5629	queryParameters := map[string]interface{}{
5630		"api-version": APIVersion,
5631	}
5632
5633	preparer := autorest.CreatePreparer(
5634		autorest.AsContentType("application/json; charset=utf-8"),
5635		autorest.AsPatch(),
5636		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5637		autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters),
5638		autorest.WithJSON(certificateOperation),
5639		autorest.WithQueryParameters(queryParameters))
5640	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5641}
5642
5643// UpdateCertificateOperationSender sends the UpdateCertificateOperation request. The method will close the
5644// http.Response Body if it receives an error.
5645func (client BaseClient) UpdateCertificateOperationSender(req *http.Request) (*http.Response, error) {
5646	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5647}
5648
5649// UpdateCertificateOperationResponder handles the response to the UpdateCertificateOperation request. The method always
5650// closes the http.Response Body.
5651func (client BaseClient) UpdateCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) {
5652	err = autorest.Respond(
5653		resp,
5654		azure.WithErrorUnlessStatusCode(http.StatusOK),
5655		autorest.ByUnmarshallingJSON(&result),
5656		autorest.ByClosing())
5657	result.Response = autorest.Response{Response: resp}
5658	return
5659}
5660
5661// UpdateCertificatePolicy set specified members in the certificate policy. Leave others as null. This operation
5662// requires the certificates/update permission.
5663// Parameters:
5664// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5665// certificateName - the name of the certificate in the given vault.
5666// certificatePolicy - the policy for the certificate.
5667func (client BaseClient) UpdateCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (result CertificatePolicy, err error) {
5668	if tracing.IsEnabled() {
5669		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificatePolicy")
5670		defer func() {
5671			sc := -1
5672			if result.Response.Response != nil {
5673				sc = result.Response.Response.StatusCode
5674			}
5675			tracing.EndSpan(ctx, sc, err)
5676		}()
5677	}
5678	req, err := client.UpdateCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName, certificatePolicy)
5679	if err != nil {
5680		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", nil, "Failure preparing request")
5681		return
5682	}
5683
5684	resp, err := client.UpdateCertificatePolicySender(req)
5685	if err != nil {
5686		result.Response = autorest.Response{Response: resp}
5687		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure sending request")
5688		return
5689	}
5690
5691	result, err = client.UpdateCertificatePolicyResponder(resp)
5692	if err != nil {
5693		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure responding to request")
5694		return
5695	}
5696
5697	return
5698}
5699
5700// UpdateCertificatePolicyPreparer prepares the UpdateCertificatePolicy request.
5701func (client BaseClient) UpdateCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (*http.Request, error) {
5702	urlParameters := map[string]interface{}{
5703		"vaultBaseUrl": vaultBaseURL,
5704	}
5705
5706	pathParameters := map[string]interface{}{
5707		"certificate-name": autorest.Encode("path", certificateName),
5708	}
5709
5710	const APIVersion = "2016-10-01"
5711	queryParameters := map[string]interface{}{
5712		"api-version": APIVersion,
5713	}
5714
5715	certificatePolicy.ID = nil
5716	preparer := autorest.CreatePreparer(
5717		autorest.AsContentType("application/json; charset=utf-8"),
5718		autorest.AsPatch(),
5719		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5720		autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters),
5721		autorest.WithJSON(certificatePolicy),
5722		autorest.WithQueryParameters(queryParameters))
5723	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5724}
5725
5726// UpdateCertificatePolicySender sends the UpdateCertificatePolicy request. The method will close the
5727// http.Response Body if it receives an error.
5728func (client BaseClient) UpdateCertificatePolicySender(req *http.Request) (*http.Response, error) {
5729	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5730}
5731
5732// UpdateCertificatePolicyResponder handles the response to the UpdateCertificatePolicy request. The method always
5733// closes the http.Response Body.
5734func (client BaseClient) UpdateCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) {
5735	err = autorest.Respond(
5736		resp,
5737		azure.WithErrorUnlessStatusCode(http.StatusOK),
5738		autorest.ByUnmarshallingJSON(&result),
5739		autorest.ByClosing())
5740	result.Response = autorest.Response{Response: resp}
5741	return
5742}
5743
5744// UpdateKey in order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic
5745// material of a key itself cannot be changed. This operation requires the keys/update permission.
5746// Parameters:
5747// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5748// keyName - the name of key to update.
5749// keyVersion - the version of the key to update.
5750// parameters - the parameters of the key to update.
5751func (client BaseClient) UpdateKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (result KeyBundle, err error) {
5752	if tracing.IsEnabled() {
5753		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateKey")
5754		defer func() {
5755			sc := -1
5756			if result.Response.Response != nil {
5757				sc = result.Response.Response.StatusCode
5758			}
5759			tracing.EndSpan(ctx, sc, err)
5760		}()
5761	}
5762	req, err := client.UpdateKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
5763	if err != nil {
5764		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", nil, "Failure preparing request")
5765		return
5766	}
5767
5768	resp, err := client.UpdateKeySender(req)
5769	if err != nil {
5770		result.Response = autorest.Response{Response: resp}
5771		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure sending request")
5772		return
5773	}
5774
5775	result, err = client.UpdateKeyResponder(resp)
5776	if err != nil {
5777		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure responding to request")
5778		return
5779	}
5780
5781	return
5782}
5783
5784// UpdateKeyPreparer prepares the UpdateKey request.
5785func (client BaseClient) UpdateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (*http.Request, error) {
5786	urlParameters := map[string]interface{}{
5787		"vaultBaseUrl": vaultBaseURL,
5788	}
5789
5790	pathParameters := map[string]interface{}{
5791		"key-name":    autorest.Encode("path", keyName),
5792		"key-version": autorest.Encode("path", keyVersion),
5793	}
5794
5795	const APIVersion = "2016-10-01"
5796	queryParameters := map[string]interface{}{
5797		"api-version": APIVersion,
5798	}
5799
5800	preparer := autorest.CreatePreparer(
5801		autorest.AsContentType("application/json; charset=utf-8"),
5802		autorest.AsPatch(),
5803		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5804		autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters),
5805		autorest.WithJSON(parameters),
5806		autorest.WithQueryParameters(queryParameters))
5807	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5808}
5809
5810// UpdateKeySender sends the UpdateKey request. The method will close the
5811// http.Response Body if it receives an error.
5812func (client BaseClient) UpdateKeySender(req *http.Request) (*http.Response, error) {
5813	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5814}
5815
5816// UpdateKeyResponder handles the response to the UpdateKey request. The method always
5817// closes the http.Response Body.
5818func (client BaseClient) UpdateKeyResponder(resp *http.Response) (result KeyBundle, err error) {
5819	err = autorest.Respond(
5820		resp,
5821		azure.WithErrorUnlessStatusCode(http.StatusOK),
5822		autorest.ByUnmarshallingJSON(&result),
5823		autorest.ByClosing())
5824	result.Response = autorest.Response{Response: resp}
5825	return
5826}
5827
5828// UpdateSasDefinition updates the specified attributes associated with the given SAS definition. This operation
5829// requires the storage/setsas permission.
5830// Parameters:
5831// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5832// storageAccountName - the name of the storage account.
5833// sasDefinitionName - the name of the SAS definition.
5834// parameters - the parameters to update a SAS definition.
5835func (client BaseClient) UpdateSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (result SasDefinitionBundle, err error) {
5836	if tracing.IsEnabled() {
5837		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateSasDefinition")
5838		defer func() {
5839			sc := -1
5840			if result.Response.Response != nil {
5841				sc = result.Response.Response.StatusCode
5842			}
5843			tracing.EndSpan(ctx, sc, err)
5844		}()
5845	}
5846	if err := validation.Validate([]validation.Validation{
5847		{TargetValue: storageAccountName,
5848			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}},
5849		{TargetValue: sasDefinitionName,
5850			Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
5851		return result, validation.NewError("keyvault.BaseClient", "UpdateSasDefinition", err.Error())
5852	}
5853
5854	req, err := client.UpdateSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters)
5855	if err != nil {
5856		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", nil, "Failure preparing request")
5857		return
5858	}
5859
5860	resp, err := client.UpdateSasDefinitionSender(req)
5861	if err != nil {
5862		result.Response = autorest.Response{Response: resp}
5863		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure sending request")
5864		return
5865	}
5866
5867	result, err = client.UpdateSasDefinitionResponder(resp)
5868	if err != nil {
5869		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure responding to request")
5870		return
5871	}
5872
5873	return
5874}
5875
5876// UpdateSasDefinitionPreparer prepares the UpdateSasDefinition request.
5877func (client BaseClient) UpdateSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (*http.Request, error) {
5878	urlParameters := map[string]interface{}{
5879		"vaultBaseUrl": vaultBaseURL,
5880	}
5881
5882	pathParameters := map[string]interface{}{
5883		"sas-definition-name":  autorest.Encode("path", sasDefinitionName),
5884		"storage-account-name": autorest.Encode("path", storageAccountName),
5885	}
5886
5887	const APIVersion = "2016-10-01"
5888	queryParameters := map[string]interface{}{
5889		"api-version": APIVersion,
5890	}
5891
5892	preparer := autorest.CreatePreparer(
5893		autorest.AsContentType("application/json; charset=utf-8"),
5894		autorest.AsPatch(),
5895		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5896		autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters),
5897		autorest.WithJSON(parameters),
5898		autorest.WithQueryParameters(queryParameters))
5899	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5900}
5901
5902// UpdateSasDefinitionSender sends the UpdateSasDefinition request. The method will close the
5903// http.Response Body if it receives an error.
5904func (client BaseClient) UpdateSasDefinitionSender(req *http.Request) (*http.Response, error) {
5905	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5906}
5907
5908// UpdateSasDefinitionResponder handles the response to the UpdateSasDefinition request. The method always
5909// closes the http.Response Body.
5910func (client BaseClient) UpdateSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) {
5911	err = autorest.Respond(
5912		resp,
5913		azure.WithErrorUnlessStatusCode(http.StatusOK),
5914		autorest.ByUnmarshallingJSON(&result),
5915		autorest.ByClosing())
5916	result.Response = autorest.Response{Response: resp}
5917	return
5918}
5919
5920// UpdateSecret the UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not
5921// specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires
5922// the secrets/set permission.
5923// Parameters:
5924// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
5925// secretName - the name of the secret.
5926// secretVersion - the version of the secret.
5927// parameters - the parameters for update secret operation.
5928func (client BaseClient) UpdateSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (result SecretBundle, err error) {
5929	if tracing.IsEnabled() {
5930		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateSecret")
5931		defer func() {
5932			sc := -1
5933			if result.Response.Response != nil {
5934				sc = result.Response.Response.StatusCode
5935			}
5936			tracing.EndSpan(ctx, sc, err)
5937		}()
5938	}
5939	req, err := client.UpdateSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion, parameters)
5940	if err != nil {
5941		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", nil, "Failure preparing request")
5942		return
5943	}
5944
5945	resp, err := client.UpdateSecretSender(req)
5946	if err != nil {
5947		result.Response = autorest.Response{Response: resp}
5948		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure sending request")
5949		return
5950	}
5951
5952	result, err = client.UpdateSecretResponder(resp)
5953	if err != nil {
5954		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure responding to request")
5955		return
5956	}
5957
5958	return
5959}
5960
5961// UpdateSecretPreparer prepares the UpdateSecret request.
5962func (client BaseClient) UpdateSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (*http.Request, error) {
5963	urlParameters := map[string]interface{}{
5964		"vaultBaseUrl": vaultBaseURL,
5965	}
5966
5967	pathParameters := map[string]interface{}{
5968		"secret-name":    autorest.Encode("path", secretName),
5969		"secret-version": autorest.Encode("path", secretVersion),
5970	}
5971
5972	const APIVersion = "2016-10-01"
5973	queryParameters := map[string]interface{}{
5974		"api-version": APIVersion,
5975	}
5976
5977	preparer := autorest.CreatePreparer(
5978		autorest.AsContentType("application/json; charset=utf-8"),
5979		autorest.AsPatch(),
5980		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
5981		autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters),
5982		autorest.WithJSON(parameters),
5983		autorest.WithQueryParameters(queryParameters))
5984	return preparer.Prepare((&http.Request{}).WithContext(ctx))
5985}
5986
5987// UpdateSecretSender sends the UpdateSecret request. The method will close the
5988// http.Response Body if it receives an error.
5989func (client BaseClient) UpdateSecretSender(req *http.Request) (*http.Response, error) {
5990	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
5991}
5992
5993// UpdateSecretResponder handles the response to the UpdateSecret request. The method always
5994// closes the http.Response Body.
5995func (client BaseClient) UpdateSecretResponder(resp *http.Response) (result SecretBundle, err error) {
5996	err = autorest.Respond(
5997		resp,
5998		azure.WithErrorUnlessStatusCode(http.StatusOK),
5999		autorest.ByUnmarshallingJSON(&result),
6000		autorest.ByClosing())
6001	result.Response = autorest.Response{Response: resp}
6002	return
6003}
6004
6005// UpdateStorageAccount updates the specified attributes associated with the given storage account. This operation
6006// requires the storage/set/update permission.
6007// Parameters:
6008// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
6009// storageAccountName - the name of the storage account.
6010// parameters - the parameters to update a storage account.
6011func (client BaseClient) UpdateStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (result StorageBundle, err error) {
6012	if tracing.IsEnabled() {
6013		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateStorageAccount")
6014		defer func() {
6015			sc := -1
6016			if result.Response.Response != nil {
6017				sc = result.Response.Response.StatusCode
6018			}
6019			tracing.EndSpan(ctx, sc, err)
6020		}()
6021	}
6022	if err := validation.Validate([]validation.Validation{
6023		{TargetValue: storageAccountName,
6024			Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil {
6025		return result, validation.NewError("keyvault.BaseClient", "UpdateStorageAccount", err.Error())
6026	}
6027
6028	req, err := client.UpdateStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters)
6029	if err != nil {
6030		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", nil, "Failure preparing request")
6031		return
6032	}
6033
6034	resp, err := client.UpdateStorageAccountSender(req)
6035	if err != nil {
6036		result.Response = autorest.Response{Response: resp}
6037		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure sending request")
6038		return
6039	}
6040
6041	result, err = client.UpdateStorageAccountResponder(resp)
6042	if err != nil {
6043		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure responding to request")
6044		return
6045	}
6046
6047	return
6048}
6049
6050// UpdateStorageAccountPreparer prepares the UpdateStorageAccount request.
6051func (client BaseClient) UpdateStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (*http.Request, error) {
6052	urlParameters := map[string]interface{}{
6053		"vaultBaseUrl": vaultBaseURL,
6054	}
6055
6056	pathParameters := map[string]interface{}{
6057		"storage-account-name": autorest.Encode("path", storageAccountName),
6058	}
6059
6060	const APIVersion = "2016-10-01"
6061	queryParameters := map[string]interface{}{
6062		"api-version": APIVersion,
6063	}
6064
6065	preparer := autorest.CreatePreparer(
6066		autorest.AsContentType("application/json; charset=utf-8"),
6067		autorest.AsPatch(),
6068		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
6069		autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters),
6070		autorest.WithJSON(parameters),
6071		autorest.WithQueryParameters(queryParameters))
6072	return preparer.Prepare((&http.Request{}).WithContext(ctx))
6073}
6074
6075// UpdateStorageAccountSender sends the UpdateStorageAccount request. The method will close the
6076// http.Response Body if it receives an error.
6077func (client BaseClient) UpdateStorageAccountSender(req *http.Request) (*http.Response, error) {
6078	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
6079}
6080
6081// UpdateStorageAccountResponder handles the response to the UpdateStorageAccount request. The method always
6082// closes the http.Response Body.
6083func (client BaseClient) UpdateStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) {
6084	err = autorest.Respond(
6085		resp,
6086		azure.WithErrorUnlessStatusCode(http.StatusOK),
6087		autorest.ByUnmarshallingJSON(&result),
6088		autorest.ByClosing())
6089	result.Response = autorest.Response{Response: resp}
6090	return
6091}
6092
6093// Verify the VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly
6094// necessary for asymmetric keys stored in Azure Key Vault since signature verification can be performed using the
6095// public portion of the key but this operation is supported as a convenience for callers that only have a
6096// key-reference and not the public portion of the key. This operation requires the keys/verify permission.
6097// Parameters:
6098// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
6099// keyName - the name of the key.
6100// keyVersion - the version of the key.
6101// parameters - the parameters for verify operations.
6102func (client BaseClient) Verify(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (result KeyVerifyResult, err error) {
6103	if tracing.IsEnabled() {
6104		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Verify")
6105		defer func() {
6106			sc := -1
6107			if result.Response.Response != nil {
6108				sc = result.Response.Response.StatusCode
6109			}
6110			tracing.EndSpan(ctx, sc, err)
6111		}()
6112	}
6113	if err := validation.Validate([]validation.Validation{
6114		{TargetValue: parameters,
6115			Constraints: []validation.Constraint{{Target: "parameters.Digest", Name: validation.Null, Rule: true, Chain: nil},
6116				{Target: "parameters.Signature", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
6117		return result, validation.NewError("keyvault.BaseClient", "Verify", err.Error())
6118	}
6119
6120	req, err := client.VerifyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
6121	if err != nil {
6122		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", nil, "Failure preparing request")
6123		return
6124	}
6125
6126	resp, err := client.VerifySender(req)
6127	if err != nil {
6128		result.Response = autorest.Response{Response: resp}
6129		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure sending request")
6130		return
6131	}
6132
6133	result, err = client.VerifyResponder(resp)
6134	if err != nil {
6135		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure responding to request")
6136		return
6137	}
6138
6139	return
6140}
6141
6142// VerifyPreparer prepares the Verify request.
6143func (client BaseClient) VerifyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (*http.Request, error) {
6144	urlParameters := map[string]interface{}{
6145		"vaultBaseUrl": vaultBaseURL,
6146	}
6147
6148	pathParameters := map[string]interface{}{
6149		"key-name":    autorest.Encode("path", keyName),
6150		"key-version": autorest.Encode("path", keyVersion),
6151	}
6152
6153	const APIVersion = "2016-10-01"
6154	queryParameters := map[string]interface{}{
6155		"api-version": APIVersion,
6156	}
6157
6158	preparer := autorest.CreatePreparer(
6159		autorest.AsContentType("application/json; charset=utf-8"),
6160		autorest.AsPost(),
6161		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
6162		autorest.WithPathParameters("/keys/{key-name}/{key-version}/verify", pathParameters),
6163		autorest.WithJSON(parameters),
6164		autorest.WithQueryParameters(queryParameters))
6165	return preparer.Prepare((&http.Request{}).WithContext(ctx))
6166}
6167
6168// VerifySender sends the Verify request. The method will close the
6169// http.Response Body if it receives an error.
6170func (client BaseClient) VerifySender(req *http.Request) (*http.Response, error) {
6171	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
6172}
6173
6174// VerifyResponder handles the response to the Verify request. The method always
6175// closes the http.Response Body.
6176func (client BaseClient) VerifyResponder(resp *http.Response) (result KeyVerifyResult, err error) {
6177	err = autorest.Respond(
6178		resp,
6179		azure.WithErrorUnlessStatusCode(http.StatusOK),
6180		autorest.ByUnmarshallingJSON(&result),
6181		autorest.ByClosing())
6182	result.Response = autorest.Response{Response: resp}
6183	return
6184}
6185
6186// WrapKey the WRAP operation supports encryption of a symmetric key using a key encryption key that has previously
6187// been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure
6188// Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This
6189// operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have
6190// access to the public key material. This operation requires the keys/wrapKey permission.
6191// Parameters:
6192// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net.
6193// keyName - the name of the key.
6194// keyVersion - the version of the key.
6195// parameters - the parameters for wrap operation.
6196func (client BaseClient) WrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) {
6197	if tracing.IsEnabled() {
6198		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.WrapKey")
6199		defer func() {
6200			sc := -1
6201			if result.Response.Response != nil {
6202				sc = result.Response.Response.StatusCode
6203			}
6204			tracing.EndSpan(ctx, sc, err)
6205		}()
6206	}
6207	if err := validation.Validate([]validation.Validation{
6208		{TargetValue: parameters,
6209			Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
6210		return result, validation.NewError("keyvault.BaseClient", "WrapKey", err.Error())
6211	}
6212
6213	req, err := client.WrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters)
6214	if err != nil {
6215		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", nil, "Failure preparing request")
6216		return
6217	}
6218
6219	resp, err := client.WrapKeySender(req)
6220	if err != nil {
6221		result.Response = autorest.Response{Response: resp}
6222		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure sending request")
6223		return
6224	}
6225
6226	result, err = client.WrapKeyResponder(resp)
6227	if err != nil {
6228		err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure responding to request")
6229		return
6230	}
6231
6232	return
6233}
6234
6235// WrapKeyPreparer prepares the WrapKey request.
6236func (client BaseClient) WrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) {
6237	urlParameters := map[string]interface{}{
6238		"vaultBaseUrl": vaultBaseURL,
6239	}
6240
6241	pathParameters := map[string]interface{}{
6242		"key-name":    autorest.Encode("path", keyName),
6243		"key-version": autorest.Encode("path", keyVersion),
6244	}
6245
6246	const APIVersion = "2016-10-01"
6247	queryParameters := map[string]interface{}{
6248		"api-version": APIVersion,
6249	}
6250
6251	preparer := autorest.CreatePreparer(
6252		autorest.AsContentType("application/json; charset=utf-8"),
6253		autorest.AsPost(),
6254		autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters),
6255		autorest.WithPathParameters("/keys/{key-name}/{key-version}/wrapkey", pathParameters),
6256		autorest.WithJSON(parameters),
6257		autorest.WithQueryParameters(queryParameters))
6258	return preparer.Prepare((&http.Request{}).WithContext(ctx))
6259}
6260
6261// WrapKeySender sends the WrapKey request. The method will close the
6262// http.Response Body if it receives an error.
6263func (client BaseClient) WrapKeySender(req *http.Request) (*http.Response, error) {
6264	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
6265}
6266
6267// WrapKeyResponder handles the response to the WrapKey request. The method always
6268// closes the http.Response Body.
6269func (client BaseClient) WrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) {
6270	err = autorest.Respond(
6271		resp,
6272		azure.WithErrorUnlessStatusCode(http.StatusOK),
6273		autorest.ByUnmarshallingJSON(&result),
6274		autorest.ByClosing())
6275	result.Response = autorest.Response{Response: resp}
6276	return
6277}
6278