1// Package keyvault implements the Azure ARM Keyvault service API version 7.2-preview. 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 and contributors. All rights reserved. 7// 8// Licensed under the Apache License, Version 2.0 (the "License"); 9// you may not use this file except in compliance with the License. 10// You may obtain a copy of the License at 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// distributed under the License is distributed on an "AS IS" BASIS, 15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16// 17// See the License for the specific language governing permissions and 18// limitations under the License. 19// 20// Code generated by Microsoft (R) AutoRest Code Generator. 21// Changes may cause incorrect behavior and will be lost if the code is regenerated. 22 23import ( 24 "context" 25 "github.com/Azure/go-autorest/autorest" 26 "github.com/Azure/go-autorest/autorest/azure" 27 "github.com/Azure/go-autorest/autorest/validation" 28 "github.com/Azure/go-autorest/tracing" 29 "net/http" 30) 31 32// BaseClient is the base client for Keyvault. 33type BaseClient struct { 34 autorest.Client 35} 36 37// New creates an instance of the BaseClient client. 38func New() BaseClient { 39 return NewWithoutDefaults() 40} 41 42// NewWithoutDefaults creates an instance of the BaseClient client. 43func NewWithoutDefaults() BaseClient { 44 return BaseClient{ 45 Client: autorest.NewClientWithUserAgent(UserAgent()), 46 } 47} 48 49// BackupCertificate requests that a backup of the specified certificate be downloaded to the client. All versions of 50// the certificate will be downloaded. This operation requires the certificates/backup permission. 51// Parameters: 52// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 53// certificateName - the name of the certificate. 54func (client BaseClient) BackupCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result BackupCertificateResult, err error) { 55 if tracing.IsEnabled() { 56 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupCertificate") 57 defer func() { 58 sc := -1 59 if result.Response.Response != nil { 60 sc = result.Response.Response.StatusCode 61 } 62 tracing.EndSpan(ctx, sc, err) 63 }() 64 } 65 req, err := client.BackupCertificatePreparer(ctx, vaultBaseURL, certificateName) 66 if err != nil { 67 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", nil, "Failure preparing request") 68 return 69 } 70 71 resp, err := client.BackupCertificateSender(req) 72 if err != nil { 73 result.Response = autorest.Response{Response: resp} 74 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure sending request") 75 return 76 } 77 78 result, err = client.BackupCertificateResponder(resp) 79 if err != nil { 80 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupCertificate", resp, "Failure responding to request") 81 return 82 } 83 84 return 85} 86 87// BackupCertificatePreparer prepares the BackupCertificate request. 88func (client BaseClient) BackupCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 89 urlParameters := map[string]interface{}{ 90 "vaultBaseUrl": vaultBaseURL, 91 } 92 93 pathParameters := map[string]interface{}{ 94 "certificate-name": autorest.Encode("path", certificateName), 95 } 96 97 const APIVersion = "7.2-preview" 98 queryParameters := map[string]interface{}{ 99 "api-version": APIVersion, 100 } 101 102 preparer := autorest.CreatePreparer( 103 autorest.AsPost(), 104 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 105 autorest.WithPathParameters("/certificates/{certificate-name}/backup", pathParameters), 106 autorest.WithQueryParameters(queryParameters)) 107 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 108} 109 110// BackupCertificateSender sends the BackupCertificate request. The method will close the 111// http.Response Body if it receives an error. 112func (client BaseClient) BackupCertificateSender(req *http.Request) (*http.Response, error) { 113 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 114} 115 116// BackupCertificateResponder handles the response to the BackupCertificate request. The method always 117// closes the http.Response Body. 118func (client BaseClient) BackupCertificateResponder(resp *http.Response) (result BackupCertificateResult, err error) { 119 err = autorest.Respond( 120 resp, 121 azure.WithErrorUnlessStatusCode(http.StatusOK), 122 autorest.ByUnmarshallingJSON(&result), 123 autorest.ByClosing()) 124 result.Response = autorest.Response{Response: resp} 125 return 126} 127 128// BackupKey the Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation 129// does NOT return key material in a form that can be used outside the Azure Key Vault system, the returned key 130// material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is 131// to allow a client to GENERATE a key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into 132// another Azure Key Vault instance. The BACKUP operation may be used to export, in protected form, any key type from 133// Azure Key Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed within 134// geographical boundaries only; meaning that a BACKUP from one geographical area cannot be restored to another 135// geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical 136// area. This operation requires the key/backup permission. 137// Parameters: 138// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 139// keyName - the name of the key. 140func (client BaseClient) BackupKey(ctx context.Context, vaultBaseURL string, keyName string) (result BackupKeyResult, err error) { 141 if tracing.IsEnabled() { 142 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupKey") 143 defer func() { 144 sc := -1 145 if result.Response.Response != nil { 146 sc = result.Response.Response.StatusCode 147 } 148 tracing.EndSpan(ctx, sc, err) 149 }() 150 } 151 req, err := client.BackupKeyPreparer(ctx, vaultBaseURL, keyName) 152 if err != nil { 153 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", nil, "Failure preparing request") 154 return 155 } 156 157 resp, err := client.BackupKeySender(req) 158 if err != nil { 159 result.Response = autorest.Response{Response: resp} 160 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure sending request") 161 return 162 } 163 164 result, err = client.BackupKeyResponder(resp) 165 if err != nil { 166 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupKey", resp, "Failure responding to request") 167 return 168 } 169 170 return 171} 172 173// BackupKeyPreparer prepares the BackupKey request. 174func (client BaseClient) BackupKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { 175 urlParameters := map[string]interface{}{ 176 "vaultBaseUrl": vaultBaseURL, 177 } 178 179 pathParameters := map[string]interface{}{ 180 "key-name": autorest.Encode("path", keyName), 181 } 182 183 const APIVersion = "7.2-preview" 184 queryParameters := map[string]interface{}{ 185 "api-version": APIVersion, 186 } 187 188 preparer := autorest.CreatePreparer( 189 autorest.AsPost(), 190 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 191 autorest.WithPathParameters("/keys/{key-name}/backup", pathParameters), 192 autorest.WithQueryParameters(queryParameters)) 193 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 194} 195 196// BackupKeySender sends the BackupKey request. The method will close the 197// http.Response Body if it receives an error. 198func (client BaseClient) BackupKeySender(req *http.Request) (*http.Response, error) { 199 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 200} 201 202// BackupKeyResponder handles the response to the BackupKey request. The method always 203// closes the http.Response Body. 204func (client BaseClient) BackupKeyResponder(resp *http.Response) (result BackupKeyResult, err error) { 205 err = autorest.Respond( 206 resp, 207 azure.WithErrorUnlessStatusCode(http.StatusOK), 208 autorest.ByUnmarshallingJSON(&result), 209 autorest.ByClosing()) 210 result.Response = autorest.Response{Response: resp} 211 return 212} 213 214// BackupSecret requests that a backup of the specified secret be downloaded to the client. All versions of the secret 215// will be downloaded. This operation requires the secrets/backup permission. 216// Parameters: 217// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 218// secretName - the name of the secret. 219func (client BaseClient) BackupSecret(ctx context.Context, vaultBaseURL string, secretName string) (result BackupSecretResult, err error) { 220 if tracing.IsEnabled() { 221 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupSecret") 222 defer func() { 223 sc := -1 224 if result.Response.Response != nil { 225 sc = result.Response.Response.StatusCode 226 } 227 tracing.EndSpan(ctx, sc, err) 228 }() 229 } 230 req, err := client.BackupSecretPreparer(ctx, vaultBaseURL, secretName) 231 if err != nil { 232 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", nil, "Failure preparing request") 233 return 234 } 235 236 resp, err := client.BackupSecretSender(req) 237 if err != nil { 238 result.Response = autorest.Response{Response: resp} 239 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure sending request") 240 return 241 } 242 243 result, err = client.BackupSecretResponder(resp) 244 if err != nil { 245 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupSecret", resp, "Failure responding to request") 246 return 247 } 248 249 return 250} 251 252// BackupSecretPreparer prepares the BackupSecret request. 253func (client BaseClient) BackupSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { 254 urlParameters := map[string]interface{}{ 255 "vaultBaseUrl": vaultBaseURL, 256 } 257 258 pathParameters := map[string]interface{}{ 259 "secret-name": autorest.Encode("path", secretName), 260 } 261 262 const APIVersion = "7.2-preview" 263 queryParameters := map[string]interface{}{ 264 "api-version": APIVersion, 265 } 266 267 preparer := autorest.CreatePreparer( 268 autorest.AsPost(), 269 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 270 autorest.WithPathParameters("/secrets/{secret-name}/backup", pathParameters), 271 autorest.WithQueryParameters(queryParameters)) 272 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 273} 274 275// BackupSecretSender sends the BackupSecret request. The method will close the 276// http.Response Body if it receives an error. 277func (client BaseClient) BackupSecretSender(req *http.Request) (*http.Response, error) { 278 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 279} 280 281// BackupSecretResponder handles the response to the BackupSecret request. The method always 282// closes the http.Response Body. 283func (client BaseClient) BackupSecretResponder(resp *http.Response) (result BackupSecretResult, err error) { 284 err = autorest.Respond( 285 resp, 286 azure.WithErrorUnlessStatusCode(http.StatusOK), 287 autorest.ByUnmarshallingJSON(&result), 288 autorest.ByClosing()) 289 result.Response = autorest.Response{Response: resp} 290 return 291} 292 293// BackupStorageAccount requests that a backup of the specified storage account be downloaded to the client. This 294// operation requires the storage/backup permission. 295// Parameters: 296// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 297// storageAccountName - the name of the storage account. 298func (client BaseClient) BackupStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result BackupStorageResult, err error) { 299 if tracing.IsEnabled() { 300 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.BackupStorageAccount") 301 defer func() { 302 sc := -1 303 if result.Response.Response != nil { 304 sc = result.Response.Response.StatusCode 305 } 306 tracing.EndSpan(ctx, sc, err) 307 }() 308 } 309 req, err := client.BackupStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 310 if err != nil { 311 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", nil, "Failure preparing request") 312 return 313 } 314 315 resp, err := client.BackupStorageAccountSender(req) 316 if err != nil { 317 result.Response = autorest.Response{Response: resp} 318 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", resp, "Failure sending request") 319 return 320 } 321 322 result, err = client.BackupStorageAccountResponder(resp) 323 if err != nil { 324 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "BackupStorageAccount", resp, "Failure responding to request") 325 return 326 } 327 328 return 329} 330 331// BackupStorageAccountPreparer prepares the BackupStorageAccount request. 332func (client BaseClient) BackupStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 333 urlParameters := map[string]interface{}{ 334 "vaultBaseUrl": vaultBaseURL, 335 } 336 337 pathParameters := map[string]interface{}{ 338 "storage-account-name": autorest.Encode("path", storageAccountName), 339 } 340 341 const APIVersion = "7.2-preview" 342 queryParameters := map[string]interface{}{ 343 "api-version": APIVersion, 344 } 345 346 preparer := autorest.CreatePreparer( 347 autorest.AsPost(), 348 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 349 autorest.WithPathParameters("/storage/{storage-account-name}/backup", pathParameters), 350 autorest.WithQueryParameters(queryParameters)) 351 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 352} 353 354// BackupStorageAccountSender sends the BackupStorageAccount request. The method will close the 355// http.Response Body if it receives an error. 356func (client BaseClient) BackupStorageAccountSender(req *http.Request) (*http.Response, error) { 357 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 358} 359 360// BackupStorageAccountResponder handles the response to the BackupStorageAccount request. The method always 361// closes the http.Response Body. 362func (client BaseClient) BackupStorageAccountResponder(resp *http.Response) (result BackupStorageResult, err error) { 363 err = autorest.Respond( 364 resp, 365 azure.WithErrorUnlessStatusCode(http.StatusOK), 366 autorest.ByUnmarshallingJSON(&result), 367 autorest.ByClosing()) 368 result.Response = autorest.Response{Response: resp} 369 return 370} 371 372// CreateCertificate if this is the first version, the certificate resource is created. This operation requires the 373// certificates/create permission. 374// Parameters: 375// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 376// certificateName - the name of the certificate. 377// parameters - the parameters to create a certificate. 378func (client BaseClient) CreateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (result CertificateOperation, err error) { 379 if tracing.IsEnabled() { 380 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateCertificate") 381 defer func() { 382 sc := -1 383 if result.Response.Response != nil { 384 sc = result.Response.Response.StatusCode 385 } 386 tracing.EndSpan(ctx, sc, err) 387 }() 388 } 389 if err := validation.Validate([]validation.Validation{ 390 {TargetValue: certificateName, 391 Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, 392 {TargetValue: parameters, 393 Constraints: []validation.Constraint{{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, 394 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, 395 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, 396 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, 397 }}, 398 }}}}}); err != nil { 399 return result, validation.NewError("keyvault.BaseClient", "CreateCertificate", err.Error()) 400 } 401 402 req, err := client.CreateCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) 403 if err != nil { 404 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", nil, "Failure preparing request") 405 return 406 } 407 408 resp, err := client.CreateCertificateSender(req) 409 if err != nil { 410 result.Response = autorest.Response{Response: resp} 411 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure sending request") 412 return 413 } 414 415 result, err = client.CreateCertificateResponder(resp) 416 if err != nil { 417 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateCertificate", resp, "Failure responding to request") 418 return 419 } 420 421 return 422} 423 424// CreateCertificatePreparer prepares the CreateCertificate request. 425func (client BaseClient) CreateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (*http.Request, error) { 426 urlParameters := map[string]interface{}{ 427 "vaultBaseUrl": vaultBaseURL, 428 } 429 430 pathParameters := map[string]interface{}{ 431 "certificate-name": autorest.Encode("path", certificateName), 432 } 433 434 const APIVersion = "7.2-preview" 435 queryParameters := map[string]interface{}{ 436 "api-version": APIVersion, 437 } 438 439 preparer := autorest.CreatePreparer( 440 autorest.AsContentType("application/json; charset=utf-8"), 441 autorest.AsPost(), 442 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 443 autorest.WithPathParameters("/certificates/{certificate-name}/create", pathParameters), 444 autorest.WithJSON(parameters), 445 autorest.WithQueryParameters(queryParameters)) 446 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 447} 448 449// CreateCertificateSender sends the CreateCertificate request. The method will close the 450// http.Response Body if it receives an error. 451func (client BaseClient) CreateCertificateSender(req *http.Request) (*http.Response, error) { 452 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 453} 454 455// CreateCertificateResponder handles the response to the CreateCertificate request. The method always 456// closes the http.Response Body. 457func (client BaseClient) CreateCertificateResponder(resp *http.Response) (result CertificateOperation, err error) { 458 err = autorest.Respond( 459 resp, 460 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 461 autorest.ByUnmarshallingJSON(&result), 462 autorest.ByClosing()) 463 result.Response = autorest.Response{Response: resp} 464 return 465} 466 467// CreateKey the create key operation can be used to create any key type in Azure Key Vault. If the named key already 468// exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission. 469// Parameters: 470// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 471// keyName - the name for the new key. The system will generate the version name for the new key. 472// parameters - the parameters to create a key. 473func (client BaseClient) CreateKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (result KeyBundle, err error) { 474 if tracing.IsEnabled() { 475 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateKey") 476 defer func() { 477 sc := -1 478 if result.Response.Response != nil { 479 sc = result.Response.Response.StatusCode 480 } 481 tracing.EndSpan(ctx, sc, err) 482 }() 483 } 484 if err := validation.Validate([]validation.Validation{ 485 {TargetValue: keyName, 486 Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}}); err != nil { 487 return result, validation.NewError("keyvault.BaseClient", "CreateKey", err.Error()) 488 } 489 490 req, err := client.CreateKeyPreparer(ctx, vaultBaseURL, keyName, parameters) 491 if err != nil { 492 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", nil, "Failure preparing request") 493 return 494 } 495 496 resp, err := client.CreateKeySender(req) 497 if err != nil { 498 result.Response = autorest.Response{Response: resp} 499 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure sending request") 500 return 501 } 502 503 result, err = client.CreateKeyResponder(resp) 504 if err != nil { 505 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "CreateKey", resp, "Failure responding to request") 506 return 507 } 508 509 return 510} 511 512// CreateKeyPreparer prepares the CreateKey request. 513func (client BaseClient) CreateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyCreateParameters) (*http.Request, error) { 514 urlParameters := map[string]interface{}{ 515 "vaultBaseUrl": vaultBaseURL, 516 } 517 518 pathParameters := map[string]interface{}{ 519 "key-name": autorest.Encode("path", keyName), 520 } 521 522 const APIVersion = "7.2-preview" 523 queryParameters := map[string]interface{}{ 524 "api-version": APIVersion, 525 } 526 527 preparer := autorest.CreatePreparer( 528 autorest.AsContentType("application/json; charset=utf-8"), 529 autorest.AsPost(), 530 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 531 autorest.WithPathParameters("/keys/{key-name}/create", pathParameters), 532 autorest.WithJSON(parameters), 533 autorest.WithQueryParameters(queryParameters)) 534 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 535} 536 537// CreateKeySender sends the CreateKey request. The method will close the 538// http.Response Body if it receives an error. 539func (client BaseClient) CreateKeySender(req *http.Request) (*http.Response, error) { 540 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 541} 542 543// CreateKeyResponder handles the response to the CreateKey request. The method always 544// closes the http.Response Body. 545func (client BaseClient) CreateKeyResponder(resp *http.Response) (result KeyBundle, err error) { 546 err = autorest.Respond( 547 resp, 548 azure.WithErrorUnlessStatusCode(http.StatusOK), 549 autorest.ByUnmarshallingJSON(&result), 550 autorest.ByClosing()) 551 result.Response = autorest.Response{Response: resp} 552 return 553} 554 555// Decrypt the DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and 556// specified algorithm. This operation is the reverse of the ENCRYPT operation; only a single block of data may be 557// decrypted, the size of this block is dependent on the target key and the algorithm to be used. The DECRYPT operation 558// applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key. 559// This operation requires the keys/decrypt permission. 560// Parameters: 561// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 562// keyName - the name of the key. 563// keyVersion - the version of the key. 564// parameters - the parameters for the decryption operation. 565func (client BaseClient) Decrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { 566 if tracing.IsEnabled() { 567 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Decrypt") 568 defer func() { 569 sc := -1 570 if result.Response.Response != nil { 571 sc = result.Response.Response.StatusCode 572 } 573 tracing.EndSpan(ctx, sc, err) 574 }() 575 } 576 if err := validation.Validate([]validation.Validation{ 577 {TargetValue: parameters, 578 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 579 return result, validation.NewError("keyvault.BaseClient", "Decrypt", err.Error()) 580 } 581 582 req, err := client.DecryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 583 if err != nil { 584 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", nil, "Failure preparing request") 585 return 586 } 587 588 resp, err := client.DecryptSender(req) 589 if err != nil { 590 result.Response = autorest.Response{Response: resp} 591 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure sending request") 592 return 593 } 594 595 result, err = client.DecryptResponder(resp) 596 if err != nil { 597 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Decrypt", resp, "Failure responding to request") 598 return 599 } 600 601 return 602} 603 604// DecryptPreparer prepares the Decrypt request. 605func (client BaseClient) DecryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { 606 urlParameters := map[string]interface{}{ 607 "vaultBaseUrl": vaultBaseURL, 608 } 609 610 pathParameters := map[string]interface{}{ 611 "key-name": autorest.Encode("path", keyName), 612 "key-version": autorest.Encode("path", keyVersion), 613 } 614 615 const APIVersion = "7.2-preview" 616 queryParameters := map[string]interface{}{ 617 "api-version": APIVersion, 618 } 619 620 preparer := autorest.CreatePreparer( 621 autorest.AsContentType("application/json; charset=utf-8"), 622 autorest.AsPost(), 623 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 624 autorest.WithPathParameters("/keys/{key-name}/{key-version}/decrypt", pathParameters), 625 autorest.WithJSON(parameters), 626 autorest.WithQueryParameters(queryParameters)) 627 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 628} 629 630// DecryptSender sends the Decrypt request. The method will close the 631// http.Response Body if it receives an error. 632func (client BaseClient) DecryptSender(req *http.Request) (*http.Response, error) { 633 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 634} 635 636// DecryptResponder handles the response to the Decrypt request. The method always 637// closes the http.Response Body. 638func (client BaseClient) DecryptResponder(resp *http.Response) (result KeyOperationResult, err error) { 639 err = autorest.Respond( 640 resp, 641 azure.WithErrorUnlessStatusCode(http.StatusOK), 642 autorest.ByUnmarshallingJSON(&result), 643 autorest.ByClosing()) 644 result.Response = autorest.Response{Response: resp} 645 return 646} 647 648// DeleteCertificate deletes all versions of a certificate object along with its associated policy. Delete certificate 649// cannot be used to remove individual versions of a certificate object. This operation requires the 650// certificates/delete permission. 651// Parameters: 652// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 653// certificateName - the name of the certificate. 654func (client BaseClient) DeleteCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) { 655 if tracing.IsEnabled() { 656 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificate") 657 defer func() { 658 sc := -1 659 if result.Response.Response != nil { 660 sc = result.Response.Response.StatusCode 661 } 662 tracing.EndSpan(ctx, sc, err) 663 }() 664 } 665 req, err := client.DeleteCertificatePreparer(ctx, vaultBaseURL, certificateName) 666 if err != nil { 667 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", nil, "Failure preparing request") 668 return 669 } 670 671 resp, err := client.DeleteCertificateSender(req) 672 if err != nil { 673 result.Response = autorest.Response{Response: resp} 674 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure sending request") 675 return 676 } 677 678 result, err = client.DeleteCertificateResponder(resp) 679 if err != nil { 680 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificate", resp, "Failure responding to request") 681 return 682 } 683 684 return 685} 686 687// DeleteCertificatePreparer prepares the DeleteCertificate request. 688func (client BaseClient) DeleteCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 689 urlParameters := map[string]interface{}{ 690 "vaultBaseUrl": vaultBaseURL, 691 } 692 693 pathParameters := map[string]interface{}{ 694 "certificate-name": autorest.Encode("path", certificateName), 695 } 696 697 const APIVersion = "7.2-preview" 698 queryParameters := map[string]interface{}{ 699 "api-version": APIVersion, 700 } 701 702 preparer := autorest.CreatePreparer( 703 autorest.AsDelete(), 704 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 705 autorest.WithPathParameters("/certificates/{certificate-name}", pathParameters), 706 autorest.WithQueryParameters(queryParameters)) 707 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 708} 709 710// DeleteCertificateSender sends the DeleteCertificate request. The method will close the 711// http.Response Body if it receives an error. 712func (client BaseClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { 713 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 714} 715 716// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always 717// closes the http.Response Body. 718func (client BaseClient) DeleteCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) { 719 err = autorest.Respond( 720 resp, 721 azure.WithErrorUnlessStatusCode(http.StatusOK), 722 autorest.ByUnmarshallingJSON(&result), 723 autorest.ByClosing()) 724 result.Response = autorest.Response{Response: resp} 725 return 726} 727 728// DeleteCertificateContacts deletes the certificate contacts for a specified key vault certificate. This operation 729// requires the certificates/managecontacts permission. 730// Parameters: 731// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 732func (client BaseClient) DeleteCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) { 733 if tracing.IsEnabled() { 734 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateContacts") 735 defer func() { 736 sc := -1 737 if result.Response.Response != nil { 738 sc = result.Response.Response.StatusCode 739 } 740 tracing.EndSpan(ctx, sc, err) 741 }() 742 } 743 req, err := client.DeleteCertificateContactsPreparer(ctx, vaultBaseURL) 744 if err != nil { 745 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", nil, "Failure preparing request") 746 return 747 } 748 749 resp, err := client.DeleteCertificateContactsSender(req) 750 if err != nil { 751 result.Response = autorest.Response{Response: resp} 752 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure sending request") 753 return 754 } 755 756 result, err = client.DeleteCertificateContactsResponder(resp) 757 if err != nil { 758 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateContacts", resp, "Failure responding to request") 759 return 760 } 761 762 return 763} 764 765// DeleteCertificateContactsPreparer prepares the DeleteCertificateContacts request. 766func (client BaseClient) DeleteCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) { 767 urlParameters := map[string]interface{}{ 768 "vaultBaseUrl": vaultBaseURL, 769 } 770 771 const APIVersion = "7.2-preview" 772 queryParameters := map[string]interface{}{ 773 "api-version": APIVersion, 774 } 775 776 preparer := autorest.CreatePreparer( 777 autorest.AsDelete(), 778 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 779 autorest.WithPath("/certificates/contacts"), 780 autorest.WithQueryParameters(queryParameters)) 781 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 782} 783 784// DeleteCertificateContactsSender sends the DeleteCertificateContacts request. The method will close the 785// http.Response Body if it receives an error. 786func (client BaseClient) DeleteCertificateContactsSender(req *http.Request) (*http.Response, error) { 787 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 788} 789 790// DeleteCertificateContactsResponder handles the response to the DeleteCertificateContacts request. The method always 791// closes the http.Response Body. 792func (client BaseClient) DeleteCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { 793 err = autorest.Respond( 794 resp, 795 azure.WithErrorUnlessStatusCode(http.StatusOK), 796 autorest.ByUnmarshallingJSON(&result), 797 autorest.ByClosing()) 798 result.Response = autorest.Response{Response: resp} 799 return 800} 801 802// DeleteCertificateIssuer the DeleteCertificateIssuer operation permanently removes the specified certificate issuer 803// from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. 804// Parameters: 805// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 806// issuerName - the name of the issuer. 807func (client BaseClient) DeleteCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { 808 if tracing.IsEnabled() { 809 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateIssuer") 810 defer func() { 811 sc := -1 812 if result.Response.Response != nil { 813 sc = result.Response.Response.StatusCode 814 } 815 tracing.EndSpan(ctx, sc, err) 816 }() 817 } 818 req, err := client.DeleteCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName) 819 if err != nil { 820 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", nil, "Failure preparing request") 821 return 822 } 823 824 resp, err := client.DeleteCertificateIssuerSender(req) 825 if err != nil { 826 result.Response = autorest.Response{Response: resp} 827 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure sending request") 828 return 829 } 830 831 result, err = client.DeleteCertificateIssuerResponder(resp) 832 if err != nil { 833 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateIssuer", resp, "Failure responding to request") 834 return 835 } 836 837 return 838} 839 840// DeleteCertificateIssuerPreparer prepares the DeleteCertificateIssuer request. 841func (client BaseClient) DeleteCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) { 842 urlParameters := map[string]interface{}{ 843 "vaultBaseUrl": vaultBaseURL, 844 } 845 846 pathParameters := map[string]interface{}{ 847 "issuer-name": autorest.Encode("path", issuerName), 848 } 849 850 const APIVersion = "7.2-preview" 851 queryParameters := map[string]interface{}{ 852 "api-version": APIVersion, 853 } 854 855 preparer := autorest.CreatePreparer( 856 autorest.AsDelete(), 857 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 858 autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), 859 autorest.WithQueryParameters(queryParameters)) 860 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 861} 862 863// DeleteCertificateIssuerSender sends the DeleteCertificateIssuer request. The method will close the 864// http.Response Body if it receives an error. 865func (client BaseClient) DeleteCertificateIssuerSender(req *http.Request) (*http.Response, error) { 866 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 867} 868 869// DeleteCertificateIssuerResponder handles the response to the DeleteCertificateIssuer request. The method always 870// closes the http.Response Body. 871func (client BaseClient) DeleteCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { 872 err = autorest.Respond( 873 resp, 874 azure.WithErrorUnlessStatusCode(http.StatusOK), 875 autorest.ByUnmarshallingJSON(&result), 876 autorest.ByClosing()) 877 result.Response = autorest.Response{Response: resp} 878 return 879} 880 881// DeleteCertificateOperation deletes the creation operation for a specified certificate that is in the process of 882// being created. The certificate is no longer created. This operation requires the certificates/update permission. 883// Parameters: 884// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 885// certificateName - the name of the certificate. 886func (client BaseClient) DeleteCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { 887 if tracing.IsEnabled() { 888 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteCertificateOperation") 889 defer func() { 890 sc := -1 891 if result.Response.Response != nil { 892 sc = result.Response.Response.StatusCode 893 } 894 tracing.EndSpan(ctx, sc, err) 895 }() 896 } 897 req, err := client.DeleteCertificateOperationPreparer(ctx, vaultBaseURL, certificateName) 898 if err != nil { 899 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", nil, "Failure preparing request") 900 return 901 } 902 903 resp, err := client.DeleteCertificateOperationSender(req) 904 if err != nil { 905 result.Response = autorest.Response{Response: resp} 906 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure sending request") 907 return 908 } 909 910 result, err = client.DeleteCertificateOperationResponder(resp) 911 if err != nil { 912 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteCertificateOperation", resp, "Failure responding to request") 913 return 914 } 915 916 return 917} 918 919// DeleteCertificateOperationPreparer prepares the DeleteCertificateOperation request. 920func (client BaseClient) DeleteCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 921 urlParameters := map[string]interface{}{ 922 "vaultBaseUrl": vaultBaseURL, 923 } 924 925 pathParameters := map[string]interface{}{ 926 "certificate-name": autorest.Encode("path", certificateName), 927 } 928 929 const APIVersion = "7.2-preview" 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("/certificates/{certificate-name}/pending", pathParameters), 938 autorest.WithQueryParameters(queryParameters)) 939 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 940} 941 942// DeleteCertificateOperationSender sends the DeleteCertificateOperation request. The method will close the 943// http.Response Body if it receives an error. 944func (client BaseClient) DeleteCertificateOperationSender(req *http.Request) (*http.Response, error) { 945 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 946} 947 948// DeleteCertificateOperationResponder handles the response to the DeleteCertificateOperation request. The method always 949// closes the http.Response Body. 950func (client BaseClient) DeleteCertificateOperationResponder(resp *http.Response) (result CertificateOperation, 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// DeleteKey the delete key operation cannot be used to remove individual versions of a key. This operation removes the 961// cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or 962// Encrypt/Decrypt operations. This operation requires the keys/delete permission. 963// Parameters: 964// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 965// keyName - the name of the key to delete. 966func (client BaseClient) DeleteKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) { 967 if tracing.IsEnabled() { 968 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteKey") 969 defer func() { 970 sc := -1 971 if result.Response.Response != nil { 972 sc = result.Response.Response.StatusCode 973 } 974 tracing.EndSpan(ctx, sc, err) 975 }() 976 } 977 req, err := client.DeleteKeyPreparer(ctx, vaultBaseURL, keyName) 978 if err != nil { 979 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", nil, "Failure preparing request") 980 return 981 } 982 983 resp, err := client.DeleteKeySender(req) 984 if err != nil { 985 result.Response = autorest.Response{Response: resp} 986 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure sending request") 987 return 988 } 989 990 result, err = client.DeleteKeyResponder(resp) 991 if err != nil { 992 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteKey", resp, "Failure responding to request") 993 return 994 } 995 996 return 997} 998 999// DeleteKeyPreparer prepares the DeleteKey request. 1000func (client BaseClient) DeleteKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { 1001 urlParameters := map[string]interface{}{ 1002 "vaultBaseUrl": vaultBaseURL, 1003 } 1004 1005 pathParameters := map[string]interface{}{ 1006 "key-name": autorest.Encode("path", keyName), 1007 } 1008 1009 const APIVersion = "7.2-preview" 1010 queryParameters := map[string]interface{}{ 1011 "api-version": APIVersion, 1012 } 1013 1014 preparer := autorest.CreatePreparer( 1015 autorest.AsDelete(), 1016 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1017 autorest.WithPathParameters("/keys/{key-name}", pathParameters), 1018 autorest.WithQueryParameters(queryParameters)) 1019 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1020} 1021 1022// DeleteKeySender sends the DeleteKey request. The method will close the 1023// http.Response Body if it receives an error. 1024func (client BaseClient) DeleteKeySender(req *http.Request) (*http.Response, error) { 1025 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1026} 1027 1028// DeleteKeyResponder handles the response to the DeleteKey request. The method always 1029// closes the http.Response Body. 1030func (client BaseClient) DeleteKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) { 1031 err = autorest.Respond( 1032 resp, 1033 azure.WithErrorUnlessStatusCode(http.StatusOK), 1034 autorest.ByUnmarshallingJSON(&result), 1035 autorest.ByClosing()) 1036 result.Response = autorest.Response{Response: resp} 1037 return 1038} 1039 1040// DeleteSasDefinition deletes a SAS definition from a specified storage account. This operation requires the 1041// storage/deletesas permission. 1042// Parameters: 1043// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1044// storageAccountName - the name of the storage account. 1045// sasDefinitionName - the name of the SAS definition. 1046func (client BaseClient) DeleteSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result DeletedSasDefinitionBundle, err error) { 1047 if tracing.IsEnabled() { 1048 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteSasDefinition") 1049 defer func() { 1050 sc := -1 1051 if result.Response.Response != nil { 1052 sc = result.Response.Response.StatusCode 1053 } 1054 tracing.EndSpan(ctx, sc, err) 1055 }() 1056 } 1057 if err := validation.Validate([]validation.Validation{ 1058 {TargetValue: storageAccountName, 1059 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 1060 {TargetValue: sasDefinitionName, 1061 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 1062 return result, validation.NewError("keyvault.BaseClient", "DeleteSasDefinition", err.Error()) 1063 } 1064 1065 req, err := client.DeleteSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) 1066 if err != nil { 1067 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", nil, "Failure preparing request") 1068 return 1069 } 1070 1071 resp, err := client.DeleteSasDefinitionSender(req) 1072 if err != nil { 1073 result.Response = autorest.Response{Response: resp} 1074 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure sending request") 1075 return 1076 } 1077 1078 result, err = client.DeleteSasDefinitionResponder(resp) 1079 if err != nil { 1080 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSasDefinition", resp, "Failure responding to request") 1081 return 1082 } 1083 1084 return 1085} 1086 1087// DeleteSasDefinitionPreparer prepares the DeleteSasDefinition request. 1088func (client BaseClient) DeleteSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { 1089 urlParameters := map[string]interface{}{ 1090 "vaultBaseUrl": vaultBaseURL, 1091 } 1092 1093 pathParameters := map[string]interface{}{ 1094 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 1095 "storage-account-name": autorest.Encode("path", storageAccountName), 1096 } 1097 1098 const APIVersion = "7.2-preview" 1099 queryParameters := map[string]interface{}{ 1100 "api-version": APIVersion, 1101 } 1102 1103 preparer := autorest.CreatePreparer( 1104 autorest.AsDelete(), 1105 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1106 autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), 1107 autorest.WithQueryParameters(queryParameters)) 1108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1109} 1110 1111// DeleteSasDefinitionSender sends the DeleteSasDefinition request. The method will close the 1112// http.Response Body if it receives an error. 1113func (client BaseClient) DeleteSasDefinitionSender(req *http.Request) (*http.Response, error) { 1114 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1115} 1116 1117// DeleteSasDefinitionResponder handles the response to the DeleteSasDefinition request. The method always 1118// closes the http.Response Body. 1119func (client BaseClient) DeleteSasDefinitionResponder(resp *http.Response) (result DeletedSasDefinitionBundle, err error) { 1120 err = autorest.Respond( 1121 resp, 1122 azure.WithErrorUnlessStatusCode(http.StatusOK), 1123 autorest.ByUnmarshallingJSON(&result), 1124 autorest.ByClosing()) 1125 result.Response = autorest.Response{Response: resp} 1126 return 1127} 1128 1129// DeleteSecret the DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an 1130// individual version of a secret. This operation requires the secrets/delete permission. 1131// Parameters: 1132// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1133// secretName - the name of the secret. 1134func (client BaseClient) DeleteSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) { 1135 if tracing.IsEnabled() { 1136 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteSecret") 1137 defer func() { 1138 sc := -1 1139 if result.Response.Response != nil { 1140 sc = result.Response.Response.StatusCode 1141 } 1142 tracing.EndSpan(ctx, sc, err) 1143 }() 1144 } 1145 req, err := client.DeleteSecretPreparer(ctx, vaultBaseURL, secretName) 1146 if err != nil { 1147 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", nil, "Failure preparing request") 1148 return 1149 } 1150 1151 resp, err := client.DeleteSecretSender(req) 1152 if err != nil { 1153 result.Response = autorest.Response{Response: resp} 1154 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure sending request") 1155 return 1156 } 1157 1158 result, err = client.DeleteSecretResponder(resp) 1159 if err != nil { 1160 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteSecret", resp, "Failure responding to request") 1161 return 1162 } 1163 1164 return 1165} 1166 1167// DeleteSecretPreparer prepares the DeleteSecret request. 1168func (client BaseClient) DeleteSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { 1169 urlParameters := map[string]interface{}{ 1170 "vaultBaseUrl": vaultBaseURL, 1171 } 1172 1173 pathParameters := map[string]interface{}{ 1174 "secret-name": autorest.Encode("path", secretName), 1175 } 1176 1177 const APIVersion = "7.2-preview" 1178 queryParameters := map[string]interface{}{ 1179 "api-version": APIVersion, 1180 } 1181 1182 preparer := autorest.CreatePreparer( 1183 autorest.AsDelete(), 1184 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1185 autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), 1186 autorest.WithQueryParameters(queryParameters)) 1187 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1188} 1189 1190// DeleteSecretSender sends the DeleteSecret request. The method will close the 1191// http.Response Body if it receives an error. 1192func (client BaseClient) DeleteSecretSender(req *http.Request) (*http.Response, error) { 1193 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1194} 1195 1196// DeleteSecretResponder handles the response to the DeleteSecret request. The method always 1197// closes the http.Response Body. 1198func (client BaseClient) DeleteSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) { 1199 err = autorest.Respond( 1200 resp, 1201 azure.WithErrorUnlessStatusCode(http.StatusOK), 1202 autorest.ByUnmarshallingJSON(&result), 1203 autorest.ByClosing()) 1204 result.Response = autorest.Response{Response: resp} 1205 return 1206} 1207 1208// DeleteStorageAccount deletes a storage account. This operation requires the storage/delete permission. 1209// Parameters: 1210// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1211// storageAccountName - the name of the storage account. 1212func (client BaseClient) DeleteStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result DeletedStorageBundle, err error) { 1213 if tracing.IsEnabled() { 1214 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteStorageAccount") 1215 defer func() { 1216 sc := -1 1217 if result.Response.Response != nil { 1218 sc = result.Response.Response.StatusCode 1219 } 1220 tracing.EndSpan(ctx, sc, err) 1221 }() 1222 } 1223 if err := validation.Validate([]validation.Validation{ 1224 {TargetValue: storageAccountName, 1225 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 1226 return result, validation.NewError("keyvault.BaseClient", "DeleteStorageAccount", err.Error()) 1227 } 1228 1229 req, err := client.DeleteStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 1230 if err != nil { 1231 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", nil, "Failure preparing request") 1232 return 1233 } 1234 1235 resp, err := client.DeleteStorageAccountSender(req) 1236 if err != nil { 1237 result.Response = autorest.Response{Response: resp} 1238 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure sending request") 1239 return 1240 } 1241 1242 result, err = client.DeleteStorageAccountResponder(resp) 1243 if err != nil { 1244 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "DeleteStorageAccount", resp, "Failure responding to request") 1245 return 1246 } 1247 1248 return 1249} 1250 1251// DeleteStorageAccountPreparer prepares the DeleteStorageAccount request. 1252func (client BaseClient) DeleteStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 1253 urlParameters := map[string]interface{}{ 1254 "vaultBaseUrl": vaultBaseURL, 1255 } 1256 1257 pathParameters := map[string]interface{}{ 1258 "storage-account-name": autorest.Encode("path", storageAccountName), 1259 } 1260 1261 const APIVersion = "7.2-preview" 1262 queryParameters := map[string]interface{}{ 1263 "api-version": APIVersion, 1264 } 1265 1266 preparer := autorest.CreatePreparer( 1267 autorest.AsDelete(), 1268 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1269 autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), 1270 autorest.WithQueryParameters(queryParameters)) 1271 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1272} 1273 1274// DeleteStorageAccountSender sends the DeleteStorageAccount request. The method will close the 1275// http.Response Body if it receives an error. 1276func (client BaseClient) DeleteStorageAccountSender(req *http.Request) (*http.Response, error) { 1277 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1278} 1279 1280// DeleteStorageAccountResponder handles the response to the DeleteStorageAccount request. The method always 1281// closes the http.Response Body. 1282func (client BaseClient) DeleteStorageAccountResponder(resp *http.Response) (result DeletedStorageBundle, err error) { 1283 err = autorest.Respond( 1284 resp, 1285 azure.WithErrorUnlessStatusCode(http.StatusOK), 1286 autorest.ByUnmarshallingJSON(&result), 1287 autorest.ByClosing()) 1288 result.Response = autorest.Response{Response: resp} 1289 return 1290} 1291 1292// Encrypt the ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in 1293// Azure Key Vault. Note that the ENCRYPT operation only supports a single block of data, the size of which is 1294// dependent on the target key and the encryption algorithm to be used. The ENCRYPT operation is only strictly 1295// necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed 1296// using public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that 1297// have a key-reference but do not have access to the public key material. This operation requires the keys/encrypt 1298// permission. 1299// Parameters: 1300// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1301// keyName - the name of the key. 1302// keyVersion - the version of the key. 1303// parameters - the parameters for the encryption operation. 1304func (client BaseClient) Encrypt(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { 1305 if tracing.IsEnabled() { 1306 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Encrypt") 1307 defer func() { 1308 sc := -1 1309 if result.Response.Response != nil { 1310 sc = result.Response.Response.StatusCode 1311 } 1312 tracing.EndSpan(ctx, sc, err) 1313 }() 1314 } 1315 if err := validation.Validate([]validation.Validation{ 1316 {TargetValue: parameters, 1317 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 1318 return result, validation.NewError("keyvault.BaseClient", "Encrypt", err.Error()) 1319 } 1320 1321 req, err := client.EncryptPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 1322 if err != nil { 1323 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", nil, "Failure preparing request") 1324 return 1325 } 1326 1327 resp, err := client.EncryptSender(req) 1328 if err != nil { 1329 result.Response = autorest.Response{Response: resp} 1330 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure sending request") 1331 return 1332 } 1333 1334 result, err = client.EncryptResponder(resp) 1335 if err != nil { 1336 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Encrypt", resp, "Failure responding to request") 1337 return 1338 } 1339 1340 return 1341} 1342 1343// EncryptPreparer prepares the Encrypt request. 1344func (client BaseClient) EncryptPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { 1345 urlParameters := map[string]interface{}{ 1346 "vaultBaseUrl": vaultBaseURL, 1347 } 1348 1349 pathParameters := map[string]interface{}{ 1350 "key-name": autorest.Encode("path", keyName), 1351 "key-version": autorest.Encode("path", keyVersion), 1352 } 1353 1354 const APIVersion = "7.2-preview" 1355 queryParameters := map[string]interface{}{ 1356 "api-version": APIVersion, 1357 } 1358 1359 preparer := autorest.CreatePreparer( 1360 autorest.AsContentType("application/json; charset=utf-8"), 1361 autorest.AsPost(), 1362 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1363 autorest.WithPathParameters("/keys/{key-name}/{key-version}/encrypt", pathParameters), 1364 autorest.WithJSON(parameters), 1365 autorest.WithQueryParameters(queryParameters)) 1366 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1367} 1368 1369// EncryptSender sends the Encrypt request. The method will close the 1370// http.Response Body if it receives an error. 1371func (client BaseClient) EncryptSender(req *http.Request) (*http.Response, error) { 1372 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1373} 1374 1375// EncryptResponder handles the response to the Encrypt request. The method always 1376// closes the http.Response Body. 1377func (client BaseClient) EncryptResponder(resp *http.Response) (result KeyOperationResult, err error) { 1378 err = autorest.Respond( 1379 resp, 1380 azure.WithErrorUnlessStatusCode(http.StatusOK), 1381 autorest.ByUnmarshallingJSON(&result), 1382 autorest.ByClosing()) 1383 result.Response = autorest.Response{Response: resp} 1384 return 1385} 1386 1387// ExportKey the export key operation is applicable to all key types. The target key must be marked exportable. This 1388// operation requires the keys/export permission. 1389// Parameters: 1390// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1391// keyName - the name of the key to get. 1392// keyVersion - adding the version parameter retrieves a specific version of a key. 1393// parameters - the parameters for the key export operation. 1394func (client BaseClient) ExportKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyExportParameters) (result KeyBundle, err error) { 1395 if tracing.IsEnabled() { 1396 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ExportKey") 1397 defer func() { 1398 sc := -1 1399 if result.Response.Response != nil { 1400 sc = result.Response.Response.StatusCode 1401 } 1402 tracing.EndSpan(ctx, sc, err) 1403 }() 1404 } 1405 if err := validation.Validate([]validation.Validation{ 1406 {TargetValue: parameters, 1407 Constraints: []validation.Constraint{{Target: "parameters.Environment", Name: validation.Null, Rule: true, 1408 Chain: []validation.Constraint{{Target: "parameters.Environment", Name: validation.MinLength, Rule: 1, Chain: nil}}}}}}); err != nil { 1409 return result, validation.NewError("keyvault.BaseClient", "ExportKey", err.Error()) 1410 } 1411 1412 req, err := client.ExportKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 1413 if err != nil { 1414 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ExportKey", nil, "Failure preparing request") 1415 return 1416 } 1417 1418 resp, err := client.ExportKeySender(req) 1419 if err != nil { 1420 result.Response = autorest.Response{Response: resp} 1421 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ExportKey", resp, "Failure sending request") 1422 return 1423 } 1424 1425 result, err = client.ExportKeyResponder(resp) 1426 if err != nil { 1427 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ExportKey", resp, "Failure responding to request") 1428 return 1429 } 1430 1431 return 1432} 1433 1434// ExportKeyPreparer prepares the ExportKey request. 1435func (client BaseClient) ExportKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyExportParameters) (*http.Request, error) { 1436 urlParameters := map[string]interface{}{ 1437 "vaultBaseUrl": vaultBaseURL, 1438 } 1439 1440 pathParameters := map[string]interface{}{ 1441 "key-name": autorest.Encode("path", keyName), 1442 "key-version": autorest.Encode("path", keyVersion), 1443 } 1444 1445 const APIVersion = "7.2-preview" 1446 queryParameters := map[string]interface{}{ 1447 "api-version": APIVersion, 1448 } 1449 1450 preparer := autorest.CreatePreparer( 1451 autorest.AsContentType("application/json; charset=utf-8"), 1452 autorest.AsPost(), 1453 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1454 autorest.WithPathParameters("/keys/{key-name}/{key-version}/export", pathParameters), 1455 autorest.WithJSON(parameters), 1456 autorest.WithQueryParameters(queryParameters)) 1457 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1458} 1459 1460// ExportKeySender sends the ExportKey request. The method will close the 1461// http.Response Body if it receives an error. 1462func (client BaseClient) ExportKeySender(req *http.Request) (*http.Response, error) { 1463 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1464} 1465 1466// ExportKeyResponder handles the response to the ExportKey request. The method always 1467// closes the http.Response Body. 1468func (client BaseClient) ExportKeyResponder(resp *http.Response) (result KeyBundle, err error) { 1469 err = autorest.Respond( 1470 resp, 1471 azure.WithErrorUnlessStatusCode(http.StatusOK), 1472 autorest.ByUnmarshallingJSON(&result), 1473 autorest.ByClosing()) 1474 result.Response = autorest.Response{Response: resp} 1475 return 1476} 1477 1478// FullBackup creates a full backup using a user-provided SAS token to an Azure blob storage container. 1479// Parameters: 1480// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1481// azureStorageBlobContainerURI - azure blob shared access signature token pointing to a valid Azure blob 1482// container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from 1483// the time of making this call 1484func (client BaseClient) FullBackup(ctx context.Context, vaultBaseURL string, azureStorageBlobContainerURI *SASTokenParameter) (result FullBackupFuture, err error) { 1485 if tracing.IsEnabled() { 1486 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.FullBackup") 1487 defer func() { 1488 sc := -1 1489 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1490 sc = result.FutureAPI.Response().StatusCode 1491 } 1492 tracing.EndSpan(ctx, sc, err) 1493 }() 1494 } 1495 if err := validation.Validate([]validation.Validation{ 1496 {TargetValue: azureStorageBlobContainerURI, 1497 Constraints: []validation.Constraint{{Target: "azureStorageBlobContainerURI", Name: validation.Null, Rule: false, 1498 Chain: []validation.Constraint{{Target: "azureStorageBlobContainerURI.StorageResourceURI", Name: validation.Null, Rule: true, Chain: nil}, 1499 {Target: "azureStorageBlobContainerURI.Token", Name: validation.Null, Rule: true, Chain: nil}, 1500 }}}}}); err != nil { 1501 return result, validation.NewError("keyvault.BaseClient", "FullBackup", err.Error()) 1502 } 1503 1504 req, err := client.FullBackupPreparer(ctx, vaultBaseURL, azureStorageBlobContainerURI) 1505 if err != nil { 1506 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullBackup", nil, "Failure preparing request") 1507 return 1508 } 1509 1510 result, err = client.FullBackupSender(req) 1511 if err != nil { 1512 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullBackup", nil, "Failure sending request") 1513 return 1514 } 1515 1516 return 1517} 1518 1519// FullBackupPreparer prepares the FullBackup request. 1520func (client BaseClient) FullBackupPreparer(ctx context.Context, vaultBaseURL string, azureStorageBlobContainerURI *SASTokenParameter) (*http.Request, error) { 1521 urlParameters := map[string]interface{}{ 1522 "vaultBaseUrl": vaultBaseURL, 1523 } 1524 1525 const APIVersion = "7.2-preview" 1526 queryParameters := map[string]interface{}{ 1527 "api-version": APIVersion, 1528 } 1529 1530 preparer := autorest.CreatePreparer( 1531 autorest.AsContentType("application/json; charset=utf-8"), 1532 autorest.AsPost(), 1533 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1534 autorest.WithPath("/backup"), 1535 autorest.WithQueryParameters(queryParameters)) 1536 if azureStorageBlobContainerURI != nil { 1537 preparer = autorest.DecoratePreparer(preparer, 1538 autorest.WithJSON(azureStorageBlobContainerURI)) 1539 } 1540 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1541} 1542 1543// FullBackupSender sends the FullBackup request. The method will close the 1544// http.Response Body if it receives an error. 1545func (client BaseClient) FullBackupSender(req *http.Request) (future FullBackupFuture, err error) { 1546 var resp *http.Response 1547 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1548 if err != nil { 1549 return 1550 } 1551 var azf azure.Future 1552 azf, err = azure.NewFutureFromResponse(resp) 1553 future.FutureAPI = &azf 1554 future.Result = func(client BaseClient) (fbo FullBackupOperation, err error) { 1555 var done bool 1556 done, err = future.DoneWithContext(context.Background(), client) 1557 if err != nil { 1558 err = autorest.NewErrorWithError(err, "keyvault.FullBackupFuture", "Result", future.Response(), "Polling failure") 1559 return 1560 } 1561 if !done { 1562 err = azure.NewAsyncOpIncompleteError("keyvault.FullBackupFuture") 1563 return 1564 } 1565 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1566 fbo.Response.Response, err = future.GetResult(sender) 1567 if fbo.Response.Response == nil && err == nil { 1568 err = autorest.NewErrorWithError(err, "keyvault.FullBackupFuture", "Result", nil, "received nil response and error") 1569 } 1570 if err == nil && fbo.Response.Response.StatusCode != http.StatusNoContent { 1571 fbo, err = client.FullBackupResponder(fbo.Response.Response) 1572 if err != nil { 1573 err = autorest.NewErrorWithError(err, "keyvault.FullBackupFuture", "Result", fbo.Response.Response, "Failure responding to request") 1574 } 1575 } 1576 return 1577 } 1578 return 1579} 1580 1581// FullBackupResponder handles the response to the FullBackup request. The method always 1582// closes the http.Response Body. 1583func (client BaseClient) FullBackupResponder(resp *http.Response) (result FullBackupOperation, err error) { 1584 err = autorest.Respond( 1585 resp, 1586 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1587 autorest.ByUnmarshallingJSON(&result), 1588 autorest.ByClosing()) 1589 result.Response = autorest.Response{Response: resp} 1590 return 1591} 1592 1593// FullBackupStatus returns the status of full backup operation 1594// Parameters: 1595// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1596// jobID - the id returned as part of the backup request 1597func (client BaseClient) FullBackupStatus(ctx context.Context, vaultBaseURL string, jobID string) (result FullBackupOperation, err error) { 1598 if tracing.IsEnabled() { 1599 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.FullBackupStatus") 1600 defer func() { 1601 sc := -1 1602 if result.Response.Response != nil { 1603 sc = result.Response.Response.StatusCode 1604 } 1605 tracing.EndSpan(ctx, sc, err) 1606 }() 1607 } 1608 req, err := client.FullBackupStatusPreparer(ctx, vaultBaseURL, jobID) 1609 if err != nil { 1610 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullBackupStatus", nil, "Failure preparing request") 1611 return 1612 } 1613 1614 resp, err := client.FullBackupStatusSender(req) 1615 if err != nil { 1616 result.Response = autorest.Response{Response: resp} 1617 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullBackupStatus", resp, "Failure sending request") 1618 return 1619 } 1620 1621 result, err = client.FullBackupStatusResponder(resp) 1622 if err != nil { 1623 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullBackupStatus", resp, "Failure responding to request") 1624 return 1625 } 1626 1627 return 1628} 1629 1630// FullBackupStatusPreparer prepares the FullBackupStatus request. 1631func (client BaseClient) FullBackupStatusPreparer(ctx context.Context, vaultBaseURL string, jobID string) (*http.Request, error) { 1632 urlParameters := map[string]interface{}{ 1633 "vaultBaseUrl": vaultBaseURL, 1634 } 1635 1636 pathParameters := map[string]interface{}{ 1637 "jobId": autorest.Encode("path", jobID), 1638 } 1639 1640 const APIVersion = "7.2-preview" 1641 queryParameters := map[string]interface{}{ 1642 "api-version": APIVersion, 1643 } 1644 1645 preparer := autorest.CreatePreparer( 1646 autorest.AsGet(), 1647 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1648 autorest.WithPathParameters("/backup/{jobId}/pending", pathParameters), 1649 autorest.WithQueryParameters(queryParameters)) 1650 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1651} 1652 1653// FullBackupStatusSender sends the FullBackupStatus request. The method will close the 1654// http.Response Body if it receives an error. 1655func (client BaseClient) FullBackupStatusSender(req *http.Request) (*http.Response, error) { 1656 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1657} 1658 1659// FullBackupStatusResponder handles the response to the FullBackupStatus request. The method always 1660// closes the http.Response Body. 1661func (client BaseClient) FullBackupStatusResponder(resp *http.Response) (result FullBackupOperation, err error) { 1662 err = autorest.Respond( 1663 resp, 1664 azure.WithErrorUnlessStatusCode(http.StatusOK), 1665 autorest.ByUnmarshallingJSON(&result), 1666 autorest.ByClosing()) 1667 result.Response = autorest.Response{Response: resp} 1668 return 1669} 1670 1671// FullRestoreOperation restores all key materials using the SAS token pointing to a previously stored Azure Blob 1672// storage backup folder 1673// Parameters: 1674// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1675// restoreBlobDetails - the Azure blob SAS token pointing to a folder where the previous successful full backup 1676// was stored 1677func (client BaseClient) FullRestoreOperation(ctx context.Context, vaultBaseURL string, restoreBlobDetails *RestoreOperationParameters) (result FullRestoreOperationFuture, err error) { 1678 if tracing.IsEnabled() { 1679 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.FullRestoreOperation") 1680 defer func() { 1681 sc := -1 1682 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1683 sc = result.FutureAPI.Response().StatusCode 1684 } 1685 tracing.EndSpan(ctx, sc, err) 1686 }() 1687 } 1688 if err := validation.Validate([]validation.Validation{ 1689 {TargetValue: restoreBlobDetails, 1690 Constraints: []validation.Constraint{{Target: "restoreBlobDetails", Name: validation.Null, Rule: false, 1691 Chain: []validation.Constraint{{Target: "restoreBlobDetails.SasTokenParameters", Name: validation.Null, Rule: true, 1692 Chain: []validation.Constraint{{Target: "restoreBlobDetails.SasTokenParameters.StorageResourceURI", Name: validation.Null, Rule: true, Chain: nil}, 1693 {Target: "restoreBlobDetails.SasTokenParameters.Token", Name: validation.Null, Rule: true, Chain: nil}, 1694 }}, 1695 {Target: "restoreBlobDetails.FolderToRestore", Name: validation.Null, Rule: true, Chain: nil}, 1696 }}}}}); err != nil { 1697 return result, validation.NewError("keyvault.BaseClient", "FullRestoreOperation", err.Error()) 1698 } 1699 1700 req, err := client.FullRestoreOperationPreparer(ctx, vaultBaseURL, restoreBlobDetails) 1701 if err != nil { 1702 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullRestoreOperation", nil, "Failure preparing request") 1703 return 1704 } 1705 1706 result, err = client.FullRestoreOperationSender(req) 1707 if err != nil { 1708 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "FullRestoreOperation", nil, "Failure sending request") 1709 return 1710 } 1711 1712 return 1713} 1714 1715// FullRestoreOperationPreparer prepares the FullRestoreOperation request. 1716func (client BaseClient) FullRestoreOperationPreparer(ctx context.Context, vaultBaseURL string, restoreBlobDetails *RestoreOperationParameters) (*http.Request, error) { 1717 urlParameters := map[string]interface{}{ 1718 "vaultBaseUrl": vaultBaseURL, 1719 } 1720 1721 const APIVersion = "7.2-preview" 1722 queryParameters := map[string]interface{}{ 1723 "api-version": APIVersion, 1724 } 1725 1726 preparer := autorest.CreatePreparer( 1727 autorest.AsContentType("application/json; charset=utf-8"), 1728 autorest.AsPut(), 1729 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1730 autorest.WithPath("/restore"), 1731 autorest.WithQueryParameters(queryParameters)) 1732 if restoreBlobDetails != nil { 1733 preparer = autorest.DecoratePreparer(preparer, 1734 autorest.WithJSON(restoreBlobDetails)) 1735 } 1736 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1737} 1738 1739// FullRestoreOperationSender sends the FullRestoreOperation request. The method will close the 1740// http.Response Body if it receives an error. 1741func (client BaseClient) FullRestoreOperationSender(req *http.Request) (future FullRestoreOperationFuture, err error) { 1742 var resp *http.Response 1743 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1744 if err != nil { 1745 return 1746 } 1747 var azf azure.Future 1748 azf, err = azure.NewFutureFromResponse(resp) 1749 future.FutureAPI = &azf 1750 future.Result = func(client BaseClient) (ro RestoreOperation, err error) { 1751 var done bool 1752 done, err = future.DoneWithContext(context.Background(), client) 1753 if err != nil { 1754 err = autorest.NewErrorWithError(err, "keyvault.FullRestoreOperationFuture", "Result", future.Response(), "Polling failure") 1755 return 1756 } 1757 if !done { 1758 err = azure.NewAsyncOpIncompleteError("keyvault.FullRestoreOperationFuture") 1759 return 1760 } 1761 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1762 ro.Response.Response, err = future.GetResult(sender) 1763 if ro.Response.Response == nil && err == nil { 1764 err = autorest.NewErrorWithError(err, "keyvault.FullRestoreOperationFuture", "Result", nil, "received nil response and error") 1765 } 1766 if err == nil && ro.Response.Response.StatusCode != http.StatusNoContent { 1767 ro, err = client.FullRestoreOperationResponder(ro.Response.Response) 1768 if err != nil { 1769 err = autorest.NewErrorWithError(err, "keyvault.FullRestoreOperationFuture", "Result", ro.Response.Response, "Failure responding to request") 1770 } 1771 } 1772 return 1773 } 1774 return 1775} 1776 1777// FullRestoreOperationResponder handles the response to the FullRestoreOperation request. The method always 1778// closes the http.Response Body. 1779func (client BaseClient) FullRestoreOperationResponder(resp *http.Response) (result RestoreOperation, err error) { 1780 err = autorest.Respond( 1781 resp, 1782 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1783 autorest.ByUnmarshallingJSON(&result), 1784 autorest.ByClosing()) 1785 result.Response = autorest.Response{Response: resp} 1786 return 1787} 1788 1789// GetCertificate gets information about a specific certificate. This operation requires the certificates/get 1790// permission. 1791// Parameters: 1792// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1793// certificateName - the name of the certificate in the given vault. 1794// certificateVersion - the version of the certificate. This URI fragment is optional. If not specified, the 1795// latest version of the certificate is returned. 1796func (client BaseClient) GetCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) { 1797 if tracing.IsEnabled() { 1798 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificate") 1799 defer func() { 1800 sc := -1 1801 if result.Response.Response != nil { 1802 sc = result.Response.Response.StatusCode 1803 } 1804 tracing.EndSpan(ctx, sc, err) 1805 }() 1806 } 1807 req, err := client.GetCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion) 1808 if err != nil { 1809 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", nil, "Failure preparing request") 1810 return 1811 } 1812 1813 resp, err := client.GetCertificateSender(req) 1814 if err != nil { 1815 result.Response = autorest.Response{Response: resp} 1816 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure sending request") 1817 return 1818 } 1819 1820 result, err = client.GetCertificateResponder(resp) 1821 if err != nil { 1822 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificate", resp, "Failure responding to request") 1823 return 1824 } 1825 1826 return 1827} 1828 1829// GetCertificatePreparer prepares the GetCertificate request. 1830func (client BaseClient) GetCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string) (*http.Request, error) { 1831 urlParameters := map[string]interface{}{ 1832 "vaultBaseUrl": vaultBaseURL, 1833 } 1834 1835 pathParameters := map[string]interface{}{ 1836 "certificate-name": autorest.Encode("path", certificateName), 1837 "certificate-version": autorest.Encode("path", certificateVersion), 1838 } 1839 1840 const APIVersion = "7.2-preview" 1841 queryParameters := map[string]interface{}{ 1842 "api-version": APIVersion, 1843 } 1844 1845 preparer := autorest.CreatePreparer( 1846 autorest.AsGet(), 1847 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1848 autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), 1849 autorest.WithQueryParameters(queryParameters)) 1850 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1851} 1852 1853// GetCertificateSender sends the GetCertificate request. The method will close the 1854// http.Response Body if it receives an error. 1855func (client BaseClient) GetCertificateSender(req *http.Request) (*http.Response, error) { 1856 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1857} 1858 1859// GetCertificateResponder handles the response to the GetCertificate request. The method always 1860// closes the http.Response Body. 1861func (client BaseClient) GetCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 1862 err = autorest.Respond( 1863 resp, 1864 azure.WithErrorUnlessStatusCode(http.StatusOK), 1865 autorest.ByUnmarshallingJSON(&result), 1866 autorest.ByClosing()) 1867 result.Response = autorest.Response{Response: resp} 1868 return 1869} 1870 1871// GetCertificateContacts the GetCertificateContacts operation returns the set of certificate contact resources in the 1872// specified key vault. This operation requires the certificates/managecontacts permission. 1873// Parameters: 1874// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1875func (client BaseClient) GetCertificateContacts(ctx context.Context, vaultBaseURL string) (result Contacts, err error) { 1876 if tracing.IsEnabled() { 1877 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateContacts") 1878 defer func() { 1879 sc := -1 1880 if result.Response.Response != nil { 1881 sc = result.Response.Response.StatusCode 1882 } 1883 tracing.EndSpan(ctx, sc, err) 1884 }() 1885 } 1886 req, err := client.GetCertificateContactsPreparer(ctx, vaultBaseURL) 1887 if err != nil { 1888 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", nil, "Failure preparing request") 1889 return 1890 } 1891 1892 resp, err := client.GetCertificateContactsSender(req) 1893 if err != nil { 1894 result.Response = autorest.Response{Response: resp} 1895 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure sending request") 1896 return 1897 } 1898 1899 result, err = client.GetCertificateContactsResponder(resp) 1900 if err != nil { 1901 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateContacts", resp, "Failure responding to request") 1902 return 1903 } 1904 1905 return 1906} 1907 1908// GetCertificateContactsPreparer prepares the GetCertificateContacts request. 1909func (client BaseClient) GetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string) (*http.Request, error) { 1910 urlParameters := map[string]interface{}{ 1911 "vaultBaseUrl": vaultBaseURL, 1912 } 1913 1914 const APIVersion = "7.2-preview" 1915 queryParameters := map[string]interface{}{ 1916 "api-version": APIVersion, 1917 } 1918 1919 preparer := autorest.CreatePreparer( 1920 autorest.AsGet(), 1921 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 1922 autorest.WithPath("/certificates/contacts"), 1923 autorest.WithQueryParameters(queryParameters)) 1924 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1925} 1926 1927// GetCertificateContactsSender sends the GetCertificateContacts request. The method will close the 1928// http.Response Body if it receives an error. 1929func (client BaseClient) GetCertificateContactsSender(req *http.Request) (*http.Response, error) { 1930 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1931} 1932 1933// GetCertificateContactsResponder handles the response to the GetCertificateContacts request. The method always 1934// closes the http.Response Body. 1935func (client BaseClient) GetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { 1936 err = autorest.Respond( 1937 resp, 1938 azure.WithErrorUnlessStatusCode(http.StatusOK), 1939 autorest.ByUnmarshallingJSON(&result), 1940 autorest.ByClosing()) 1941 result.Response = autorest.Response{Response: resp} 1942 return 1943} 1944 1945// GetCertificateIssuer the GetCertificateIssuer operation returns the specified certificate issuer resources in the 1946// specified key vault. This operation requires the certificates/manageissuers/getissuers permission. 1947// Parameters: 1948// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 1949// issuerName - the name of the issuer. 1950func (client BaseClient) GetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { 1951 if tracing.IsEnabled() { 1952 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuer") 1953 defer func() { 1954 sc := -1 1955 if result.Response.Response != nil { 1956 sc = result.Response.Response.StatusCode 1957 } 1958 tracing.EndSpan(ctx, sc, err) 1959 }() 1960 } 1961 req, err := client.GetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName) 1962 if err != nil { 1963 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", nil, "Failure preparing request") 1964 return 1965 } 1966 1967 resp, err := client.GetCertificateIssuerSender(req) 1968 if err != nil { 1969 result.Response = autorest.Response{Response: resp} 1970 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure sending request") 1971 return 1972 } 1973 1974 result, err = client.GetCertificateIssuerResponder(resp) 1975 if err != nil { 1976 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuer", resp, "Failure responding to request") 1977 return 1978 } 1979 1980 return 1981} 1982 1983// GetCertificateIssuerPreparer prepares the GetCertificateIssuer request. 1984func (client BaseClient) GetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string) (*http.Request, error) { 1985 urlParameters := map[string]interface{}{ 1986 "vaultBaseUrl": vaultBaseURL, 1987 } 1988 1989 pathParameters := map[string]interface{}{ 1990 "issuer-name": autorest.Encode("path", issuerName), 1991 } 1992 1993 const APIVersion = "7.2-preview" 1994 queryParameters := map[string]interface{}{ 1995 "api-version": APIVersion, 1996 } 1997 1998 preparer := autorest.CreatePreparer( 1999 autorest.AsGet(), 2000 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2001 autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), 2002 autorest.WithQueryParameters(queryParameters)) 2003 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2004} 2005 2006// GetCertificateIssuerSender sends the GetCertificateIssuer request. The method will close the 2007// http.Response Body if it receives an error. 2008func (client BaseClient) GetCertificateIssuerSender(req *http.Request) (*http.Response, error) { 2009 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2010} 2011 2012// GetCertificateIssuerResponder handles the response to the GetCertificateIssuer request. The method always 2013// closes the http.Response Body. 2014func (client BaseClient) GetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { 2015 err = autorest.Respond( 2016 resp, 2017 azure.WithErrorUnlessStatusCode(http.StatusOK), 2018 autorest.ByUnmarshallingJSON(&result), 2019 autorest.ByClosing()) 2020 result.Response = autorest.Response{Response: resp} 2021 return 2022} 2023 2024// GetCertificateIssuers the GetCertificateIssuers operation returns the set of certificate issuer resources in the 2025// specified key vault. This operation requires the certificates/manageissuers/getissuers permission. 2026// Parameters: 2027// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2028// maxresults - maximum number of results to return in a page. If not specified the service will return up to 2029// 25 results. 2030func (client BaseClient) GetCertificateIssuers(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultPage, err error) { 2031 if tracing.IsEnabled() { 2032 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuers") 2033 defer func() { 2034 sc := -1 2035 if result.cilr.Response.Response != nil { 2036 sc = result.cilr.Response.Response.StatusCode 2037 } 2038 tracing.EndSpan(ctx, sc, err) 2039 }() 2040 } 2041 if err := validation.Validate([]validation.Validation{ 2042 {TargetValue: maxresults, 2043 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 2044 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 2045 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 2046 }}}}}); err != nil { 2047 return result, validation.NewError("keyvault.BaseClient", "GetCertificateIssuers", err.Error()) 2048 } 2049 2050 result.fn = client.getCertificateIssuersNextResults 2051 req, err := client.GetCertificateIssuersPreparer(ctx, vaultBaseURL, maxresults) 2052 if err != nil { 2053 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", nil, "Failure preparing request") 2054 return 2055 } 2056 2057 resp, err := client.GetCertificateIssuersSender(req) 2058 if err != nil { 2059 result.cilr.Response = autorest.Response{Response: resp} 2060 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure sending request") 2061 return 2062 } 2063 2064 result.cilr, err = client.GetCertificateIssuersResponder(resp) 2065 if err != nil { 2066 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateIssuers", resp, "Failure responding to request") 2067 return 2068 } 2069 if result.cilr.hasNextLink() && result.cilr.IsEmpty() { 2070 err = result.NextWithContext(ctx) 2071 return 2072 } 2073 2074 return 2075} 2076 2077// GetCertificateIssuersPreparer prepares the GetCertificateIssuers request. 2078func (client BaseClient) GetCertificateIssuersPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 2079 urlParameters := map[string]interface{}{ 2080 "vaultBaseUrl": vaultBaseURL, 2081 } 2082 2083 const APIVersion = "7.2-preview" 2084 queryParameters := map[string]interface{}{ 2085 "api-version": APIVersion, 2086 } 2087 if maxresults != nil { 2088 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 2089 } 2090 2091 preparer := autorest.CreatePreparer( 2092 autorest.AsGet(), 2093 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2094 autorest.WithPath("/certificates/issuers"), 2095 autorest.WithQueryParameters(queryParameters)) 2096 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2097} 2098 2099// GetCertificateIssuersSender sends the GetCertificateIssuers request. The method will close the 2100// http.Response Body if it receives an error. 2101func (client BaseClient) GetCertificateIssuersSender(req *http.Request) (*http.Response, error) { 2102 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2103} 2104 2105// GetCertificateIssuersResponder handles the response to the GetCertificateIssuers request. The method always 2106// closes the http.Response Body. 2107func (client BaseClient) GetCertificateIssuersResponder(resp *http.Response) (result CertificateIssuerListResult, err error) { 2108 err = autorest.Respond( 2109 resp, 2110 azure.WithErrorUnlessStatusCode(http.StatusOK), 2111 autorest.ByUnmarshallingJSON(&result), 2112 autorest.ByClosing()) 2113 result.Response = autorest.Response{Response: resp} 2114 return 2115} 2116 2117// getCertificateIssuersNextResults retrieves the next set of results, if any. 2118func (client BaseClient) getCertificateIssuersNextResults(ctx context.Context, lastResults CertificateIssuerListResult) (result CertificateIssuerListResult, err error) { 2119 req, err := lastResults.certificateIssuerListResultPreparer(ctx) 2120 if err != nil { 2121 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", nil, "Failure preparing next results request") 2122 } 2123 if req == nil { 2124 return 2125 } 2126 resp, err := client.GetCertificateIssuersSender(req) 2127 if err != nil { 2128 result.Response = autorest.Response{Response: resp} 2129 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure sending next results request") 2130 } 2131 result, err = client.GetCertificateIssuersResponder(resp) 2132 if err != nil { 2133 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateIssuersNextResults", resp, "Failure responding to next results request") 2134 } 2135 return 2136} 2137 2138// GetCertificateIssuersComplete enumerates all values, automatically crossing page boundaries as required. 2139func (client BaseClient) GetCertificateIssuersComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResultIterator, err error) { 2140 if tracing.IsEnabled() { 2141 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateIssuers") 2142 defer func() { 2143 sc := -1 2144 if result.Response().Response.Response != nil { 2145 sc = result.page.Response().Response.Response.StatusCode 2146 } 2147 tracing.EndSpan(ctx, sc, err) 2148 }() 2149 } 2150 result.page, err = client.GetCertificateIssuers(ctx, vaultBaseURL, maxresults) 2151 return 2152} 2153 2154// GetCertificateOperation gets the creation operation associated with a specified certificate. This operation requires 2155// the certificates/get permission. 2156// Parameters: 2157// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2158// certificateName - the name of the certificate. 2159func (client BaseClient) GetCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { 2160 if tracing.IsEnabled() { 2161 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateOperation") 2162 defer func() { 2163 sc := -1 2164 if result.Response.Response != nil { 2165 sc = result.Response.Response.StatusCode 2166 } 2167 tracing.EndSpan(ctx, sc, err) 2168 }() 2169 } 2170 req, err := client.GetCertificateOperationPreparer(ctx, vaultBaseURL, certificateName) 2171 if err != nil { 2172 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", nil, "Failure preparing request") 2173 return 2174 } 2175 2176 resp, err := client.GetCertificateOperationSender(req) 2177 if err != nil { 2178 result.Response = autorest.Response{Response: resp} 2179 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure sending request") 2180 return 2181 } 2182 2183 result, err = client.GetCertificateOperationResponder(resp) 2184 if err != nil { 2185 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateOperation", resp, "Failure responding to request") 2186 return 2187 } 2188 2189 return 2190} 2191 2192// GetCertificateOperationPreparer prepares the GetCertificateOperation request. 2193func (client BaseClient) GetCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 2194 urlParameters := map[string]interface{}{ 2195 "vaultBaseUrl": vaultBaseURL, 2196 } 2197 2198 pathParameters := map[string]interface{}{ 2199 "certificate-name": autorest.Encode("path", certificateName), 2200 } 2201 2202 const APIVersion = "7.2-preview" 2203 queryParameters := map[string]interface{}{ 2204 "api-version": APIVersion, 2205 } 2206 2207 preparer := autorest.CreatePreparer( 2208 autorest.AsGet(), 2209 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2210 autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), 2211 autorest.WithQueryParameters(queryParameters)) 2212 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2213} 2214 2215// GetCertificateOperationSender sends the GetCertificateOperation request. The method will close the 2216// http.Response Body if it receives an error. 2217func (client BaseClient) GetCertificateOperationSender(req *http.Request) (*http.Response, error) { 2218 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2219} 2220 2221// GetCertificateOperationResponder handles the response to the GetCertificateOperation request. The method always 2222// closes the http.Response Body. 2223func (client BaseClient) GetCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { 2224 err = autorest.Respond( 2225 resp, 2226 azure.WithErrorUnlessStatusCode(http.StatusOK), 2227 autorest.ByUnmarshallingJSON(&result), 2228 autorest.ByClosing()) 2229 result.Response = autorest.Response{Response: resp} 2230 return 2231} 2232 2233// GetCertificatePolicy the GetCertificatePolicy operation returns the specified certificate policy resources in the 2234// specified key vault. This operation requires the certificates/get permission. 2235// Parameters: 2236// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2237// certificateName - the name of the certificate in a given key vault. 2238func (client BaseClient) GetCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificatePolicy, err error) { 2239 if tracing.IsEnabled() { 2240 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificatePolicy") 2241 defer func() { 2242 sc := -1 2243 if result.Response.Response != nil { 2244 sc = result.Response.Response.StatusCode 2245 } 2246 tracing.EndSpan(ctx, sc, err) 2247 }() 2248 } 2249 req, err := client.GetCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName) 2250 if err != nil { 2251 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", nil, "Failure preparing request") 2252 return 2253 } 2254 2255 resp, err := client.GetCertificatePolicySender(req) 2256 if err != nil { 2257 result.Response = autorest.Response{Response: resp} 2258 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure sending request") 2259 return 2260 } 2261 2262 result, err = client.GetCertificatePolicyResponder(resp) 2263 if err != nil { 2264 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificatePolicy", resp, "Failure responding to request") 2265 return 2266 } 2267 2268 return 2269} 2270 2271// GetCertificatePolicyPreparer prepares the GetCertificatePolicy request. 2272func (client BaseClient) GetCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 2273 urlParameters := map[string]interface{}{ 2274 "vaultBaseUrl": vaultBaseURL, 2275 } 2276 2277 pathParameters := map[string]interface{}{ 2278 "certificate-name": autorest.Encode("path", certificateName), 2279 } 2280 2281 const APIVersion = "7.2-preview" 2282 queryParameters := map[string]interface{}{ 2283 "api-version": APIVersion, 2284 } 2285 2286 preparer := autorest.CreatePreparer( 2287 autorest.AsGet(), 2288 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2289 autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), 2290 autorest.WithQueryParameters(queryParameters)) 2291 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2292} 2293 2294// GetCertificatePolicySender sends the GetCertificatePolicy request. The method will close the 2295// http.Response Body if it receives an error. 2296func (client BaseClient) GetCertificatePolicySender(req *http.Request) (*http.Response, error) { 2297 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2298} 2299 2300// GetCertificatePolicyResponder handles the response to the GetCertificatePolicy request. The method always 2301// closes the http.Response Body. 2302func (client BaseClient) GetCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { 2303 err = autorest.Respond( 2304 resp, 2305 azure.WithErrorUnlessStatusCode(http.StatusOK), 2306 autorest.ByUnmarshallingJSON(&result), 2307 autorest.ByClosing()) 2308 result.Response = autorest.Response{Response: resp} 2309 return 2310} 2311 2312// GetCertificates the GetCertificates operation returns the set of certificates resources in the specified key vault. 2313// This operation requires the certificates/list permission. 2314// Parameters: 2315// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2316// maxresults - maximum number of results to return in a page. If not specified the service will return up to 2317// 25 results. 2318// includePending - specifies whether to include certificates which are not completely provisioned. 2319func (client BaseClient) GetCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultPage, err error) { 2320 if tracing.IsEnabled() { 2321 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificates") 2322 defer func() { 2323 sc := -1 2324 if result.clr.Response.Response != nil { 2325 sc = result.clr.Response.Response.StatusCode 2326 } 2327 tracing.EndSpan(ctx, sc, err) 2328 }() 2329 } 2330 if err := validation.Validate([]validation.Validation{ 2331 {TargetValue: maxresults, 2332 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 2333 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 2334 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 2335 }}}}}); err != nil { 2336 return result, validation.NewError("keyvault.BaseClient", "GetCertificates", err.Error()) 2337 } 2338 2339 result.fn = client.getCertificatesNextResults 2340 req, err := client.GetCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) 2341 if err != nil { 2342 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", nil, "Failure preparing request") 2343 return 2344 } 2345 2346 resp, err := client.GetCertificatesSender(req) 2347 if err != nil { 2348 result.clr.Response = autorest.Response{Response: resp} 2349 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure sending request") 2350 return 2351 } 2352 2353 result.clr, err = client.GetCertificatesResponder(resp) 2354 if err != nil { 2355 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificates", resp, "Failure responding to request") 2356 return 2357 } 2358 if result.clr.hasNextLink() && result.clr.IsEmpty() { 2359 err = result.NextWithContext(ctx) 2360 return 2361 } 2362 2363 return 2364} 2365 2366// GetCertificatesPreparer prepares the GetCertificates request. 2367func (client BaseClient) GetCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { 2368 urlParameters := map[string]interface{}{ 2369 "vaultBaseUrl": vaultBaseURL, 2370 } 2371 2372 const APIVersion = "7.2-preview" 2373 queryParameters := map[string]interface{}{ 2374 "api-version": APIVersion, 2375 } 2376 if maxresults != nil { 2377 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 2378 } 2379 if includePending != nil { 2380 queryParameters["includePending"] = autorest.Encode("query", *includePending) 2381 } 2382 2383 preparer := autorest.CreatePreparer( 2384 autorest.AsGet(), 2385 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2386 autorest.WithPath("/certificates"), 2387 autorest.WithQueryParameters(queryParameters)) 2388 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2389} 2390 2391// GetCertificatesSender sends the GetCertificates request. The method will close the 2392// http.Response Body if it receives an error. 2393func (client BaseClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { 2394 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2395} 2396 2397// GetCertificatesResponder handles the response to the GetCertificates request. The method always 2398// closes the http.Response Body. 2399func (client BaseClient) GetCertificatesResponder(resp *http.Response) (result CertificateListResult, err error) { 2400 err = autorest.Respond( 2401 resp, 2402 azure.WithErrorUnlessStatusCode(http.StatusOK), 2403 autorest.ByUnmarshallingJSON(&result), 2404 autorest.ByClosing()) 2405 result.Response = autorest.Response{Response: resp} 2406 return 2407} 2408 2409// getCertificatesNextResults retrieves the next set of results, if any. 2410func (client BaseClient) getCertificatesNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { 2411 req, err := lastResults.certificateListResultPreparer(ctx) 2412 if err != nil { 2413 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", nil, "Failure preparing next results request") 2414 } 2415 if req == nil { 2416 return 2417 } 2418 resp, err := client.GetCertificatesSender(req) 2419 if err != nil { 2420 result.Response = autorest.Response{Response: resp} 2421 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure sending next results request") 2422 } 2423 result, err = client.GetCertificatesResponder(resp) 2424 if err != nil { 2425 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificatesNextResults", resp, "Failure responding to next results request") 2426 } 2427 return 2428} 2429 2430// GetCertificatesComplete enumerates all values, automatically crossing page boundaries as required. 2431func (client BaseClient) GetCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result CertificateListResultIterator, err error) { 2432 if tracing.IsEnabled() { 2433 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificates") 2434 defer func() { 2435 sc := -1 2436 if result.Response().Response.Response != nil { 2437 sc = result.page.Response().Response.Response.StatusCode 2438 } 2439 tracing.EndSpan(ctx, sc, err) 2440 }() 2441 } 2442 result.page, err = client.GetCertificates(ctx, vaultBaseURL, maxresults, includePending) 2443 return 2444} 2445 2446// GetCertificateVersions the GetCertificateVersions operation returns the versions of a certificate in the specified 2447// key vault. This operation requires the certificates/list permission. 2448// Parameters: 2449// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2450// certificateName - the name of the certificate. 2451// maxresults - maximum number of results to return in a page. If not specified the service will return up to 2452// 25 results. 2453func (client BaseClient) GetCertificateVersions(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultPage, err error) { 2454 if tracing.IsEnabled() { 2455 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateVersions") 2456 defer func() { 2457 sc := -1 2458 if result.clr.Response.Response != nil { 2459 sc = result.clr.Response.Response.StatusCode 2460 } 2461 tracing.EndSpan(ctx, sc, err) 2462 }() 2463 } 2464 if err := validation.Validate([]validation.Validation{ 2465 {TargetValue: maxresults, 2466 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 2467 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 2468 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 2469 }}}}}); err != nil { 2470 return result, validation.NewError("keyvault.BaseClient", "GetCertificateVersions", err.Error()) 2471 } 2472 2473 result.fn = client.getCertificateVersionsNextResults 2474 req, err := client.GetCertificateVersionsPreparer(ctx, vaultBaseURL, certificateName, maxresults) 2475 if err != nil { 2476 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", nil, "Failure preparing request") 2477 return 2478 } 2479 2480 resp, err := client.GetCertificateVersionsSender(req) 2481 if err != nil { 2482 result.clr.Response = autorest.Response{Response: resp} 2483 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure sending request") 2484 return 2485 } 2486 2487 result.clr, err = client.GetCertificateVersionsResponder(resp) 2488 if err != nil { 2489 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetCertificateVersions", resp, "Failure responding to request") 2490 return 2491 } 2492 if result.clr.hasNextLink() && result.clr.IsEmpty() { 2493 err = result.NextWithContext(ctx) 2494 return 2495 } 2496 2497 return 2498} 2499 2500// GetCertificateVersionsPreparer prepares the GetCertificateVersions request. 2501func (client BaseClient) GetCertificateVersionsPreparer(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (*http.Request, error) { 2502 urlParameters := map[string]interface{}{ 2503 "vaultBaseUrl": vaultBaseURL, 2504 } 2505 2506 pathParameters := map[string]interface{}{ 2507 "certificate-name": autorest.Encode("path", certificateName), 2508 } 2509 2510 const APIVersion = "7.2-preview" 2511 queryParameters := map[string]interface{}{ 2512 "api-version": APIVersion, 2513 } 2514 if maxresults != nil { 2515 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 2516 } 2517 2518 preparer := autorest.CreatePreparer( 2519 autorest.AsGet(), 2520 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2521 autorest.WithPathParameters("/certificates/{certificate-name}/versions", pathParameters), 2522 autorest.WithQueryParameters(queryParameters)) 2523 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2524} 2525 2526// GetCertificateVersionsSender sends the GetCertificateVersions request. The method will close the 2527// http.Response Body if it receives an error. 2528func (client BaseClient) GetCertificateVersionsSender(req *http.Request) (*http.Response, error) { 2529 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2530} 2531 2532// GetCertificateVersionsResponder handles the response to the GetCertificateVersions request. The method always 2533// closes the http.Response Body. 2534func (client BaseClient) GetCertificateVersionsResponder(resp *http.Response) (result CertificateListResult, err error) { 2535 err = autorest.Respond( 2536 resp, 2537 azure.WithErrorUnlessStatusCode(http.StatusOK), 2538 autorest.ByUnmarshallingJSON(&result), 2539 autorest.ByClosing()) 2540 result.Response = autorest.Response{Response: resp} 2541 return 2542} 2543 2544// getCertificateVersionsNextResults retrieves the next set of results, if any. 2545func (client BaseClient) getCertificateVersionsNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { 2546 req, err := lastResults.certificateListResultPreparer(ctx) 2547 if err != nil { 2548 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", nil, "Failure preparing next results request") 2549 } 2550 if req == nil { 2551 return 2552 } 2553 resp, err := client.GetCertificateVersionsSender(req) 2554 if err != nil { 2555 result.Response = autorest.Response{Response: resp} 2556 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure sending next results request") 2557 } 2558 result, err = client.GetCertificateVersionsResponder(resp) 2559 if err != nil { 2560 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getCertificateVersionsNextResults", resp, "Failure responding to next results request") 2561 } 2562 return 2563} 2564 2565// GetCertificateVersionsComplete enumerates all values, automatically crossing page boundaries as required. 2566func (client BaseClient) GetCertificateVersionsComplete(ctx context.Context, vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResultIterator, err error) { 2567 if tracing.IsEnabled() { 2568 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCertificateVersions") 2569 defer func() { 2570 sc := -1 2571 if result.Response().Response.Response != nil { 2572 sc = result.page.Response().Response.Response.StatusCode 2573 } 2574 tracing.EndSpan(ctx, sc, err) 2575 }() 2576 } 2577 result.page, err = client.GetCertificateVersions(ctx, vaultBaseURL, certificateName, maxresults) 2578 return 2579} 2580 2581// GetDeletedCertificate the GetDeletedCertificate operation retrieves the deleted certificate information plus its 2582// attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This 2583// operation requires the certificates/get permission. 2584// Parameters: 2585// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2586// certificateName - the name of the certificate 2587func (client BaseClient) GetDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result DeletedCertificateBundle, err error) { 2588 if tracing.IsEnabled() { 2589 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificate") 2590 defer func() { 2591 sc := -1 2592 if result.Response.Response != nil { 2593 sc = result.Response.Response.StatusCode 2594 } 2595 tracing.EndSpan(ctx, sc, err) 2596 }() 2597 } 2598 req, err := client.GetDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) 2599 if err != nil { 2600 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", nil, "Failure preparing request") 2601 return 2602 } 2603 2604 resp, err := client.GetDeletedCertificateSender(req) 2605 if err != nil { 2606 result.Response = autorest.Response{Response: resp} 2607 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure sending request") 2608 return 2609 } 2610 2611 result, err = client.GetDeletedCertificateResponder(resp) 2612 if err != nil { 2613 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificate", resp, "Failure responding to request") 2614 return 2615 } 2616 2617 return 2618} 2619 2620// GetDeletedCertificatePreparer prepares the GetDeletedCertificate request. 2621func (client BaseClient) GetDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 2622 urlParameters := map[string]interface{}{ 2623 "vaultBaseUrl": vaultBaseURL, 2624 } 2625 2626 pathParameters := map[string]interface{}{ 2627 "certificate-name": autorest.Encode("path", certificateName), 2628 } 2629 2630 const APIVersion = "7.2-preview" 2631 queryParameters := map[string]interface{}{ 2632 "api-version": APIVersion, 2633 } 2634 2635 preparer := autorest.CreatePreparer( 2636 autorest.AsGet(), 2637 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2638 autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters), 2639 autorest.WithQueryParameters(queryParameters)) 2640 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2641} 2642 2643// GetDeletedCertificateSender sends the GetDeletedCertificate request. The method will close the 2644// http.Response Body if it receives an error. 2645func (client BaseClient) GetDeletedCertificateSender(req *http.Request) (*http.Response, error) { 2646 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2647} 2648 2649// GetDeletedCertificateResponder handles the response to the GetDeletedCertificate request. The method always 2650// closes the http.Response Body. 2651func (client BaseClient) GetDeletedCertificateResponder(resp *http.Response) (result DeletedCertificateBundle, err error) { 2652 err = autorest.Respond( 2653 resp, 2654 azure.WithErrorUnlessStatusCode(http.StatusOK), 2655 autorest.ByUnmarshallingJSON(&result), 2656 autorest.ByClosing()) 2657 result.Response = autorest.Response{Response: resp} 2658 return 2659} 2660 2661// GetDeletedCertificates the GetDeletedCertificates operation retrieves the certificates in the current vault which 2662// are in a deleted state and ready for recovery or purging. This operation includes deletion-specific information. 2663// This operation requires the certificates/get/list permission. This operation can only be enabled on soft-delete 2664// enabled vaults. 2665// Parameters: 2666// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2667// maxresults - maximum number of results to return in a page. If not specified the service will return up to 2668// 25 results. 2669// includePending - specifies whether to include certificates which are not completely provisioned. 2670func (client BaseClient) GetDeletedCertificates(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultPage, err error) { 2671 if tracing.IsEnabled() { 2672 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificates") 2673 defer func() { 2674 sc := -1 2675 if result.dclr.Response.Response != nil { 2676 sc = result.dclr.Response.Response.StatusCode 2677 } 2678 tracing.EndSpan(ctx, sc, err) 2679 }() 2680 } 2681 if err := validation.Validate([]validation.Validation{ 2682 {TargetValue: maxresults, 2683 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 2684 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 2685 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 2686 }}}}}); err != nil { 2687 return result, validation.NewError("keyvault.BaseClient", "GetDeletedCertificates", err.Error()) 2688 } 2689 2690 result.fn = client.getDeletedCertificatesNextResults 2691 req, err := client.GetDeletedCertificatesPreparer(ctx, vaultBaseURL, maxresults, includePending) 2692 if err != nil { 2693 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", nil, "Failure preparing request") 2694 return 2695 } 2696 2697 resp, err := client.GetDeletedCertificatesSender(req) 2698 if err != nil { 2699 result.dclr.Response = autorest.Response{Response: resp} 2700 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure sending request") 2701 return 2702 } 2703 2704 result.dclr, err = client.GetDeletedCertificatesResponder(resp) 2705 if err != nil { 2706 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedCertificates", resp, "Failure responding to request") 2707 return 2708 } 2709 if result.dclr.hasNextLink() && result.dclr.IsEmpty() { 2710 err = result.NextWithContext(ctx) 2711 return 2712 } 2713 2714 return 2715} 2716 2717// GetDeletedCertificatesPreparer prepares the GetDeletedCertificates request. 2718func (client BaseClient) GetDeletedCertificatesPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (*http.Request, error) { 2719 urlParameters := map[string]interface{}{ 2720 "vaultBaseUrl": vaultBaseURL, 2721 } 2722 2723 const APIVersion = "7.2-preview" 2724 queryParameters := map[string]interface{}{ 2725 "api-version": APIVersion, 2726 } 2727 if maxresults != nil { 2728 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 2729 } 2730 if includePending != nil { 2731 queryParameters["includePending"] = autorest.Encode("query", *includePending) 2732 } 2733 2734 preparer := autorest.CreatePreparer( 2735 autorest.AsGet(), 2736 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2737 autorest.WithPath("/deletedcertificates"), 2738 autorest.WithQueryParameters(queryParameters)) 2739 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2740} 2741 2742// GetDeletedCertificatesSender sends the GetDeletedCertificates request. The method will close the 2743// http.Response Body if it receives an error. 2744func (client BaseClient) GetDeletedCertificatesSender(req *http.Request) (*http.Response, error) { 2745 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2746} 2747 2748// GetDeletedCertificatesResponder handles the response to the GetDeletedCertificates request. The method always 2749// closes the http.Response Body. 2750func (client BaseClient) GetDeletedCertificatesResponder(resp *http.Response) (result DeletedCertificateListResult, err error) { 2751 err = autorest.Respond( 2752 resp, 2753 azure.WithErrorUnlessStatusCode(http.StatusOK), 2754 autorest.ByUnmarshallingJSON(&result), 2755 autorest.ByClosing()) 2756 result.Response = autorest.Response{Response: resp} 2757 return 2758} 2759 2760// getDeletedCertificatesNextResults retrieves the next set of results, if any. 2761func (client BaseClient) getDeletedCertificatesNextResults(ctx context.Context, lastResults DeletedCertificateListResult) (result DeletedCertificateListResult, err error) { 2762 req, err := lastResults.deletedCertificateListResultPreparer(ctx) 2763 if err != nil { 2764 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", nil, "Failure preparing next results request") 2765 } 2766 if req == nil { 2767 return 2768 } 2769 resp, err := client.GetDeletedCertificatesSender(req) 2770 if err != nil { 2771 result.Response = autorest.Response{Response: resp} 2772 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure sending next results request") 2773 } 2774 result, err = client.GetDeletedCertificatesResponder(resp) 2775 if err != nil { 2776 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedCertificatesNextResults", resp, "Failure responding to next results request") 2777 } 2778 return 2779} 2780 2781// GetDeletedCertificatesComplete enumerates all values, automatically crossing page boundaries as required. 2782func (client BaseClient) GetDeletedCertificatesComplete(ctx context.Context, vaultBaseURL string, maxresults *int32, includePending *bool) (result DeletedCertificateListResultIterator, err error) { 2783 if tracing.IsEnabled() { 2784 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedCertificates") 2785 defer func() { 2786 sc := -1 2787 if result.Response().Response.Response != nil { 2788 sc = result.page.Response().Response.Response.StatusCode 2789 } 2790 tracing.EndSpan(ctx, sc, err) 2791 }() 2792 } 2793 result.page, err = client.GetDeletedCertificates(ctx, vaultBaseURL, maxresults, includePending) 2794 return 2795} 2796 2797// GetDeletedKey the Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be 2798// invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires 2799// the keys/get permission. 2800// Parameters: 2801// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2802// keyName - the name of the key. 2803func (client BaseClient) GetDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result DeletedKeyBundle, err error) { 2804 if tracing.IsEnabled() { 2805 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKey") 2806 defer func() { 2807 sc := -1 2808 if result.Response.Response != nil { 2809 sc = result.Response.Response.StatusCode 2810 } 2811 tracing.EndSpan(ctx, sc, err) 2812 }() 2813 } 2814 req, err := client.GetDeletedKeyPreparer(ctx, vaultBaseURL, keyName) 2815 if err != nil { 2816 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", nil, "Failure preparing request") 2817 return 2818 } 2819 2820 resp, err := client.GetDeletedKeySender(req) 2821 if err != nil { 2822 result.Response = autorest.Response{Response: resp} 2823 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure sending request") 2824 return 2825 } 2826 2827 result, err = client.GetDeletedKeyResponder(resp) 2828 if err != nil { 2829 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKey", resp, "Failure responding to request") 2830 return 2831 } 2832 2833 return 2834} 2835 2836// GetDeletedKeyPreparer prepares the GetDeletedKey request. 2837func (client BaseClient) GetDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { 2838 urlParameters := map[string]interface{}{ 2839 "vaultBaseUrl": vaultBaseURL, 2840 } 2841 2842 pathParameters := map[string]interface{}{ 2843 "key-name": autorest.Encode("path", keyName), 2844 } 2845 2846 const APIVersion = "7.2-preview" 2847 queryParameters := map[string]interface{}{ 2848 "api-version": APIVersion, 2849 } 2850 2851 preparer := autorest.CreatePreparer( 2852 autorest.AsGet(), 2853 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2854 autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters), 2855 autorest.WithQueryParameters(queryParameters)) 2856 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2857} 2858 2859// GetDeletedKeySender sends the GetDeletedKey request. The method will close the 2860// http.Response Body if it receives an error. 2861func (client BaseClient) GetDeletedKeySender(req *http.Request) (*http.Response, error) { 2862 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2863} 2864 2865// GetDeletedKeyResponder handles the response to the GetDeletedKey request. The method always 2866// closes the http.Response Body. 2867func (client BaseClient) GetDeletedKeyResponder(resp *http.Response) (result DeletedKeyBundle, err error) { 2868 err = autorest.Respond( 2869 resp, 2870 azure.WithErrorUnlessStatusCode(http.StatusOK), 2871 autorest.ByUnmarshallingJSON(&result), 2872 autorest.ByClosing()) 2873 result.Response = autorest.Response{Response: resp} 2874 return 2875} 2876 2877// GetDeletedKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part 2878// of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is 2879// applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an 2880// error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission. 2881// Parameters: 2882// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 2883// maxresults - maximum number of results to return in a page. If not specified the service will return up to 2884// 25 results. 2885func (client BaseClient) GetDeletedKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultPage, err error) { 2886 if tracing.IsEnabled() { 2887 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKeys") 2888 defer func() { 2889 sc := -1 2890 if result.dklr.Response.Response != nil { 2891 sc = result.dklr.Response.Response.StatusCode 2892 } 2893 tracing.EndSpan(ctx, sc, err) 2894 }() 2895 } 2896 if err := validation.Validate([]validation.Validation{ 2897 {TargetValue: maxresults, 2898 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 2899 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 2900 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 2901 }}}}}); err != nil { 2902 return result, validation.NewError("keyvault.BaseClient", "GetDeletedKeys", err.Error()) 2903 } 2904 2905 result.fn = client.getDeletedKeysNextResults 2906 req, err := client.GetDeletedKeysPreparer(ctx, vaultBaseURL, maxresults) 2907 if err != nil { 2908 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", nil, "Failure preparing request") 2909 return 2910 } 2911 2912 resp, err := client.GetDeletedKeysSender(req) 2913 if err != nil { 2914 result.dklr.Response = autorest.Response{Response: resp} 2915 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure sending request") 2916 return 2917 } 2918 2919 result.dklr, err = client.GetDeletedKeysResponder(resp) 2920 if err != nil { 2921 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedKeys", resp, "Failure responding to request") 2922 return 2923 } 2924 if result.dklr.hasNextLink() && result.dklr.IsEmpty() { 2925 err = result.NextWithContext(ctx) 2926 return 2927 } 2928 2929 return 2930} 2931 2932// GetDeletedKeysPreparer prepares the GetDeletedKeys request. 2933func (client BaseClient) GetDeletedKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 2934 urlParameters := map[string]interface{}{ 2935 "vaultBaseUrl": vaultBaseURL, 2936 } 2937 2938 const APIVersion = "7.2-preview" 2939 queryParameters := map[string]interface{}{ 2940 "api-version": APIVersion, 2941 } 2942 if maxresults != nil { 2943 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 2944 } 2945 2946 preparer := autorest.CreatePreparer( 2947 autorest.AsGet(), 2948 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 2949 autorest.WithPath("/deletedkeys"), 2950 autorest.WithQueryParameters(queryParameters)) 2951 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 2952} 2953 2954// GetDeletedKeysSender sends the GetDeletedKeys request. The method will close the 2955// http.Response Body if it receives an error. 2956func (client BaseClient) GetDeletedKeysSender(req *http.Request) (*http.Response, error) { 2957 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2958} 2959 2960// GetDeletedKeysResponder handles the response to the GetDeletedKeys request. The method always 2961// closes the http.Response Body. 2962func (client BaseClient) GetDeletedKeysResponder(resp *http.Response) (result DeletedKeyListResult, err error) { 2963 err = autorest.Respond( 2964 resp, 2965 azure.WithErrorUnlessStatusCode(http.StatusOK), 2966 autorest.ByUnmarshallingJSON(&result), 2967 autorest.ByClosing()) 2968 result.Response = autorest.Response{Response: resp} 2969 return 2970} 2971 2972// getDeletedKeysNextResults retrieves the next set of results, if any. 2973func (client BaseClient) getDeletedKeysNextResults(ctx context.Context, lastResults DeletedKeyListResult) (result DeletedKeyListResult, err error) { 2974 req, err := lastResults.deletedKeyListResultPreparer(ctx) 2975 if err != nil { 2976 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", nil, "Failure preparing next results request") 2977 } 2978 if req == nil { 2979 return 2980 } 2981 resp, err := client.GetDeletedKeysSender(req) 2982 if err != nil { 2983 result.Response = autorest.Response{Response: resp} 2984 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure sending next results request") 2985 } 2986 result, err = client.GetDeletedKeysResponder(resp) 2987 if err != nil { 2988 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedKeysNextResults", resp, "Failure responding to next results request") 2989 } 2990 return 2991} 2992 2993// GetDeletedKeysComplete enumerates all values, automatically crossing page boundaries as required. 2994func (client BaseClient) GetDeletedKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedKeyListResultIterator, err error) { 2995 if tracing.IsEnabled() { 2996 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedKeys") 2997 defer func() { 2998 sc := -1 2999 if result.Response().Response.Response != nil { 3000 sc = result.page.Response().Response.Response.StatusCode 3001 } 3002 tracing.EndSpan(ctx, sc, err) 3003 }() 3004 } 3005 result.page, err = client.GetDeletedKeys(ctx, vaultBaseURL, maxresults) 3006 return 3007} 3008 3009// GetDeletedSasDefinition the Get Deleted SAS Definition operation returns the specified deleted SAS definition along 3010// with its attributes. This operation requires the storage/getsas permission. 3011// Parameters: 3012// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3013// storageAccountName - the name of the storage account. 3014// sasDefinitionName - the name of the SAS definition. 3015func (client BaseClient) GetDeletedSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result DeletedSasDefinitionBundle, err error) { 3016 if tracing.IsEnabled() { 3017 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSasDefinition") 3018 defer func() { 3019 sc := -1 3020 if result.Response.Response != nil { 3021 sc = result.Response.Response.StatusCode 3022 } 3023 tracing.EndSpan(ctx, sc, err) 3024 }() 3025 } 3026 if err := validation.Validate([]validation.Validation{ 3027 {TargetValue: storageAccountName, 3028 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 3029 {TargetValue: sasDefinitionName, 3030 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 3031 return result, validation.NewError("keyvault.BaseClient", "GetDeletedSasDefinition", err.Error()) 3032 } 3033 3034 req, err := client.GetDeletedSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) 3035 if err != nil { 3036 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", nil, "Failure preparing request") 3037 return 3038 } 3039 3040 resp, err := client.GetDeletedSasDefinitionSender(req) 3041 if err != nil { 3042 result.Response = autorest.Response{Response: resp} 3043 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", resp, "Failure sending request") 3044 return 3045 } 3046 3047 result, err = client.GetDeletedSasDefinitionResponder(resp) 3048 if err != nil { 3049 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinition", resp, "Failure responding to request") 3050 return 3051 } 3052 3053 return 3054} 3055 3056// GetDeletedSasDefinitionPreparer prepares the GetDeletedSasDefinition request. 3057func (client BaseClient) GetDeletedSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { 3058 urlParameters := map[string]interface{}{ 3059 "vaultBaseUrl": vaultBaseURL, 3060 } 3061 3062 pathParameters := map[string]interface{}{ 3063 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 3064 "storage-account-name": autorest.Encode("path", storageAccountName), 3065 } 3066 3067 const APIVersion = "7.2-preview" 3068 queryParameters := map[string]interface{}{ 3069 "api-version": APIVersion, 3070 } 3071 3072 preparer := autorest.CreatePreparer( 3073 autorest.AsGet(), 3074 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3075 autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), 3076 autorest.WithQueryParameters(queryParameters)) 3077 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3078} 3079 3080// GetDeletedSasDefinitionSender sends the GetDeletedSasDefinition request. The method will close the 3081// http.Response Body if it receives an error. 3082func (client BaseClient) GetDeletedSasDefinitionSender(req *http.Request) (*http.Response, error) { 3083 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3084} 3085 3086// GetDeletedSasDefinitionResponder handles the response to the GetDeletedSasDefinition request. The method always 3087// closes the http.Response Body. 3088func (client BaseClient) GetDeletedSasDefinitionResponder(resp *http.Response) (result DeletedSasDefinitionBundle, err error) { 3089 err = autorest.Respond( 3090 resp, 3091 azure.WithErrorUnlessStatusCode(http.StatusOK), 3092 autorest.ByUnmarshallingJSON(&result), 3093 autorest.ByClosing()) 3094 result.Response = autorest.Response{Response: resp} 3095 return 3096} 3097 3098// GetDeletedSasDefinitions the Get Deleted Sas Definitions operation returns the SAS definitions that have been 3099// deleted for a vault enabled for soft-delete. This operation requires the storage/listsas permission. 3100// Parameters: 3101// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3102// storageAccountName - the name of the storage account. 3103// maxresults - maximum number of results to return in a page. If not specified the service will return up to 3104// 25 results. 3105func (client BaseClient) GetDeletedSasDefinitions(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result DeletedSasDefinitionListResultPage, err error) { 3106 if tracing.IsEnabled() { 3107 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSasDefinitions") 3108 defer func() { 3109 sc := -1 3110 if result.dsdlr.Response.Response != nil { 3111 sc = result.dsdlr.Response.Response.StatusCode 3112 } 3113 tracing.EndSpan(ctx, sc, err) 3114 }() 3115 } 3116 if err := validation.Validate([]validation.Validation{ 3117 {TargetValue: storageAccountName, 3118 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 3119 {TargetValue: maxresults, 3120 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 3121 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 3122 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 3123 }}}}}); err != nil { 3124 return result, validation.NewError("keyvault.BaseClient", "GetDeletedSasDefinitions", err.Error()) 3125 } 3126 3127 result.fn = client.getDeletedSasDefinitionsNextResults 3128 req, err := client.GetDeletedSasDefinitionsPreparer(ctx, vaultBaseURL, storageAccountName, maxresults) 3129 if err != nil { 3130 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", nil, "Failure preparing request") 3131 return 3132 } 3133 3134 resp, err := client.GetDeletedSasDefinitionsSender(req) 3135 if err != nil { 3136 result.dsdlr.Response = autorest.Response{Response: resp} 3137 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", resp, "Failure sending request") 3138 return 3139 } 3140 3141 result.dsdlr, err = client.GetDeletedSasDefinitionsResponder(resp) 3142 if err != nil { 3143 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSasDefinitions", resp, "Failure responding to request") 3144 return 3145 } 3146 if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() { 3147 err = result.NextWithContext(ctx) 3148 return 3149 } 3150 3151 return 3152} 3153 3154// GetDeletedSasDefinitionsPreparer prepares the GetDeletedSasDefinitions request. 3155func (client BaseClient) GetDeletedSasDefinitionsPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (*http.Request, error) { 3156 urlParameters := map[string]interface{}{ 3157 "vaultBaseUrl": vaultBaseURL, 3158 } 3159 3160 pathParameters := map[string]interface{}{ 3161 "storage-account-name": autorest.Encode("path", storageAccountName), 3162 } 3163 3164 const APIVersion = "7.2-preview" 3165 queryParameters := map[string]interface{}{ 3166 "api-version": APIVersion, 3167 } 3168 if maxresults != nil { 3169 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 3170 } 3171 3172 preparer := autorest.CreatePreparer( 3173 autorest.AsGet(), 3174 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3175 autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas", pathParameters), 3176 autorest.WithQueryParameters(queryParameters)) 3177 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3178} 3179 3180// GetDeletedSasDefinitionsSender sends the GetDeletedSasDefinitions request. The method will close the 3181// http.Response Body if it receives an error. 3182func (client BaseClient) GetDeletedSasDefinitionsSender(req *http.Request) (*http.Response, error) { 3183 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3184} 3185 3186// GetDeletedSasDefinitionsResponder handles the response to the GetDeletedSasDefinitions request. The method always 3187// closes the http.Response Body. 3188func (client BaseClient) GetDeletedSasDefinitionsResponder(resp *http.Response) (result DeletedSasDefinitionListResult, err error) { 3189 err = autorest.Respond( 3190 resp, 3191 azure.WithErrorUnlessStatusCode(http.StatusOK), 3192 autorest.ByUnmarshallingJSON(&result), 3193 autorest.ByClosing()) 3194 result.Response = autorest.Response{Response: resp} 3195 return 3196} 3197 3198// getDeletedSasDefinitionsNextResults retrieves the next set of results, if any. 3199func (client BaseClient) getDeletedSasDefinitionsNextResults(ctx context.Context, lastResults DeletedSasDefinitionListResult) (result DeletedSasDefinitionListResult, err error) { 3200 req, err := lastResults.deletedSasDefinitionListResultPreparer(ctx) 3201 if err != nil { 3202 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", nil, "Failure preparing next results request") 3203 } 3204 if req == nil { 3205 return 3206 } 3207 resp, err := client.GetDeletedSasDefinitionsSender(req) 3208 if err != nil { 3209 result.Response = autorest.Response{Response: resp} 3210 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", resp, "Failure sending next results request") 3211 } 3212 result, err = client.GetDeletedSasDefinitionsResponder(resp) 3213 if err != nil { 3214 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSasDefinitionsNextResults", resp, "Failure responding to next results request") 3215 } 3216 return 3217} 3218 3219// GetDeletedSasDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. 3220func (client BaseClient) GetDeletedSasDefinitionsComplete(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result DeletedSasDefinitionListResultIterator, err error) { 3221 if tracing.IsEnabled() { 3222 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSasDefinitions") 3223 defer func() { 3224 sc := -1 3225 if result.Response().Response.Response != nil { 3226 sc = result.page.Response().Response.Response.StatusCode 3227 } 3228 tracing.EndSpan(ctx, sc, err) 3229 }() 3230 } 3231 result.page, err = client.GetDeletedSasDefinitions(ctx, vaultBaseURL, storageAccountName, maxresults) 3232 return 3233} 3234 3235// GetDeletedSecret the Get Deleted Secret operation returns the specified deleted secret along with its attributes. 3236// This operation requires the secrets/get permission. 3237// Parameters: 3238// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3239// secretName - the name of the secret. 3240func (client BaseClient) GetDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result DeletedSecretBundle, err error) { 3241 if tracing.IsEnabled() { 3242 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecret") 3243 defer func() { 3244 sc := -1 3245 if result.Response.Response != nil { 3246 sc = result.Response.Response.StatusCode 3247 } 3248 tracing.EndSpan(ctx, sc, err) 3249 }() 3250 } 3251 req, err := client.GetDeletedSecretPreparer(ctx, vaultBaseURL, secretName) 3252 if err != nil { 3253 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", nil, "Failure preparing request") 3254 return 3255 } 3256 3257 resp, err := client.GetDeletedSecretSender(req) 3258 if err != nil { 3259 result.Response = autorest.Response{Response: resp} 3260 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure sending request") 3261 return 3262 } 3263 3264 result, err = client.GetDeletedSecretResponder(resp) 3265 if err != nil { 3266 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecret", resp, "Failure responding to request") 3267 return 3268 } 3269 3270 return 3271} 3272 3273// GetDeletedSecretPreparer prepares the GetDeletedSecret request. 3274func (client BaseClient) GetDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { 3275 urlParameters := map[string]interface{}{ 3276 "vaultBaseUrl": vaultBaseURL, 3277 } 3278 3279 pathParameters := map[string]interface{}{ 3280 "secret-name": autorest.Encode("path", secretName), 3281 } 3282 3283 const APIVersion = "7.2-preview" 3284 queryParameters := map[string]interface{}{ 3285 "api-version": APIVersion, 3286 } 3287 3288 preparer := autorest.CreatePreparer( 3289 autorest.AsGet(), 3290 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3291 autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters), 3292 autorest.WithQueryParameters(queryParameters)) 3293 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3294} 3295 3296// GetDeletedSecretSender sends the GetDeletedSecret request. The method will close the 3297// http.Response Body if it receives an error. 3298func (client BaseClient) GetDeletedSecretSender(req *http.Request) (*http.Response, error) { 3299 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3300} 3301 3302// GetDeletedSecretResponder handles the response to the GetDeletedSecret request. The method always 3303// closes the http.Response Body. 3304func (client BaseClient) GetDeletedSecretResponder(resp *http.Response) (result DeletedSecretBundle, err error) { 3305 err = autorest.Respond( 3306 resp, 3307 azure.WithErrorUnlessStatusCode(http.StatusOK), 3308 autorest.ByUnmarshallingJSON(&result), 3309 autorest.ByClosing()) 3310 result.Response = autorest.Response{Response: resp} 3311 return 3312} 3313 3314// GetDeletedSecrets the Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled 3315// for soft-delete. This operation requires the secrets/list permission. 3316// Parameters: 3317// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3318// maxresults - maximum number of results to return in a page. If not specified the service will return up to 3319// 25 results. 3320func (client BaseClient) GetDeletedSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultPage, err error) { 3321 if tracing.IsEnabled() { 3322 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecrets") 3323 defer func() { 3324 sc := -1 3325 if result.dslr.Response.Response != nil { 3326 sc = result.dslr.Response.Response.StatusCode 3327 } 3328 tracing.EndSpan(ctx, sc, err) 3329 }() 3330 } 3331 if err := validation.Validate([]validation.Validation{ 3332 {TargetValue: maxresults, 3333 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 3334 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 3335 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 3336 }}}}}); err != nil { 3337 return result, validation.NewError("keyvault.BaseClient", "GetDeletedSecrets", err.Error()) 3338 } 3339 3340 result.fn = client.getDeletedSecretsNextResults 3341 req, err := client.GetDeletedSecretsPreparer(ctx, vaultBaseURL, maxresults) 3342 if err != nil { 3343 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", nil, "Failure preparing request") 3344 return 3345 } 3346 3347 resp, err := client.GetDeletedSecretsSender(req) 3348 if err != nil { 3349 result.dslr.Response = autorest.Response{Response: resp} 3350 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure sending request") 3351 return 3352 } 3353 3354 result.dslr, err = client.GetDeletedSecretsResponder(resp) 3355 if err != nil { 3356 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedSecrets", resp, "Failure responding to request") 3357 return 3358 } 3359 if result.dslr.hasNextLink() && result.dslr.IsEmpty() { 3360 err = result.NextWithContext(ctx) 3361 return 3362 } 3363 3364 return 3365} 3366 3367// GetDeletedSecretsPreparer prepares the GetDeletedSecrets request. 3368func (client BaseClient) GetDeletedSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 3369 urlParameters := map[string]interface{}{ 3370 "vaultBaseUrl": vaultBaseURL, 3371 } 3372 3373 const APIVersion = "7.2-preview" 3374 queryParameters := map[string]interface{}{ 3375 "api-version": APIVersion, 3376 } 3377 if maxresults != nil { 3378 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 3379 } 3380 3381 preparer := autorest.CreatePreparer( 3382 autorest.AsGet(), 3383 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3384 autorest.WithPath("/deletedsecrets"), 3385 autorest.WithQueryParameters(queryParameters)) 3386 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3387} 3388 3389// GetDeletedSecretsSender sends the GetDeletedSecrets request. The method will close the 3390// http.Response Body if it receives an error. 3391func (client BaseClient) GetDeletedSecretsSender(req *http.Request) (*http.Response, error) { 3392 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3393} 3394 3395// GetDeletedSecretsResponder handles the response to the GetDeletedSecrets request. The method always 3396// closes the http.Response Body. 3397func (client BaseClient) GetDeletedSecretsResponder(resp *http.Response) (result DeletedSecretListResult, err error) { 3398 err = autorest.Respond( 3399 resp, 3400 azure.WithErrorUnlessStatusCode(http.StatusOK), 3401 autorest.ByUnmarshallingJSON(&result), 3402 autorest.ByClosing()) 3403 result.Response = autorest.Response{Response: resp} 3404 return 3405} 3406 3407// getDeletedSecretsNextResults retrieves the next set of results, if any. 3408func (client BaseClient) getDeletedSecretsNextResults(ctx context.Context, lastResults DeletedSecretListResult) (result DeletedSecretListResult, err error) { 3409 req, err := lastResults.deletedSecretListResultPreparer(ctx) 3410 if err != nil { 3411 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", nil, "Failure preparing next results request") 3412 } 3413 if req == nil { 3414 return 3415 } 3416 resp, err := client.GetDeletedSecretsSender(req) 3417 if err != nil { 3418 result.Response = autorest.Response{Response: resp} 3419 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure sending next results request") 3420 } 3421 result, err = client.GetDeletedSecretsResponder(resp) 3422 if err != nil { 3423 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedSecretsNextResults", resp, "Failure responding to next results request") 3424 } 3425 return 3426} 3427 3428// GetDeletedSecretsComplete enumerates all values, automatically crossing page boundaries as required. 3429func (client BaseClient) GetDeletedSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedSecretListResultIterator, err error) { 3430 if tracing.IsEnabled() { 3431 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedSecrets") 3432 defer func() { 3433 sc := -1 3434 if result.Response().Response.Response != nil { 3435 sc = result.page.Response().Response.Response.StatusCode 3436 } 3437 tracing.EndSpan(ctx, sc, err) 3438 }() 3439 } 3440 result.page, err = client.GetDeletedSecrets(ctx, vaultBaseURL, maxresults) 3441 return 3442} 3443 3444// GetDeletedStorageAccount the Get Deleted Storage Account operation returns the specified deleted storage account 3445// along with its attributes. This operation requires the storage/get permission. 3446// Parameters: 3447// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3448// storageAccountName - the name of the storage account. 3449func (client BaseClient) GetDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result DeletedStorageBundle, err error) { 3450 if tracing.IsEnabled() { 3451 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedStorageAccount") 3452 defer func() { 3453 sc := -1 3454 if result.Response.Response != nil { 3455 sc = result.Response.Response.StatusCode 3456 } 3457 tracing.EndSpan(ctx, sc, err) 3458 }() 3459 } 3460 if err := validation.Validate([]validation.Validation{ 3461 {TargetValue: storageAccountName, 3462 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 3463 return result, validation.NewError("keyvault.BaseClient", "GetDeletedStorageAccount", err.Error()) 3464 } 3465 3466 req, err := client.GetDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 3467 if err != nil { 3468 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", nil, "Failure preparing request") 3469 return 3470 } 3471 3472 resp, err := client.GetDeletedStorageAccountSender(req) 3473 if err != nil { 3474 result.Response = autorest.Response{Response: resp} 3475 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", resp, "Failure sending request") 3476 return 3477 } 3478 3479 result, err = client.GetDeletedStorageAccountResponder(resp) 3480 if err != nil { 3481 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccount", resp, "Failure responding to request") 3482 return 3483 } 3484 3485 return 3486} 3487 3488// GetDeletedStorageAccountPreparer prepares the GetDeletedStorageAccount request. 3489func (client BaseClient) GetDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 3490 urlParameters := map[string]interface{}{ 3491 "vaultBaseUrl": vaultBaseURL, 3492 } 3493 3494 pathParameters := map[string]interface{}{ 3495 "storage-account-name": autorest.Encode("path", storageAccountName), 3496 } 3497 3498 const APIVersion = "7.2-preview" 3499 queryParameters := map[string]interface{}{ 3500 "api-version": APIVersion, 3501 } 3502 3503 preparer := autorest.CreatePreparer( 3504 autorest.AsGet(), 3505 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3506 autorest.WithPathParameters("/deletedstorage/{storage-account-name}", pathParameters), 3507 autorest.WithQueryParameters(queryParameters)) 3508 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3509} 3510 3511// GetDeletedStorageAccountSender sends the GetDeletedStorageAccount request. The method will close the 3512// http.Response Body if it receives an error. 3513func (client BaseClient) GetDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { 3514 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3515} 3516 3517// GetDeletedStorageAccountResponder handles the response to the GetDeletedStorageAccount request. The method always 3518// closes the http.Response Body. 3519func (client BaseClient) GetDeletedStorageAccountResponder(resp *http.Response) (result DeletedStorageBundle, err error) { 3520 err = autorest.Respond( 3521 resp, 3522 azure.WithErrorUnlessStatusCode(http.StatusOK), 3523 autorest.ByUnmarshallingJSON(&result), 3524 autorest.ByClosing()) 3525 result.Response = autorest.Response{Response: resp} 3526 return 3527} 3528 3529// GetDeletedStorageAccounts the Get Deleted Storage Accounts operation returns the storage accounts that have been 3530// deleted for a vault enabled for soft-delete. This operation requires the storage/list permission. 3531// Parameters: 3532// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3533// maxresults - maximum number of results to return in a page. If not specified the service will return up to 3534// 25 results. 3535func (client BaseClient) GetDeletedStorageAccounts(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedStorageListResultPage, err error) { 3536 if tracing.IsEnabled() { 3537 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedStorageAccounts") 3538 defer func() { 3539 sc := -1 3540 if result.dslr.Response.Response != nil { 3541 sc = result.dslr.Response.Response.StatusCode 3542 } 3543 tracing.EndSpan(ctx, sc, err) 3544 }() 3545 } 3546 if err := validation.Validate([]validation.Validation{ 3547 {TargetValue: maxresults, 3548 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 3549 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 3550 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 3551 }}}}}); err != nil { 3552 return result, validation.NewError("keyvault.BaseClient", "GetDeletedStorageAccounts", err.Error()) 3553 } 3554 3555 result.fn = client.getDeletedStorageAccountsNextResults 3556 req, err := client.GetDeletedStorageAccountsPreparer(ctx, vaultBaseURL, maxresults) 3557 if err != nil { 3558 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", nil, "Failure preparing request") 3559 return 3560 } 3561 3562 resp, err := client.GetDeletedStorageAccountsSender(req) 3563 if err != nil { 3564 result.dslr.Response = autorest.Response{Response: resp} 3565 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", resp, "Failure sending request") 3566 return 3567 } 3568 3569 result.dslr, err = client.GetDeletedStorageAccountsResponder(resp) 3570 if err != nil { 3571 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetDeletedStorageAccounts", resp, "Failure responding to request") 3572 return 3573 } 3574 if result.dslr.hasNextLink() && result.dslr.IsEmpty() { 3575 err = result.NextWithContext(ctx) 3576 return 3577 } 3578 3579 return 3580} 3581 3582// GetDeletedStorageAccountsPreparer prepares the GetDeletedStorageAccounts request. 3583func (client BaseClient) GetDeletedStorageAccountsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 3584 urlParameters := map[string]interface{}{ 3585 "vaultBaseUrl": vaultBaseURL, 3586 } 3587 3588 const APIVersion = "7.2-preview" 3589 queryParameters := map[string]interface{}{ 3590 "api-version": APIVersion, 3591 } 3592 if maxresults != nil { 3593 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 3594 } 3595 3596 preparer := autorest.CreatePreparer( 3597 autorest.AsGet(), 3598 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3599 autorest.WithPath("/deletedstorage"), 3600 autorest.WithQueryParameters(queryParameters)) 3601 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3602} 3603 3604// GetDeletedStorageAccountsSender sends the GetDeletedStorageAccounts request. The method will close the 3605// http.Response Body if it receives an error. 3606func (client BaseClient) GetDeletedStorageAccountsSender(req *http.Request) (*http.Response, error) { 3607 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3608} 3609 3610// GetDeletedStorageAccountsResponder handles the response to the GetDeletedStorageAccounts request. The method always 3611// closes the http.Response Body. 3612func (client BaseClient) GetDeletedStorageAccountsResponder(resp *http.Response) (result DeletedStorageListResult, err error) { 3613 err = autorest.Respond( 3614 resp, 3615 azure.WithErrorUnlessStatusCode(http.StatusOK), 3616 autorest.ByUnmarshallingJSON(&result), 3617 autorest.ByClosing()) 3618 result.Response = autorest.Response{Response: resp} 3619 return 3620} 3621 3622// getDeletedStorageAccountsNextResults retrieves the next set of results, if any. 3623func (client BaseClient) getDeletedStorageAccountsNextResults(ctx context.Context, lastResults DeletedStorageListResult) (result DeletedStorageListResult, err error) { 3624 req, err := lastResults.deletedStorageListResultPreparer(ctx) 3625 if err != nil { 3626 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", nil, "Failure preparing next results request") 3627 } 3628 if req == nil { 3629 return 3630 } 3631 resp, err := client.GetDeletedStorageAccountsSender(req) 3632 if err != nil { 3633 result.Response = autorest.Response{Response: resp} 3634 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", resp, "Failure sending next results request") 3635 } 3636 result, err = client.GetDeletedStorageAccountsResponder(resp) 3637 if err != nil { 3638 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getDeletedStorageAccountsNextResults", resp, "Failure responding to next results request") 3639 } 3640 return 3641} 3642 3643// GetDeletedStorageAccountsComplete enumerates all values, automatically crossing page boundaries as required. 3644func (client BaseClient) GetDeletedStorageAccountsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result DeletedStorageListResultIterator, err error) { 3645 if tracing.IsEnabled() { 3646 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDeletedStorageAccounts") 3647 defer func() { 3648 sc := -1 3649 if result.Response().Response.Response != nil { 3650 sc = result.page.Response().Response.Response.StatusCode 3651 } 3652 tracing.EndSpan(ctx, sc, err) 3653 }() 3654 } 3655 result.page, err = client.GetDeletedStorageAccounts(ctx, vaultBaseURL, maxresults) 3656 return 3657} 3658 3659// GetKey the get key operation is applicable to all key types. If the requested key is symmetric, then no key material 3660// is released in the response. This operation requires the keys/get permission. 3661// Parameters: 3662// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3663// keyName - the name of the key to get. 3664// keyVersion - adding the version parameter retrieves a specific version of a key. This URI fragment is 3665// optional. If not specified, the latest version of the key is returned. 3666func (client BaseClient) GetKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) { 3667 if tracing.IsEnabled() { 3668 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKey") 3669 defer func() { 3670 sc := -1 3671 if result.Response.Response != nil { 3672 sc = result.Response.Response.StatusCode 3673 } 3674 tracing.EndSpan(ctx, sc, err) 3675 }() 3676 } 3677 req, err := client.GetKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion) 3678 if err != nil { 3679 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", nil, "Failure preparing request") 3680 return 3681 } 3682 3683 resp, err := client.GetKeySender(req) 3684 if err != nil { 3685 result.Response = autorest.Response{Response: resp} 3686 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure sending request") 3687 return 3688 } 3689 3690 result, err = client.GetKeyResponder(resp) 3691 if err != nil { 3692 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKey", resp, "Failure responding to request") 3693 return 3694 } 3695 3696 return 3697} 3698 3699// GetKeyPreparer prepares the GetKey request. 3700func (client BaseClient) GetKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string) (*http.Request, error) { 3701 urlParameters := map[string]interface{}{ 3702 "vaultBaseUrl": vaultBaseURL, 3703 } 3704 3705 pathParameters := map[string]interface{}{ 3706 "key-name": autorest.Encode("path", keyName), 3707 "key-version": autorest.Encode("path", keyVersion), 3708 } 3709 3710 const APIVersion = "7.2-preview" 3711 queryParameters := map[string]interface{}{ 3712 "api-version": APIVersion, 3713 } 3714 3715 preparer := autorest.CreatePreparer( 3716 autorest.AsGet(), 3717 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3718 autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), 3719 autorest.WithQueryParameters(queryParameters)) 3720 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3721} 3722 3723// GetKeySender sends the GetKey request. The method will close the 3724// http.Response Body if it receives an error. 3725func (client BaseClient) GetKeySender(req *http.Request) (*http.Response, error) { 3726 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3727} 3728 3729// GetKeyResponder handles the response to the GetKey request. The method always 3730// closes the http.Response Body. 3731func (client BaseClient) GetKeyResponder(resp *http.Response) (result KeyBundle, err error) { 3732 err = autorest.Respond( 3733 resp, 3734 azure.WithErrorUnlessStatusCode(http.StatusOK), 3735 autorest.ByUnmarshallingJSON(&result), 3736 autorest.ByClosing()) 3737 result.Response = autorest.Response{Response: resp} 3738 return 3739} 3740 3741// GetKeys retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a 3742// stored key. The LIST operation is applicable to all key types, however only the base key identifier, attributes, and 3743// tags are provided in the response. Individual versions of a key are not listed in the response. This operation 3744// requires the keys/list permission. 3745// Parameters: 3746// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3747// maxresults - maximum number of results to return in a page. If not specified the service will return up to 3748// 25 results. 3749func (client BaseClient) GetKeys(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultPage, err error) { 3750 if tracing.IsEnabled() { 3751 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeys") 3752 defer func() { 3753 sc := -1 3754 if result.klr.Response.Response != nil { 3755 sc = result.klr.Response.Response.StatusCode 3756 } 3757 tracing.EndSpan(ctx, sc, err) 3758 }() 3759 } 3760 if err := validation.Validate([]validation.Validation{ 3761 {TargetValue: maxresults, 3762 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 3763 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 3764 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 3765 }}}}}); err != nil { 3766 return result, validation.NewError("keyvault.BaseClient", "GetKeys", err.Error()) 3767 } 3768 3769 result.fn = client.getKeysNextResults 3770 req, err := client.GetKeysPreparer(ctx, vaultBaseURL, maxresults) 3771 if err != nil { 3772 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", nil, "Failure preparing request") 3773 return 3774 } 3775 3776 resp, err := client.GetKeysSender(req) 3777 if err != nil { 3778 result.klr.Response = autorest.Response{Response: resp} 3779 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure sending request") 3780 return 3781 } 3782 3783 result.klr, err = client.GetKeysResponder(resp) 3784 if err != nil { 3785 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeys", resp, "Failure responding to request") 3786 return 3787 } 3788 if result.klr.hasNextLink() && result.klr.IsEmpty() { 3789 err = result.NextWithContext(ctx) 3790 return 3791 } 3792 3793 return 3794} 3795 3796// GetKeysPreparer prepares the GetKeys request. 3797func (client BaseClient) GetKeysPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 3798 urlParameters := map[string]interface{}{ 3799 "vaultBaseUrl": vaultBaseURL, 3800 } 3801 3802 const APIVersion = "7.2-preview" 3803 queryParameters := map[string]interface{}{ 3804 "api-version": APIVersion, 3805 } 3806 if maxresults != nil { 3807 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 3808 } 3809 3810 preparer := autorest.CreatePreparer( 3811 autorest.AsGet(), 3812 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3813 autorest.WithPath("/keys"), 3814 autorest.WithQueryParameters(queryParameters)) 3815 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3816} 3817 3818// GetKeysSender sends the GetKeys request. The method will close the 3819// http.Response Body if it receives an error. 3820func (client BaseClient) GetKeysSender(req *http.Request) (*http.Response, error) { 3821 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3822} 3823 3824// GetKeysResponder handles the response to the GetKeys request. The method always 3825// closes the http.Response Body. 3826func (client BaseClient) GetKeysResponder(resp *http.Response) (result KeyListResult, err error) { 3827 err = autorest.Respond( 3828 resp, 3829 azure.WithErrorUnlessStatusCode(http.StatusOK), 3830 autorest.ByUnmarshallingJSON(&result), 3831 autorest.ByClosing()) 3832 result.Response = autorest.Response{Response: resp} 3833 return 3834} 3835 3836// getKeysNextResults retrieves the next set of results, if any. 3837func (client BaseClient) getKeysNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) { 3838 req, err := lastResults.keyListResultPreparer(ctx) 3839 if err != nil { 3840 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", nil, "Failure preparing next results request") 3841 } 3842 if req == nil { 3843 return 3844 } 3845 resp, err := client.GetKeysSender(req) 3846 if err != nil { 3847 result.Response = autorest.Response{Response: resp} 3848 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure sending next results request") 3849 } 3850 result, err = client.GetKeysResponder(resp) 3851 if err != nil { 3852 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeysNextResults", resp, "Failure responding to next results request") 3853 } 3854 return 3855} 3856 3857// GetKeysComplete enumerates all values, automatically crossing page boundaries as required. 3858func (client BaseClient) GetKeysComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result KeyListResultIterator, err error) { 3859 if tracing.IsEnabled() { 3860 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeys") 3861 defer func() { 3862 sc := -1 3863 if result.Response().Response.Response != nil { 3864 sc = result.page.Response().Response.Response.StatusCode 3865 } 3866 tracing.EndSpan(ctx, sc, err) 3867 }() 3868 } 3869 result.page, err = client.GetKeys(ctx, vaultBaseURL, maxresults) 3870 return 3871} 3872 3873// GetKeyVersions the full key identifier, attributes, and tags are provided in the response. This operation requires 3874// the keys/list permission. 3875// Parameters: 3876// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 3877// keyName - the name of the key. 3878// maxresults - maximum number of results to return in a page. If not specified the service will return up to 3879// 25 results. 3880func (client BaseClient) GetKeyVersions(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultPage, err error) { 3881 if tracing.IsEnabled() { 3882 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeyVersions") 3883 defer func() { 3884 sc := -1 3885 if result.klr.Response.Response != nil { 3886 sc = result.klr.Response.Response.StatusCode 3887 } 3888 tracing.EndSpan(ctx, sc, err) 3889 }() 3890 } 3891 if err := validation.Validate([]validation.Validation{ 3892 {TargetValue: maxresults, 3893 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 3894 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 3895 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 3896 }}}}}); err != nil { 3897 return result, validation.NewError("keyvault.BaseClient", "GetKeyVersions", err.Error()) 3898 } 3899 3900 result.fn = client.getKeyVersionsNextResults 3901 req, err := client.GetKeyVersionsPreparer(ctx, vaultBaseURL, keyName, maxresults) 3902 if err != nil { 3903 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", nil, "Failure preparing request") 3904 return 3905 } 3906 3907 resp, err := client.GetKeyVersionsSender(req) 3908 if err != nil { 3909 result.klr.Response = autorest.Response{Response: resp} 3910 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure sending request") 3911 return 3912 } 3913 3914 result.klr, err = client.GetKeyVersionsResponder(resp) 3915 if err != nil { 3916 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetKeyVersions", resp, "Failure responding to request") 3917 return 3918 } 3919 if result.klr.hasNextLink() && result.klr.IsEmpty() { 3920 err = result.NextWithContext(ctx) 3921 return 3922 } 3923 3924 return 3925} 3926 3927// GetKeyVersionsPreparer prepares the GetKeyVersions request. 3928func (client BaseClient) GetKeyVersionsPreparer(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (*http.Request, error) { 3929 urlParameters := map[string]interface{}{ 3930 "vaultBaseUrl": vaultBaseURL, 3931 } 3932 3933 pathParameters := map[string]interface{}{ 3934 "key-name": autorest.Encode("path", keyName), 3935 } 3936 3937 const APIVersion = "7.2-preview" 3938 queryParameters := map[string]interface{}{ 3939 "api-version": APIVersion, 3940 } 3941 if maxresults != nil { 3942 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 3943 } 3944 3945 preparer := autorest.CreatePreparer( 3946 autorest.AsGet(), 3947 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 3948 autorest.WithPathParameters("/keys/{key-name}/versions", pathParameters), 3949 autorest.WithQueryParameters(queryParameters)) 3950 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 3951} 3952 3953// GetKeyVersionsSender sends the GetKeyVersions request. The method will close the 3954// http.Response Body if it receives an error. 3955func (client BaseClient) GetKeyVersionsSender(req *http.Request) (*http.Response, error) { 3956 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3957} 3958 3959// GetKeyVersionsResponder handles the response to the GetKeyVersions request. The method always 3960// closes the http.Response Body. 3961func (client BaseClient) GetKeyVersionsResponder(resp *http.Response) (result KeyListResult, err error) { 3962 err = autorest.Respond( 3963 resp, 3964 azure.WithErrorUnlessStatusCode(http.StatusOK), 3965 autorest.ByUnmarshallingJSON(&result), 3966 autorest.ByClosing()) 3967 result.Response = autorest.Response{Response: resp} 3968 return 3969} 3970 3971// getKeyVersionsNextResults retrieves the next set of results, if any. 3972func (client BaseClient) getKeyVersionsNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) { 3973 req, err := lastResults.keyListResultPreparer(ctx) 3974 if err != nil { 3975 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", nil, "Failure preparing next results request") 3976 } 3977 if req == nil { 3978 return 3979 } 3980 resp, err := client.GetKeyVersionsSender(req) 3981 if err != nil { 3982 result.Response = autorest.Response{Response: resp} 3983 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure sending next results request") 3984 } 3985 result, err = client.GetKeyVersionsResponder(resp) 3986 if err != nil { 3987 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getKeyVersionsNextResults", resp, "Failure responding to next results request") 3988 } 3989 return 3990} 3991 3992// GetKeyVersionsComplete enumerates all values, automatically crossing page boundaries as required. 3993func (client BaseClient) GetKeyVersionsComplete(ctx context.Context, vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResultIterator, err error) { 3994 if tracing.IsEnabled() { 3995 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetKeyVersions") 3996 defer func() { 3997 sc := -1 3998 if result.Response().Response.Response != nil { 3999 sc = result.page.Response().Response.Response.StatusCode 4000 } 4001 tracing.EndSpan(ctx, sc, err) 4002 }() 4003 } 4004 result.page, err = client.GetKeyVersions(ctx, vaultBaseURL, keyName, maxresults) 4005 return 4006} 4007 4008// GetSasDefinition gets information about a SAS definition for the specified storage account. This operation requires 4009// the storage/getsas permission. 4010// Parameters: 4011// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4012// storageAccountName - the name of the storage account. 4013// sasDefinitionName - the name of the SAS definition. 4014func (client BaseClient) GetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) { 4015 if tracing.IsEnabled() { 4016 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinition") 4017 defer func() { 4018 sc := -1 4019 if result.Response.Response != nil { 4020 sc = result.Response.Response.StatusCode 4021 } 4022 tracing.EndSpan(ctx, sc, err) 4023 }() 4024 } 4025 if err := validation.Validate([]validation.Validation{ 4026 {TargetValue: storageAccountName, 4027 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 4028 {TargetValue: sasDefinitionName, 4029 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 4030 return result, validation.NewError("keyvault.BaseClient", "GetSasDefinition", err.Error()) 4031 } 4032 4033 req, err := client.GetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) 4034 if err != nil { 4035 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", nil, "Failure preparing request") 4036 return 4037 } 4038 4039 resp, err := client.GetSasDefinitionSender(req) 4040 if err != nil { 4041 result.Response = autorest.Response{Response: resp} 4042 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure sending request") 4043 return 4044 } 4045 4046 result, err = client.GetSasDefinitionResponder(resp) 4047 if err != nil { 4048 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinition", resp, "Failure responding to request") 4049 return 4050 } 4051 4052 return 4053} 4054 4055// GetSasDefinitionPreparer prepares the GetSasDefinition request. 4056func (client BaseClient) GetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { 4057 urlParameters := map[string]interface{}{ 4058 "vaultBaseUrl": vaultBaseURL, 4059 } 4060 4061 pathParameters := map[string]interface{}{ 4062 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 4063 "storage-account-name": autorest.Encode("path", storageAccountName), 4064 } 4065 4066 const APIVersion = "7.2-preview" 4067 queryParameters := map[string]interface{}{ 4068 "api-version": APIVersion, 4069 } 4070 4071 preparer := autorest.CreatePreparer( 4072 autorest.AsGet(), 4073 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4074 autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), 4075 autorest.WithQueryParameters(queryParameters)) 4076 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4077} 4078 4079// GetSasDefinitionSender sends the GetSasDefinition request. The method will close the 4080// http.Response Body if it receives an error. 4081func (client BaseClient) GetSasDefinitionSender(req *http.Request) (*http.Response, error) { 4082 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4083} 4084 4085// GetSasDefinitionResponder handles the response to the GetSasDefinition request. The method always 4086// closes the http.Response Body. 4087func (client BaseClient) GetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { 4088 err = autorest.Respond( 4089 resp, 4090 azure.WithErrorUnlessStatusCode(http.StatusOK), 4091 autorest.ByUnmarshallingJSON(&result), 4092 autorest.ByClosing()) 4093 result.Response = autorest.Response{Response: resp} 4094 return 4095} 4096 4097// GetSasDefinitions list storage SAS definitions for the given storage account. This operation requires the 4098// storage/listsas permission. 4099// Parameters: 4100// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4101// storageAccountName - the name of the storage account. 4102// maxresults - maximum number of results to return in a page. If not specified the service will return up to 4103// 25 results. 4104func (client BaseClient) GetSasDefinitions(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultPage, err error) { 4105 if tracing.IsEnabled() { 4106 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinitions") 4107 defer func() { 4108 sc := -1 4109 if result.sdlr.Response.Response != nil { 4110 sc = result.sdlr.Response.Response.StatusCode 4111 } 4112 tracing.EndSpan(ctx, sc, err) 4113 }() 4114 } 4115 if err := validation.Validate([]validation.Validation{ 4116 {TargetValue: storageAccountName, 4117 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 4118 {TargetValue: maxresults, 4119 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 4120 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 4121 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 4122 }}}}}); err != nil { 4123 return result, validation.NewError("keyvault.BaseClient", "GetSasDefinitions", err.Error()) 4124 } 4125 4126 result.fn = client.getSasDefinitionsNextResults 4127 req, err := client.GetSasDefinitionsPreparer(ctx, vaultBaseURL, storageAccountName, maxresults) 4128 if err != nil { 4129 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", nil, "Failure preparing request") 4130 return 4131 } 4132 4133 resp, err := client.GetSasDefinitionsSender(req) 4134 if err != nil { 4135 result.sdlr.Response = autorest.Response{Response: resp} 4136 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure sending request") 4137 return 4138 } 4139 4140 result.sdlr, err = client.GetSasDefinitionsResponder(resp) 4141 if err != nil { 4142 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSasDefinitions", resp, "Failure responding to request") 4143 return 4144 } 4145 if result.sdlr.hasNextLink() && result.sdlr.IsEmpty() { 4146 err = result.NextWithContext(ctx) 4147 return 4148 } 4149 4150 return 4151} 4152 4153// GetSasDefinitionsPreparer prepares the GetSasDefinitions request. 4154func (client BaseClient) GetSasDefinitionsPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (*http.Request, error) { 4155 urlParameters := map[string]interface{}{ 4156 "vaultBaseUrl": vaultBaseURL, 4157 } 4158 4159 pathParameters := map[string]interface{}{ 4160 "storage-account-name": autorest.Encode("path", storageAccountName), 4161 } 4162 4163 const APIVersion = "7.2-preview" 4164 queryParameters := map[string]interface{}{ 4165 "api-version": APIVersion, 4166 } 4167 if maxresults != nil { 4168 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 4169 } 4170 4171 preparer := autorest.CreatePreparer( 4172 autorest.AsGet(), 4173 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4174 autorest.WithPathParameters("/storage/{storage-account-name}/sas", pathParameters), 4175 autorest.WithQueryParameters(queryParameters)) 4176 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4177} 4178 4179// GetSasDefinitionsSender sends the GetSasDefinitions request. The method will close the 4180// http.Response Body if it receives an error. 4181func (client BaseClient) GetSasDefinitionsSender(req *http.Request) (*http.Response, error) { 4182 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4183} 4184 4185// GetSasDefinitionsResponder handles the response to the GetSasDefinitions request. The method always 4186// closes the http.Response Body. 4187func (client BaseClient) GetSasDefinitionsResponder(resp *http.Response) (result SasDefinitionListResult, err error) { 4188 err = autorest.Respond( 4189 resp, 4190 azure.WithErrorUnlessStatusCode(http.StatusOK), 4191 autorest.ByUnmarshallingJSON(&result), 4192 autorest.ByClosing()) 4193 result.Response = autorest.Response{Response: resp} 4194 return 4195} 4196 4197// getSasDefinitionsNextResults retrieves the next set of results, if any. 4198func (client BaseClient) getSasDefinitionsNextResults(ctx context.Context, lastResults SasDefinitionListResult) (result SasDefinitionListResult, err error) { 4199 req, err := lastResults.sasDefinitionListResultPreparer(ctx) 4200 if err != nil { 4201 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", nil, "Failure preparing next results request") 4202 } 4203 if req == nil { 4204 return 4205 } 4206 resp, err := client.GetSasDefinitionsSender(req) 4207 if err != nil { 4208 result.Response = autorest.Response{Response: resp} 4209 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure sending next results request") 4210 } 4211 result, err = client.GetSasDefinitionsResponder(resp) 4212 if err != nil { 4213 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSasDefinitionsNextResults", resp, "Failure responding to next results request") 4214 } 4215 return 4216} 4217 4218// GetSasDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. 4219func (client BaseClient) GetSasDefinitionsComplete(ctx context.Context, vaultBaseURL string, storageAccountName string, maxresults *int32) (result SasDefinitionListResultIterator, err error) { 4220 if tracing.IsEnabled() { 4221 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSasDefinitions") 4222 defer func() { 4223 sc := -1 4224 if result.Response().Response.Response != nil { 4225 sc = result.page.Response().Response.Response.StatusCode 4226 } 4227 tracing.EndSpan(ctx, sc, err) 4228 }() 4229 } 4230 result.page, err = client.GetSasDefinitions(ctx, vaultBaseURL, storageAccountName, maxresults) 4231 return 4232} 4233 4234// GetSecret the GET operation is applicable to any secret stored in Azure Key Vault. This operation requires the 4235// secrets/get permission. 4236// Parameters: 4237// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4238// secretName - the name of the secret. 4239// secretVersion - the version of the secret. This URI fragment is optional. If not specified, the latest 4240// version of the secret is returned. 4241func (client BaseClient) GetSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) { 4242 if tracing.IsEnabled() { 4243 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecret") 4244 defer func() { 4245 sc := -1 4246 if result.Response.Response != nil { 4247 sc = result.Response.Response.StatusCode 4248 } 4249 tracing.EndSpan(ctx, sc, err) 4250 }() 4251 } 4252 req, err := client.GetSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion) 4253 if err != nil { 4254 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", nil, "Failure preparing request") 4255 return 4256 } 4257 4258 resp, err := client.GetSecretSender(req) 4259 if err != nil { 4260 result.Response = autorest.Response{Response: resp} 4261 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure sending request") 4262 return 4263 } 4264 4265 result, err = client.GetSecretResponder(resp) 4266 if err != nil { 4267 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecret", resp, "Failure responding to request") 4268 return 4269 } 4270 4271 return 4272} 4273 4274// GetSecretPreparer prepares the GetSecret request. 4275func (client BaseClient) GetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string) (*http.Request, error) { 4276 urlParameters := map[string]interface{}{ 4277 "vaultBaseUrl": vaultBaseURL, 4278 } 4279 4280 pathParameters := map[string]interface{}{ 4281 "secret-name": autorest.Encode("path", secretName), 4282 "secret-version": autorest.Encode("path", secretVersion), 4283 } 4284 4285 const APIVersion = "7.2-preview" 4286 queryParameters := map[string]interface{}{ 4287 "api-version": APIVersion, 4288 } 4289 4290 preparer := autorest.CreatePreparer( 4291 autorest.AsGet(), 4292 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4293 autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), 4294 autorest.WithQueryParameters(queryParameters)) 4295 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4296} 4297 4298// GetSecretSender sends the GetSecret request. The method will close the 4299// http.Response Body if it receives an error. 4300func (client BaseClient) GetSecretSender(req *http.Request) (*http.Response, error) { 4301 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4302} 4303 4304// GetSecretResponder handles the response to the GetSecret request. The method always 4305// closes the http.Response Body. 4306func (client BaseClient) GetSecretResponder(resp *http.Response) (result SecretBundle, err error) { 4307 err = autorest.Respond( 4308 resp, 4309 azure.WithErrorUnlessStatusCode(http.StatusOK), 4310 autorest.ByUnmarshallingJSON(&result), 4311 autorest.ByClosing()) 4312 result.Response = autorest.Response{Response: resp} 4313 return 4314} 4315 4316// GetSecrets the Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and 4317// its attributes are provided in the response. Individual secret versions are not listed in the response. This 4318// operation requires the secrets/list permission. 4319// Parameters: 4320// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4321// maxresults - maximum number of results to return in a page. If not specified, the service will return up to 4322// 25 results. 4323func (client BaseClient) GetSecrets(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultPage, err error) { 4324 if tracing.IsEnabled() { 4325 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecrets") 4326 defer func() { 4327 sc := -1 4328 if result.slr.Response.Response != nil { 4329 sc = result.slr.Response.Response.StatusCode 4330 } 4331 tracing.EndSpan(ctx, sc, err) 4332 }() 4333 } 4334 if err := validation.Validate([]validation.Validation{ 4335 {TargetValue: maxresults, 4336 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 4337 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 4338 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 4339 }}}}}); err != nil { 4340 return result, validation.NewError("keyvault.BaseClient", "GetSecrets", err.Error()) 4341 } 4342 4343 result.fn = client.getSecretsNextResults 4344 req, err := client.GetSecretsPreparer(ctx, vaultBaseURL, maxresults) 4345 if err != nil { 4346 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", nil, "Failure preparing request") 4347 return 4348 } 4349 4350 resp, err := client.GetSecretsSender(req) 4351 if err != nil { 4352 result.slr.Response = autorest.Response{Response: resp} 4353 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure sending request") 4354 return 4355 } 4356 4357 result.slr, err = client.GetSecretsResponder(resp) 4358 if err != nil { 4359 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecrets", resp, "Failure responding to request") 4360 return 4361 } 4362 if result.slr.hasNextLink() && result.slr.IsEmpty() { 4363 err = result.NextWithContext(ctx) 4364 return 4365 } 4366 4367 return 4368} 4369 4370// GetSecretsPreparer prepares the GetSecrets request. 4371func (client BaseClient) GetSecretsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 4372 urlParameters := map[string]interface{}{ 4373 "vaultBaseUrl": vaultBaseURL, 4374 } 4375 4376 const APIVersion = "7.2-preview" 4377 queryParameters := map[string]interface{}{ 4378 "api-version": APIVersion, 4379 } 4380 if maxresults != nil { 4381 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 4382 } 4383 4384 preparer := autorest.CreatePreparer( 4385 autorest.AsGet(), 4386 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4387 autorest.WithPath("/secrets"), 4388 autorest.WithQueryParameters(queryParameters)) 4389 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4390} 4391 4392// GetSecretsSender sends the GetSecrets request. The method will close the 4393// http.Response Body if it receives an error. 4394func (client BaseClient) GetSecretsSender(req *http.Request) (*http.Response, error) { 4395 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4396} 4397 4398// GetSecretsResponder handles the response to the GetSecrets request. The method always 4399// closes the http.Response Body. 4400func (client BaseClient) GetSecretsResponder(resp *http.Response) (result SecretListResult, err error) { 4401 err = autorest.Respond( 4402 resp, 4403 azure.WithErrorUnlessStatusCode(http.StatusOK), 4404 autorest.ByUnmarshallingJSON(&result), 4405 autorest.ByClosing()) 4406 result.Response = autorest.Response{Response: resp} 4407 return 4408} 4409 4410// getSecretsNextResults retrieves the next set of results, if any. 4411func (client BaseClient) getSecretsNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) { 4412 req, err := lastResults.secretListResultPreparer(ctx) 4413 if err != nil { 4414 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", nil, "Failure preparing next results request") 4415 } 4416 if req == nil { 4417 return 4418 } 4419 resp, err := client.GetSecretsSender(req) 4420 if err != nil { 4421 result.Response = autorest.Response{Response: resp} 4422 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure sending next results request") 4423 } 4424 result, err = client.GetSecretsResponder(resp) 4425 if err != nil { 4426 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretsNextResults", resp, "Failure responding to next results request") 4427 } 4428 return 4429} 4430 4431// GetSecretsComplete enumerates all values, automatically crossing page boundaries as required. 4432func (client BaseClient) GetSecretsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result SecretListResultIterator, err error) { 4433 if tracing.IsEnabled() { 4434 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecrets") 4435 defer func() { 4436 sc := -1 4437 if result.Response().Response.Response != nil { 4438 sc = result.page.Response().Response.Response.StatusCode 4439 } 4440 tracing.EndSpan(ctx, sc, err) 4441 }() 4442 } 4443 result.page, err = client.GetSecrets(ctx, vaultBaseURL, maxresults) 4444 return 4445} 4446 4447// GetSecretVersions the full secret identifier and attributes are provided in the response. No values are returned for 4448// the secrets. This operations requires the secrets/list permission. 4449// Parameters: 4450// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4451// secretName - the name of the secret. 4452// maxresults - maximum number of results to return in a page. If not specified, the service will return up to 4453// 25 results. 4454func (client BaseClient) GetSecretVersions(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultPage, err error) { 4455 if tracing.IsEnabled() { 4456 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecretVersions") 4457 defer func() { 4458 sc := -1 4459 if result.slr.Response.Response != nil { 4460 sc = result.slr.Response.Response.StatusCode 4461 } 4462 tracing.EndSpan(ctx, sc, err) 4463 }() 4464 } 4465 if err := validation.Validate([]validation.Validation{ 4466 {TargetValue: maxresults, 4467 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 4468 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 4469 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 4470 }}}}}); err != nil { 4471 return result, validation.NewError("keyvault.BaseClient", "GetSecretVersions", err.Error()) 4472 } 4473 4474 result.fn = client.getSecretVersionsNextResults 4475 req, err := client.GetSecretVersionsPreparer(ctx, vaultBaseURL, secretName, maxresults) 4476 if err != nil { 4477 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", nil, "Failure preparing request") 4478 return 4479 } 4480 4481 resp, err := client.GetSecretVersionsSender(req) 4482 if err != nil { 4483 result.slr.Response = autorest.Response{Response: resp} 4484 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure sending request") 4485 return 4486 } 4487 4488 result.slr, err = client.GetSecretVersionsResponder(resp) 4489 if err != nil { 4490 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetSecretVersions", resp, "Failure responding to request") 4491 return 4492 } 4493 if result.slr.hasNextLink() && result.slr.IsEmpty() { 4494 err = result.NextWithContext(ctx) 4495 return 4496 } 4497 4498 return 4499} 4500 4501// GetSecretVersionsPreparer prepares the GetSecretVersions request. 4502func (client BaseClient) GetSecretVersionsPreparer(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (*http.Request, error) { 4503 urlParameters := map[string]interface{}{ 4504 "vaultBaseUrl": vaultBaseURL, 4505 } 4506 4507 pathParameters := map[string]interface{}{ 4508 "secret-name": autorest.Encode("path", secretName), 4509 } 4510 4511 const APIVersion = "7.2-preview" 4512 queryParameters := map[string]interface{}{ 4513 "api-version": APIVersion, 4514 } 4515 if maxresults != nil { 4516 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 4517 } 4518 4519 preparer := autorest.CreatePreparer( 4520 autorest.AsGet(), 4521 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4522 autorest.WithPathParameters("/secrets/{secret-name}/versions", pathParameters), 4523 autorest.WithQueryParameters(queryParameters)) 4524 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4525} 4526 4527// GetSecretVersionsSender sends the GetSecretVersions request. The method will close the 4528// http.Response Body if it receives an error. 4529func (client BaseClient) GetSecretVersionsSender(req *http.Request) (*http.Response, error) { 4530 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4531} 4532 4533// GetSecretVersionsResponder handles the response to the GetSecretVersions request. The method always 4534// closes the http.Response Body. 4535func (client BaseClient) GetSecretVersionsResponder(resp *http.Response) (result SecretListResult, err error) { 4536 err = autorest.Respond( 4537 resp, 4538 azure.WithErrorUnlessStatusCode(http.StatusOK), 4539 autorest.ByUnmarshallingJSON(&result), 4540 autorest.ByClosing()) 4541 result.Response = autorest.Response{Response: resp} 4542 return 4543} 4544 4545// getSecretVersionsNextResults retrieves the next set of results, if any. 4546func (client BaseClient) getSecretVersionsNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) { 4547 req, err := lastResults.secretListResultPreparer(ctx) 4548 if err != nil { 4549 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", nil, "Failure preparing next results request") 4550 } 4551 if req == nil { 4552 return 4553 } 4554 resp, err := client.GetSecretVersionsSender(req) 4555 if err != nil { 4556 result.Response = autorest.Response{Response: resp} 4557 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure sending next results request") 4558 } 4559 result, err = client.GetSecretVersionsResponder(resp) 4560 if err != nil { 4561 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getSecretVersionsNextResults", resp, "Failure responding to next results request") 4562 } 4563 return 4564} 4565 4566// GetSecretVersionsComplete enumerates all values, automatically crossing page boundaries as required. 4567func (client BaseClient) GetSecretVersionsComplete(ctx context.Context, vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResultIterator, err error) { 4568 if tracing.IsEnabled() { 4569 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSecretVersions") 4570 defer func() { 4571 sc := -1 4572 if result.Response().Response.Response != nil { 4573 sc = result.page.Response().Response.Response.StatusCode 4574 } 4575 tracing.EndSpan(ctx, sc, err) 4576 }() 4577 } 4578 result.page, err = client.GetSecretVersions(ctx, vaultBaseURL, secretName, maxresults) 4579 return 4580} 4581 4582// GetStorageAccount gets information about a specified storage account. This operation requires the storage/get 4583// permission. 4584// Parameters: 4585// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4586// storageAccountName - the name of the storage account. 4587func (client BaseClient) GetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) { 4588 if tracing.IsEnabled() { 4589 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccount") 4590 defer func() { 4591 sc := -1 4592 if result.Response.Response != nil { 4593 sc = result.Response.Response.StatusCode 4594 } 4595 tracing.EndSpan(ctx, sc, err) 4596 }() 4597 } 4598 if err := validation.Validate([]validation.Validation{ 4599 {TargetValue: storageAccountName, 4600 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 4601 return result, validation.NewError("keyvault.BaseClient", "GetStorageAccount", err.Error()) 4602 } 4603 4604 req, err := client.GetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 4605 if err != nil { 4606 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", nil, "Failure preparing request") 4607 return 4608 } 4609 4610 resp, err := client.GetStorageAccountSender(req) 4611 if err != nil { 4612 result.Response = autorest.Response{Response: resp} 4613 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure sending request") 4614 return 4615 } 4616 4617 result, err = client.GetStorageAccountResponder(resp) 4618 if err != nil { 4619 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccount", resp, "Failure responding to request") 4620 return 4621 } 4622 4623 return 4624} 4625 4626// GetStorageAccountPreparer prepares the GetStorageAccount request. 4627func (client BaseClient) GetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 4628 urlParameters := map[string]interface{}{ 4629 "vaultBaseUrl": vaultBaseURL, 4630 } 4631 4632 pathParameters := map[string]interface{}{ 4633 "storage-account-name": autorest.Encode("path", storageAccountName), 4634 } 4635 4636 const APIVersion = "7.2-preview" 4637 queryParameters := map[string]interface{}{ 4638 "api-version": APIVersion, 4639 } 4640 4641 preparer := autorest.CreatePreparer( 4642 autorest.AsGet(), 4643 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4644 autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), 4645 autorest.WithQueryParameters(queryParameters)) 4646 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4647} 4648 4649// GetStorageAccountSender sends the GetStorageAccount request. The method will close the 4650// http.Response Body if it receives an error. 4651func (client BaseClient) GetStorageAccountSender(req *http.Request) (*http.Response, error) { 4652 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4653} 4654 4655// GetStorageAccountResponder handles the response to the GetStorageAccount request. The method always 4656// closes the http.Response Body. 4657func (client BaseClient) GetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { 4658 err = autorest.Respond( 4659 resp, 4660 azure.WithErrorUnlessStatusCode(http.StatusOK), 4661 autorest.ByUnmarshallingJSON(&result), 4662 autorest.ByClosing()) 4663 result.Response = autorest.Response{Response: resp} 4664 return 4665} 4666 4667// GetStorageAccounts list storage accounts managed by the specified key vault. This operation requires the 4668// storage/list permission. 4669// Parameters: 4670// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4671// maxresults - maximum number of results to return in a page. If not specified the service will return up to 4672// 25 results. 4673func (client BaseClient) GetStorageAccounts(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultPage, err error) { 4674 if tracing.IsEnabled() { 4675 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccounts") 4676 defer func() { 4677 sc := -1 4678 if result.slr.Response.Response != nil { 4679 sc = result.slr.Response.Response.StatusCode 4680 } 4681 tracing.EndSpan(ctx, sc, err) 4682 }() 4683 } 4684 if err := validation.Validate([]validation.Validation{ 4685 {TargetValue: maxresults, 4686 Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, 4687 Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: int64(25), Chain: nil}, 4688 {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 4689 }}}}}); err != nil { 4690 return result, validation.NewError("keyvault.BaseClient", "GetStorageAccounts", err.Error()) 4691 } 4692 4693 result.fn = client.getStorageAccountsNextResults 4694 req, err := client.GetStorageAccountsPreparer(ctx, vaultBaseURL, maxresults) 4695 if err != nil { 4696 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", nil, "Failure preparing request") 4697 return 4698 } 4699 4700 resp, err := client.GetStorageAccountsSender(req) 4701 if err != nil { 4702 result.slr.Response = autorest.Response{Response: resp} 4703 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure sending request") 4704 return 4705 } 4706 4707 result.slr, err = client.GetStorageAccountsResponder(resp) 4708 if err != nil { 4709 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "GetStorageAccounts", resp, "Failure responding to request") 4710 return 4711 } 4712 if result.slr.hasNextLink() && result.slr.IsEmpty() { 4713 err = result.NextWithContext(ctx) 4714 return 4715 } 4716 4717 return 4718} 4719 4720// GetStorageAccountsPreparer prepares the GetStorageAccounts request. 4721func (client BaseClient) GetStorageAccountsPreparer(ctx context.Context, vaultBaseURL string, maxresults *int32) (*http.Request, error) { 4722 urlParameters := map[string]interface{}{ 4723 "vaultBaseUrl": vaultBaseURL, 4724 } 4725 4726 const APIVersion = "7.2-preview" 4727 queryParameters := map[string]interface{}{ 4728 "api-version": APIVersion, 4729 } 4730 if maxresults != nil { 4731 queryParameters["maxresults"] = autorest.Encode("query", *maxresults) 4732 } 4733 4734 preparer := autorest.CreatePreparer( 4735 autorest.AsGet(), 4736 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4737 autorest.WithPath("/storage"), 4738 autorest.WithQueryParameters(queryParameters)) 4739 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4740} 4741 4742// GetStorageAccountsSender sends the GetStorageAccounts request. The method will close the 4743// http.Response Body if it receives an error. 4744func (client BaseClient) GetStorageAccountsSender(req *http.Request) (*http.Response, error) { 4745 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4746} 4747 4748// GetStorageAccountsResponder handles the response to the GetStorageAccounts request. The method always 4749// closes the http.Response Body. 4750func (client BaseClient) GetStorageAccountsResponder(resp *http.Response) (result StorageListResult, err error) { 4751 err = autorest.Respond( 4752 resp, 4753 azure.WithErrorUnlessStatusCode(http.StatusOK), 4754 autorest.ByUnmarshallingJSON(&result), 4755 autorest.ByClosing()) 4756 result.Response = autorest.Response{Response: resp} 4757 return 4758} 4759 4760// getStorageAccountsNextResults retrieves the next set of results, if any. 4761func (client BaseClient) getStorageAccountsNextResults(ctx context.Context, lastResults StorageListResult) (result StorageListResult, err error) { 4762 req, err := lastResults.storageListResultPreparer(ctx) 4763 if err != nil { 4764 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", nil, "Failure preparing next results request") 4765 } 4766 if req == nil { 4767 return 4768 } 4769 resp, err := client.GetStorageAccountsSender(req) 4770 if err != nil { 4771 result.Response = autorest.Response{Response: resp} 4772 return result, autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure sending next results request") 4773 } 4774 result, err = client.GetStorageAccountsResponder(resp) 4775 if err != nil { 4776 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "getStorageAccountsNextResults", resp, "Failure responding to next results request") 4777 } 4778 return 4779} 4780 4781// GetStorageAccountsComplete enumerates all values, automatically crossing page boundaries as required. 4782func (client BaseClient) GetStorageAccountsComplete(ctx context.Context, vaultBaseURL string, maxresults *int32) (result StorageListResultIterator, err error) { 4783 if tracing.IsEnabled() { 4784 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetStorageAccounts") 4785 defer func() { 4786 sc := -1 4787 if result.Response().Response.Response != nil { 4788 sc = result.page.Response().Response.Response.StatusCode 4789 } 4790 tracing.EndSpan(ctx, sc, err) 4791 }() 4792 } 4793 result.page, err = client.GetStorageAccounts(ctx, vaultBaseURL, maxresults) 4794 return 4795} 4796 4797// ImportCertificate imports an existing valid certificate, containing a private key, into Azure Key Vault. The 4798// certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must 4799// contain the key as well as x509 certificates. This operation requires the certificates/import permission. 4800// Parameters: 4801// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4802// certificateName - the name of the certificate. 4803// parameters - the parameters to import the certificate. 4804func (client BaseClient) ImportCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (result CertificateBundle, err error) { 4805 if tracing.IsEnabled() { 4806 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ImportCertificate") 4807 defer func() { 4808 sc := -1 4809 if result.Response.Response != nil { 4810 sc = result.Response.Response.StatusCode 4811 } 4812 tracing.EndSpan(ctx, sc, err) 4813 }() 4814 } 4815 if err := validation.Validate([]validation.Validation{ 4816 {TargetValue: certificateName, 4817 Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, 4818 {TargetValue: parameters, 4819 Constraints: []validation.Constraint{{Target: "parameters.Base64EncodedCertificate", Name: validation.Null, Rule: true, Chain: nil}, 4820 {Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, 4821 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, 4822 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, 4823 Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, 4824 }}, 4825 }}}}}); err != nil { 4826 return result, validation.NewError("keyvault.BaseClient", "ImportCertificate", err.Error()) 4827 } 4828 4829 req, err := client.ImportCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) 4830 if err != nil { 4831 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", nil, "Failure preparing request") 4832 return 4833 } 4834 4835 resp, err := client.ImportCertificateSender(req) 4836 if err != nil { 4837 result.Response = autorest.Response{Response: resp} 4838 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure sending request") 4839 return 4840 } 4841 4842 result, err = client.ImportCertificateResponder(resp) 4843 if err != nil { 4844 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportCertificate", resp, "Failure responding to request") 4845 return 4846 } 4847 4848 return 4849} 4850 4851// ImportCertificatePreparer prepares the ImportCertificate request. 4852func (client BaseClient) ImportCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (*http.Request, error) { 4853 urlParameters := map[string]interface{}{ 4854 "vaultBaseUrl": vaultBaseURL, 4855 } 4856 4857 pathParameters := map[string]interface{}{ 4858 "certificate-name": autorest.Encode("path", certificateName), 4859 } 4860 4861 const APIVersion = "7.2-preview" 4862 queryParameters := map[string]interface{}{ 4863 "api-version": APIVersion, 4864 } 4865 4866 preparer := autorest.CreatePreparer( 4867 autorest.AsContentType("application/json; charset=utf-8"), 4868 autorest.AsPost(), 4869 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4870 autorest.WithPathParameters("/certificates/{certificate-name}/import", pathParameters), 4871 autorest.WithJSON(parameters), 4872 autorest.WithQueryParameters(queryParameters)) 4873 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4874} 4875 4876// ImportCertificateSender sends the ImportCertificate request. The method will close the 4877// http.Response Body if it receives an error. 4878func (client BaseClient) ImportCertificateSender(req *http.Request) (*http.Response, error) { 4879 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4880} 4881 4882// ImportCertificateResponder handles the response to the ImportCertificate request. The method always 4883// closes the http.Response Body. 4884func (client BaseClient) ImportCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 4885 err = autorest.Respond( 4886 resp, 4887 azure.WithErrorUnlessStatusCode(http.StatusOK), 4888 autorest.ByUnmarshallingJSON(&result), 4889 autorest.ByClosing()) 4890 result.Response = autorest.Response{Response: resp} 4891 return 4892} 4893 4894// ImportKey the import key operation may be used to import any key type into an Azure Key Vault. If the named key 4895// already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import 4896// permission. 4897// Parameters: 4898// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4899// keyName - name for the imported key. 4900// parameters - the parameters to import a key. 4901func (client BaseClient) ImportKey(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (result KeyBundle, err error) { 4902 if tracing.IsEnabled() { 4903 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ImportKey") 4904 defer func() { 4905 sc := -1 4906 if result.Response.Response != nil { 4907 sc = result.Response.Response.StatusCode 4908 } 4909 tracing.EndSpan(ctx, sc, err) 4910 }() 4911 } 4912 if err := validation.Validate([]validation.Validation{ 4913 {TargetValue: keyName, 4914 Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, 4915 {TargetValue: parameters, 4916 Constraints: []validation.Constraint{{Target: "parameters.Key", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 4917 return result, validation.NewError("keyvault.BaseClient", "ImportKey", err.Error()) 4918 } 4919 4920 req, err := client.ImportKeyPreparer(ctx, vaultBaseURL, keyName, parameters) 4921 if err != nil { 4922 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", nil, "Failure preparing request") 4923 return 4924 } 4925 4926 resp, err := client.ImportKeySender(req) 4927 if err != nil { 4928 result.Response = autorest.Response{Response: resp} 4929 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure sending request") 4930 return 4931 } 4932 4933 result, err = client.ImportKeyResponder(resp) 4934 if err != nil { 4935 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "ImportKey", resp, "Failure responding to request") 4936 return 4937 } 4938 4939 return 4940} 4941 4942// ImportKeyPreparer prepares the ImportKey request. 4943func (client BaseClient) ImportKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, parameters KeyImportParameters) (*http.Request, error) { 4944 urlParameters := map[string]interface{}{ 4945 "vaultBaseUrl": vaultBaseURL, 4946 } 4947 4948 pathParameters := map[string]interface{}{ 4949 "key-name": autorest.Encode("path", keyName), 4950 } 4951 4952 const APIVersion = "7.2-preview" 4953 queryParameters := map[string]interface{}{ 4954 "api-version": APIVersion, 4955 } 4956 4957 preparer := autorest.CreatePreparer( 4958 autorest.AsContentType("application/json; charset=utf-8"), 4959 autorest.AsPut(), 4960 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 4961 autorest.WithPathParameters("/keys/{key-name}", pathParameters), 4962 autorest.WithJSON(parameters), 4963 autorest.WithQueryParameters(queryParameters)) 4964 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 4965} 4966 4967// ImportKeySender sends the ImportKey request. The method will close the 4968// http.Response Body if it receives an error. 4969func (client BaseClient) ImportKeySender(req *http.Request) (*http.Response, error) { 4970 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4971} 4972 4973// ImportKeyResponder handles the response to the ImportKey request. The method always 4974// closes the http.Response Body. 4975func (client BaseClient) ImportKeyResponder(resp *http.Response) (result KeyBundle, err error) { 4976 err = autorest.Respond( 4977 resp, 4978 azure.WithErrorUnlessStatusCode(http.StatusOK), 4979 autorest.ByUnmarshallingJSON(&result), 4980 autorest.ByClosing()) 4981 result.Response = autorest.Response{Response: resp} 4982 return 4983} 4984 4985// MergeCertificate the MergeCertificate operation performs the merging of a certificate or certificate chain with a 4986// key pair currently available in the service. This operation requires the certificates/create permission. 4987// Parameters: 4988// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 4989// certificateName - the name of the certificate. 4990// parameters - the parameters to merge certificate. 4991func (client BaseClient) MergeCertificate(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (result CertificateBundle, err error) { 4992 if tracing.IsEnabled() { 4993 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.MergeCertificate") 4994 defer func() { 4995 sc := -1 4996 if result.Response.Response != nil { 4997 sc = result.Response.Response.StatusCode 4998 } 4999 tracing.EndSpan(ctx, sc, err) 5000 }() 5001 } 5002 if err := validation.Validate([]validation.Validation{ 5003 {TargetValue: parameters, 5004 Constraints: []validation.Constraint{{Target: "parameters.X509Certificates", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 5005 return result, validation.NewError("keyvault.BaseClient", "MergeCertificate", err.Error()) 5006 } 5007 5008 req, err := client.MergeCertificatePreparer(ctx, vaultBaseURL, certificateName, parameters) 5009 if err != nil { 5010 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", nil, "Failure preparing request") 5011 return 5012 } 5013 5014 resp, err := client.MergeCertificateSender(req) 5015 if err != nil { 5016 result.Response = autorest.Response{Response: resp} 5017 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure sending request") 5018 return 5019 } 5020 5021 result, err = client.MergeCertificateResponder(resp) 5022 if err != nil { 5023 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "MergeCertificate", resp, "Failure responding to request") 5024 return 5025 } 5026 5027 return 5028} 5029 5030// MergeCertificatePreparer prepares the MergeCertificate request. 5031func (client BaseClient) MergeCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (*http.Request, error) { 5032 urlParameters := map[string]interface{}{ 5033 "vaultBaseUrl": vaultBaseURL, 5034 } 5035 5036 pathParameters := map[string]interface{}{ 5037 "certificate-name": autorest.Encode("path", certificateName), 5038 } 5039 5040 const APIVersion = "7.2-preview" 5041 queryParameters := map[string]interface{}{ 5042 "api-version": APIVersion, 5043 } 5044 5045 preparer := autorest.CreatePreparer( 5046 autorest.AsContentType("application/json; charset=utf-8"), 5047 autorest.AsPost(), 5048 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5049 autorest.WithPathParameters("/certificates/{certificate-name}/pending/merge", pathParameters), 5050 autorest.WithJSON(parameters), 5051 autorest.WithQueryParameters(queryParameters)) 5052 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5053} 5054 5055// MergeCertificateSender sends the MergeCertificate request. The method will close the 5056// http.Response Body if it receives an error. 5057func (client BaseClient) MergeCertificateSender(req *http.Request) (*http.Response, error) { 5058 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5059} 5060 5061// MergeCertificateResponder handles the response to the MergeCertificate request. The method always 5062// closes the http.Response Body. 5063func (client BaseClient) MergeCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 5064 err = autorest.Respond( 5065 resp, 5066 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 5067 autorest.ByUnmarshallingJSON(&result), 5068 autorest.ByClosing()) 5069 result.Response = autorest.Response{Response: resp} 5070 return 5071} 5072 5073// PurgeDeletedCertificate the PurgeDeletedCertificate operation performs an irreversible deletion of the specified 5074// certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 5075// 'Purgeable'. This operation requires the certificate/purge permission. 5076// Parameters: 5077// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5078// certificateName - the name of the certificate 5079func (client BaseClient) PurgeDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result autorest.Response, err error) { 5080 if tracing.IsEnabled() { 5081 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedCertificate") 5082 defer func() { 5083 sc := -1 5084 if result.Response != nil { 5085 sc = result.Response.StatusCode 5086 } 5087 tracing.EndSpan(ctx, sc, err) 5088 }() 5089 } 5090 req, err := client.PurgeDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) 5091 if err != nil { 5092 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", nil, "Failure preparing request") 5093 return 5094 } 5095 5096 resp, err := client.PurgeDeletedCertificateSender(req) 5097 if err != nil { 5098 result.Response = resp 5099 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure sending request") 5100 return 5101 } 5102 5103 result, err = client.PurgeDeletedCertificateResponder(resp) 5104 if err != nil { 5105 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedCertificate", resp, "Failure responding to request") 5106 return 5107 } 5108 5109 return 5110} 5111 5112// PurgeDeletedCertificatePreparer prepares the PurgeDeletedCertificate request. 5113func (client BaseClient) PurgeDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 5114 urlParameters := map[string]interface{}{ 5115 "vaultBaseUrl": vaultBaseURL, 5116 } 5117 5118 pathParameters := map[string]interface{}{ 5119 "certificate-name": autorest.Encode("path", certificateName), 5120 } 5121 5122 const APIVersion = "7.2-preview" 5123 queryParameters := map[string]interface{}{ 5124 "api-version": APIVersion, 5125 } 5126 5127 preparer := autorest.CreatePreparer( 5128 autorest.AsDelete(), 5129 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5130 autorest.WithPathParameters("/deletedcertificates/{certificate-name}", pathParameters), 5131 autorest.WithQueryParameters(queryParameters)) 5132 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5133} 5134 5135// PurgeDeletedCertificateSender sends the PurgeDeletedCertificate request. The method will close the 5136// http.Response Body if it receives an error. 5137func (client BaseClient) PurgeDeletedCertificateSender(req *http.Request) (*http.Response, error) { 5138 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5139} 5140 5141// PurgeDeletedCertificateResponder handles the response to the PurgeDeletedCertificate request. The method always 5142// closes the http.Response Body. 5143func (client BaseClient) PurgeDeletedCertificateResponder(resp *http.Response) (result autorest.Response, err error) { 5144 err = autorest.Respond( 5145 resp, 5146 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 5147 autorest.ByClosing()) 5148 result.Response = resp 5149 return 5150} 5151 5152// PurgeDeletedKey the Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation 5153// can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation 5154// requires the keys/purge permission. 5155// Parameters: 5156// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5157// keyName - the name of the key 5158func (client BaseClient) PurgeDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result autorest.Response, err error) { 5159 if tracing.IsEnabled() { 5160 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedKey") 5161 defer func() { 5162 sc := -1 5163 if result.Response != nil { 5164 sc = result.Response.StatusCode 5165 } 5166 tracing.EndSpan(ctx, sc, err) 5167 }() 5168 } 5169 req, err := client.PurgeDeletedKeyPreparer(ctx, vaultBaseURL, keyName) 5170 if err != nil { 5171 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", nil, "Failure preparing request") 5172 return 5173 } 5174 5175 resp, err := client.PurgeDeletedKeySender(req) 5176 if err != nil { 5177 result.Response = resp 5178 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure sending request") 5179 return 5180 } 5181 5182 result, err = client.PurgeDeletedKeyResponder(resp) 5183 if err != nil { 5184 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedKey", resp, "Failure responding to request") 5185 return 5186 } 5187 5188 return 5189} 5190 5191// PurgeDeletedKeyPreparer prepares the PurgeDeletedKey request. 5192func (client BaseClient) PurgeDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { 5193 urlParameters := map[string]interface{}{ 5194 "vaultBaseUrl": vaultBaseURL, 5195 } 5196 5197 pathParameters := map[string]interface{}{ 5198 "key-name": autorest.Encode("path", keyName), 5199 } 5200 5201 const APIVersion = "7.2-preview" 5202 queryParameters := map[string]interface{}{ 5203 "api-version": APIVersion, 5204 } 5205 5206 preparer := autorest.CreatePreparer( 5207 autorest.AsDelete(), 5208 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5209 autorest.WithPathParameters("/deletedkeys/{key-name}", pathParameters), 5210 autorest.WithQueryParameters(queryParameters)) 5211 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5212} 5213 5214// PurgeDeletedKeySender sends the PurgeDeletedKey request. The method will close the 5215// http.Response Body if it receives an error. 5216func (client BaseClient) PurgeDeletedKeySender(req *http.Request) (*http.Response, error) { 5217 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5218} 5219 5220// PurgeDeletedKeyResponder handles the response to the PurgeDeletedKey request. The method always 5221// closes the http.Response Body. 5222func (client BaseClient) PurgeDeletedKeyResponder(resp *http.Response) (result autorest.Response, err error) { 5223 err = autorest.Respond( 5224 resp, 5225 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 5226 autorest.ByClosing()) 5227 result.Response = resp 5228 return 5229} 5230 5231// PurgeDeletedSecret the purge deleted secret operation removes the secret permanently, without the possibility of 5232// recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the 5233// secrets/purge permission. 5234// Parameters: 5235// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5236// secretName - the name of the secret. 5237func (client BaseClient) PurgeDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result autorest.Response, err error) { 5238 if tracing.IsEnabled() { 5239 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedSecret") 5240 defer func() { 5241 sc := -1 5242 if result.Response != nil { 5243 sc = result.Response.StatusCode 5244 } 5245 tracing.EndSpan(ctx, sc, err) 5246 }() 5247 } 5248 req, err := client.PurgeDeletedSecretPreparer(ctx, vaultBaseURL, secretName) 5249 if err != nil { 5250 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", nil, "Failure preparing request") 5251 return 5252 } 5253 5254 resp, err := client.PurgeDeletedSecretSender(req) 5255 if err != nil { 5256 result.Response = resp 5257 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure sending request") 5258 return 5259 } 5260 5261 result, err = client.PurgeDeletedSecretResponder(resp) 5262 if err != nil { 5263 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedSecret", resp, "Failure responding to request") 5264 return 5265 } 5266 5267 return 5268} 5269 5270// PurgeDeletedSecretPreparer prepares the PurgeDeletedSecret request. 5271func (client BaseClient) PurgeDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { 5272 urlParameters := map[string]interface{}{ 5273 "vaultBaseUrl": vaultBaseURL, 5274 } 5275 5276 pathParameters := map[string]interface{}{ 5277 "secret-name": autorest.Encode("path", secretName), 5278 } 5279 5280 const APIVersion = "7.2-preview" 5281 queryParameters := map[string]interface{}{ 5282 "api-version": APIVersion, 5283 } 5284 5285 preparer := autorest.CreatePreparer( 5286 autorest.AsDelete(), 5287 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5288 autorest.WithPathParameters("/deletedsecrets/{secret-name}", pathParameters), 5289 autorest.WithQueryParameters(queryParameters)) 5290 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5291} 5292 5293// PurgeDeletedSecretSender sends the PurgeDeletedSecret request. The method will close the 5294// http.Response Body if it receives an error. 5295func (client BaseClient) PurgeDeletedSecretSender(req *http.Request) (*http.Response, error) { 5296 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5297} 5298 5299// PurgeDeletedSecretResponder handles the response to the PurgeDeletedSecret request. The method always 5300// closes the http.Response Body. 5301func (client BaseClient) PurgeDeletedSecretResponder(resp *http.Response) (result autorest.Response, err error) { 5302 err = autorest.Respond( 5303 resp, 5304 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 5305 autorest.ByClosing()) 5306 result.Response = resp 5307 return 5308} 5309 5310// PurgeDeletedStorageAccount the purge deleted storage account operation removes the secret permanently, without the 5311// possibility of recovery. This operation can only be performed on a soft-delete enabled vault. This operation 5312// requires the storage/purge permission. 5313// Parameters: 5314// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5315// storageAccountName - the name of the storage account. 5316func (client BaseClient) PurgeDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result autorest.Response, err error) { 5317 if tracing.IsEnabled() { 5318 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PurgeDeletedStorageAccount") 5319 defer func() { 5320 sc := -1 5321 if result.Response != nil { 5322 sc = result.Response.StatusCode 5323 } 5324 tracing.EndSpan(ctx, sc, err) 5325 }() 5326 } 5327 if err := validation.Validate([]validation.Validation{ 5328 {TargetValue: storageAccountName, 5329 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 5330 return result, validation.NewError("keyvault.BaseClient", "PurgeDeletedStorageAccount", err.Error()) 5331 } 5332 5333 req, err := client.PurgeDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 5334 if err != nil { 5335 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", nil, "Failure preparing request") 5336 return 5337 } 5338 5339 resp, err := client.PurgeDeletedStorageAccountSender(req) 5340 if err != nil { 5341 result.Response = resp 5342 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure sending request") 5343 return 5344 } 5345 5346 result, err = client.PurgeDeletedStorageAccountResponder(resp) 5347 if err != nil { 5348 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "PurgeDeletedStorageAccount", resp, "Failure responding to request") 5349 return 5350 } 5351 5352 return 5353} 5354 5355// PurgeDeletedStorageAccountPreparer prepares the PurgeDeletedStorageAccount request. 5356func (client BaseClient) PurgeDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 5357 urlParameters := map[string]interface{}{ 5358 "vaultBaseUrl": vaultBaseURL, 5359 } 5360 5361 pathParameters := map[string]interface{}{ 5362 "storage-account-name": autorest.Encode("path", storageAccountName), 5363 } 5364 5365 const APIVersion = "7.2-preview" 5366 queryParameters := map[string]interface{}{ 5367 "api-version": APIVersion, 5368 } 5369 5370 preparer := autorest.CreatePreparer( 5371 autorest.AsDelete(), 5372 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5373 autorest.WithPathParameters("/deletedstorage/{storage-account-name}", pathParameters), 5374 autorest.WithQueryParameters(queryParameters)) 5375 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5376} 5377 5378// PurgeDeletedStorageAccountSender sends the PurgeDeletedStorageAccount request. The method will close the 5379// http.Response Body if it receives an error. 5380func (client BaseClient) PurgeDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { 5381 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5382} 5383 5384// PurgeDeletedStorageAccountResponder handles the response to the PurgeDeletedStorageAccount request. The method always 5385// closes the http.Response Body. 5386func (client BaseClient) PurgeDeletedStorageAccountResponder(resp *http.Response) (result autorest.Response, err error) { 5387 err = autorest.Respond( 5388 resp, 5389 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 5390 autorest.ByClosing()) 5391 result.Response = resp 5392 return 5393} 5394 5395// RecoverDeletedCertificate the RecoverDeletedCertificate operation performs the reversal of the Delete operation. The 5396// operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval 5397// (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. 5398// Parameters: 5399// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5400// certificateName - the name of the deleted certificate 5401func (client BaseClient) RecoverDeletedCertificate(ctx context.Context, vaultBaseURL string, certificateName string) (result CertificateBundle, err error) { 5402 if tracing.IsEnabled() { 5403 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedCertificate") 5404 defer func() { 5405 sc := -1 5406 if result.Response.Response != nil { 5407 sc = result.Response.Response.StatusCode 5408 } 5409 tracing.EndSpan(ctx, sc, err) 5410 }() 5411 } 5412 req, err := client.RecoverDeletedCertificatePreparer(ctx, vaultBaseURL, certificateName) 5413 if err != nil { 5414 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", nil, "Failure preparing request") 5415 return 5416 } 5417 5418 resp, err := client.RecoverDeletedCertificateSender(req) 5419 if err != nil { 5420 result.Response = autorest.Response{Response: resp} 5421 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure sending request") 5422 return 5423 } 5424 5425 result, err = client.RecoverDeletedCertificateResponder(resp) 5426 if err != nil { 5427 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedCertificate", resp, "Failure responding to request") 5428 return 5429 } 5430 5431 return 5432} 5433 5434// RecoverDeletedCertificatePreparer prepares the RecoverDeletedCertificate request. 5435func (client BaseClient) RecoverDeletedCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string) (*http.Request, error) { 5436 urlParameters := map[string]interface{}{ 5437 "vaultBaseUrl": vaultBaseURL, 5438 } 5439 5440 pathParameters := map[string]interface{}{ 5441 "certificate-name": autorest.Encode("path", certificateName), 5442 } 5443 5444 const APIVersion = "7.2-preview" 5445 queryParameters := map[string]interface{}{ 5446 "api-version": APIVersion, 5447 } 5448 5449 preparer := autorest.CreatePreparer( 5450 autorest.AsPost(), 5451 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5452 autorest.WithPathParameters("/deletedcertificates/{certificate-name}/recover", pathParameters), 5453 autorest.WithQueryParameters(queryParameters)) 5454 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5455} 5456 5457// RecoverDeletedCertificateSender sends the RecoverDeletedCertificate request. The method will close the 5458// http.Response Body if it receives an error. 5459func (client BaseClient) RecoverDeletedCertificateSender(req *http.Request) (*http.Response, error) { 5460 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5461} 5462 5463// RecoverDeletedCertificateResponder handles the response to the RecoverDeletedCertificate request. The method always 5464// closes the http.Response Body. 5465func (client BaseClient) RecoverDeletedCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 5466 err = autorest.Respond( 5467 resp, 5468 azure.WithErrorUnlessStatusCode(http.StatusOK), 5469 autorest.ByUnmarshallingJSON(&result), 5470 autorest.ByClosing()) 5471 result.Response = autorest.Response{Response: resp} 5472 return 5473} 5474 5475// RecoverDeletedKey the Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It 5476// recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will 5477// return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation 5478// requires the keys/recover permission. 5479// Parameters: 5480// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5481// keyName - the name of the deleted key. 5482func (client BaseClient) RecoverDeletedKey(ctx context.Context, vaultBaseURL string, keyName string) (result KeyBundle, err error) { 5483 if tracing.IsEnabled() { 5484 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedKey") 5485 defer func() { 5486 sc := -1 5487 if result.Response.Response != nil { 5488 sc = result.Response.Response.StatusCode 5489 } 5490 tracing.EndSpan(ctx, sc, err) 5491 }() 5492 } 5493 req, err := client.RecoverDeletedKeyPreparer(ctx, vaultBaseURL, keyName) 5494 if err != nil { 5495 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", nil, "Failure preparing request") 5496 return 5497 } 5498 5499 resp, err := client.RecoverDeletedKeySender(req) 5500 if err != nil { 5501 result.Response = autorest.Response{Response: resp} 5502 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure sending request") 5503 return 5504 } 5505 5506 result, err = client.RecoverDeletedKeyResponder(resp) 5507 if err != nil { 5508 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedKey", resp, "Failure responding to request") 5509 return 5510 } 5511 5512 return 5513} 5514 5515// RecoverDeletedKeyPreparer prepares the RecoverDeletedKey request. 5516func (client BaseClient) RecoverDeletedKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string) (*http.Request, error) { 5517 urlParameters := map[string]interface{}{ 5518 "vaultBaseUrl": vaultBaseURL, 5519 } 5520 5521 pathParameters := map[string]interface{}{ 5522 "key-name": autorest.Encode("path", keyName), 5523 } 5524 5525 const APIVersion = "7.2-preview" 5526 queryParameters := map[string]interface{}{ 5527 "api-version": APIVersion, 5528 } 5529 5530 preparer := autorest.CreatePreparer( 5531 autorest.AsPost(), 5532 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5533 autorest.WithPathParameters("/deletedkeys/{key-name}/recover", pathParameters), 5534 autorest.WithQueryParameters(queryParameters)) 5535 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5536} 5537 5538// RecoverDeletedKeySender sends the RecoverDeletedKey request. The method will close the 5539// http.Response Body if it receives an error. 5540func (client BaseClient) RecoverDeletedKeySender(req *http.Request) (*http.Response, error) { 5541 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5542} 5543 5544// RecoverDeletedKeyResponder handles the response to the RecoverDeletedKey request. The method always 5545// closes the http.Response Body. 5546func (client BaseClient) RecoverDeletedKeyResponder(resp *http.Response) (result KeyBundle, err error) { 5547 err = autorest.Respond( 5548 resp, 5549 azure.WithErrorUnlessStatusCode(http.StatusOK), 5550 autorest.ByUnmarshallingJSON(&result), 5551 autorest.ByClosing()) 5552 result.Response = autorest.Response{Response: resp} 5553 return 5554} 5555 5556// RecoverDeletedSasDefinition recovers the deleted SAS definition for the specified storage account. This operation 5557// can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission. 5558// Parameters: 5559// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5560// storageAccountName - the name of the storage account. 5561// sasDefinitionName - the name of the SAS definition. 5562func (client BaseClient) RecoverDeletedSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (result SasDefinitionBundle, err error) { 5563 if tracing.IsEnabled() { 5564 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedSasDefinition") 5565 defer func() { 5566 sc := -1 5567 if result.Response.Response != nil { 5568 sc = result.Response.Response.StatusCode 5569 } 5570 tracing.EndSpan(ctx, sc, err) 5571 }() 5572 } 5573 if err := validation.Validate([]validation.Validation{ 5574 {TargetValue: storageAccountName, 5575 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 5576 {TargetValue: sasDefinitionName, 5577 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 5578 return result, validation.NewError("keyvault.BaseClient", "RecoverDeletedSasDefinition", err.Error()) 5579 } 5580 5581 req, err := client.RecoverDeletedSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName) 5582 if err != nil { 5583 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", nil, "Failure preparing request") 5584 return 5585 } 5586 5587 resp, err := client.RecoverDeletedSasDefinitionSender(req) 5588 if err != nil { 5589 result.Response = autorest.Response{Response: resp} 5590 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", resp, "Failure sending request") 5591 return 5592 } 5593 5594 result, err = client.RecoverDeletedSasDefinitionResponder(resp) 5595 if err != nil { 5596 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSasDefinition", resp, "Failure responding to request") 5597 return 5598 } 5599 5600 return 5601} 5602 5603// RecoverDeletedSasDefinitionPreparer prepares the RecoverDeletedSasDefinition request. 5604func (client BaseClient) RecoverDeletedSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string) (*http.Request, error) { 5605 urlParameters := map[string]interface{}{ 5606 "vaultBaseUrl": vaultBaseURL, 5607 } 5608 5609 pathParameters := map[string]interface{}{ 5610 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 5611 "storage-account-name": autorest.Encode("path", storageAccountName), 5612 } 5613 5614 const APIVersion = "7.2-preview" 5615 queryParameters := map[string]interface{}{ 5616 "api-version": APIVersion, 5617 } 5618 5619 preparer := autorest.CreatePreparer( 5620 autorest.AsPost(), 5621 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5622 autorest.WithPathParameters("/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover", pathParameters), 5623 autorest.WithQueryParameters(queryParameters)) 5624 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5625} 5626 5627// RecoverDeletedSasDefinitionSender sends the RecoverDeletedSasDefinition request. The method will close the 5628// http.Response Body if it receives an error. 5629func (client BaseClient) RecoverDeletedSasDefinitionSender(req *http.Request) (*http.Response, error) { 5630 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5631} 5632 5633// RecoverDeletedSasDefinitionResponder handles the response to the RecoverDeletedSasDefinition request. The method always 5634// closes the http.Response Body. 5635func (client BaseClient) RecoverDeletedSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { 5636 err = autorest.Respond( 5637 resp, 5638 azure.WithErrorUnlessStatusCode(http.StatusOK), 5639 autorest.ByUnmarshallingJSON(&result), 5640 autorest.ByClosing()) 5641 result.Response = autorest.Response{Response: resp} 5642 return 5643} 5644 5645// RecoverDeletedSecret recovers the deleted secret in the specified vault. This operation can only be performed on a 5646// soft-delete enabled vault. This operation requires the secrets/recover permission. 5647// Parameters: 5648// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5649// secretName - the name of the deleted secret. 5650func (client BaseClient) RecoverDeletedSecret(ctx context.Context, vaultBaseURL string, secretName string) (result SecretBundle, err error) { 5651 if tracing.IsEnabled() { 5652 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedSecret") 5653 defer func() { 5654 sc := -1 5655 if result.Response.Response != nil { 5656 sc = result.Response.Response.StatusCode 5657 } 5658 tracing.EndSpan(ctx, sc, err) 5659 }() 5660 } 5661 req, err := client.RecoverDeletedSecretPreparer(ctx, vaultBaseURL, secretName) 5662 if err != nil { 5663 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", nil, "Failure preparing request") 5664 return 5665 } 5666 5667 resp, err := client.RecoverDeletedSecretSender(req) 5668 if err != nil { 5669 result.Response = autorest.Response{Response: resp} 5670 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure sending request") 5671 return 5672 } 5673 5674 result, err = client.RecoverDeletedSecretResponder(resp) 5675 if err != nil { 5676 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedSecret", resp, "Failure responding to request") 5677 return 5678 } 5679 5680 return 5681} 5682 5683// RecoverDeletedSecretPreparer prepares the RecoverDeletedSecret request. 5684func (client BaseClient) RecoverDeletedSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string) (*http.Request, error) { 5685 urlParameters := map[string]interface{}{ 5686 "vaultBaseUrl": vaultBaseURL, 5687 } 5688 5689 pathParameters := map[string]interface{}{ 5690 "secret-name": autorest.Encode("path", secretName), 5691 } 5692 5693 const APIVersion = "7.2-preview" 5694 queryParameters := map[string]interface{}{ 5695 "api-version": APIVersion, 5696 } 5697 5698 preparer := autorest.CreatePreparer( 5699 autorest.AsPost(), 5700 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5701 autorest.WithPathParameters("/deletedsecrets/{secret-name}/recover", pathParameters), 5702 autorest.WithQueryParameters(queryParameters)) 5703 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5704} 5705 5706// RecoverDeletedSecretSender sends the RecoverDeletedSecret request. The method will close the 5707// http.Response Body if it receives an error. 5708func (client BaseClient) RecoverDeletedSecretSender(req *http.Request) (*http.Response, error) { 5709 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5710} 5711 5712// RecoverDeletedSecretResponder handles the response to the RecoverDeletedSecret request. The method always 5713// closes the http.Response Body. 5714func (client BaseClient) RecoverDeletedSecretResponder(resp *http.Response) (result SecretBundle, err error) { 5715 err = autorest.Respond( 5716 resp, 5717 azure.WithErrorUnlessStatusCode(http.StatusOK), 5718 autorest.ByUnmarshallingJSON(&result), 5719 autorest.ByClosing()) 5720 result.Response = autorest.Response{Response: resp} 5721 return 5722} 5723 5724// RecoverDeletedStorageAccount recovers the deleted storage account in the specified vault. This operation can only be 5725// performed on a soft-delete enabled vault. This operation requires the storage/recover permission. 5726// Parameters: 5727// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5728// storageAccountName - the name of the storage account. 5729func (client BaseClient) RecoverDeletedStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string) (result StorageBundle, err error) { 5730 if tracing.IsEnabled() { 5731 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RecoverDeletedStorageAccount") 5732 defer func() { 5733 sc := -1 5734 if result.Response.Response != nil { 5735 sc = result.Response.Response.StatusCode 5736 } 5737 tracing.EndSpan(ctx, sc, err) 5738 }() 5739 } 5740 if err := validation.Validate([]validation.Validation{ 5741 {TargetValue: storageAccountName, 5742 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 5743 return result, validation.NewError("keyvault.BaseClient", "RecoverDeletedStorageAccount", err.Error()) 5744 } 5745 5746 req, err := client.RecoverDeletedStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName) 5747 if err != nil { 5748 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", nil, "Failure preparing request") 5749 return 5750 } 5751 5752 resp, err := client.RecoverDeletedStorageAccountSender(req) 5753 if err != nil { 5754 result.Response = autorest.Response{Response: resp} 5755 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", resp, "Failure sending request") 5756 return 5757 } 5758 5759 result, err = client.RecoverDeletedStorageAccountResponder(resp) 5760 if err != nil { 5761 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RecoverDeletedStorageAccount", resp, "Failure responding to request") 5762 return 5763 } 5764 5765 return 5766} 5767 5768// RecoverDeletedStorageAccountPreparer prepares the RecoverDeletedStorageAccount request. 5769func (client BaseClient) RecoverDeletedStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string) (*http.Request, error) { 5770 urlParameters := map[string]interface{}{ 5771 "vaultBaseUrl": vaultBaseURL, 5772 } 5773 5774 pathParameters := map[string]interface{}{ 5775 "storage-account-name": autorest.Encode("path", storageAccountName), 5776 } 5777 5778 const APIVersion = "7.2-preview" 5779 queryParameters := map[string]interface{}{ 5780 "api-version": APIVersion, 5781 } 5782 5783 preparer := autorest.CreatePreparer( 5784 autorest.AsPost(), 5785 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5786 autorest.WithPathParameters("/deletedstorage/{storage-account-name}/recover", pathParameters), 5787 autorest.WithQueryParameters(queryParameters)) 5788 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5789} 5790 5791// RecoverDeletedStorageAccountSender sends the RecoverDeletedStorageAccount request. The method will close the 5792// http.Response Body if it receives an error. 5793func (client BaseClient) RecoverDeletedStorageAccountSender(req *http.Request) (*http.Response, error) { 5794 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5795} 5796 5797// RecoverDeletedStorageAccountResponder handles the response to the RecoverDeletedStorageAccount request. The method always 5798// closes the http.Response Body. 5799func (client BaseClient) RecoverDeletedStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { 5800 err = autorest.Respond( 5801 resp, 5802 azure.WithErrorUnlessStatusCode(http.StatusOK), 5803 autorest.ByUnmarshallingJSON(&result), 5804 autorest.ByClosing()) 5805 result.Response = autorest.Response{Response: resp} 5806 return 5807} 5808 5809// RegenerateStorageAccountKey regenerates the specified key value for the given storage account. This operation 5810// requires the storage/regeneratekey permission. 5811// Parameters: 5812// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5813// storageAccountName - the name of the storage account. 5814// parameters - the parameters to regenerate storage account key. 5815func (client BaseClient) RegenerateStorageAccountKey(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (result StorageBundle, err error) { 5816 if tracing.IsEnabled() { 5817 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RegenerateStorageAccountKey") 5818 defer func() { 5819 sc := -1 5820 if result.Response.Response != nil { 5821 sc = result.Response.Response.StatusCode 5822 } 5823 tracing.EndSpan(ctx, sc, err) 5824 }() 5825 } 5826 if err := validation.Validate([]validation.Validation{ 5827 {TargetValue: storageAccountName, 5828 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 5829 {TargetValue: parameters, 5830 Constraints: []validation.Constraint{{Target: "parameters.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 5831 return result, validation.NewError("keyvault.BaseClient", "RegenerateStorageAccountKey", err.Error()) 5832 } 5833 5834 req, err := client.RegenerateStorageAccountKeyPreparer(ctx, vaultBaseURL, storageAccountName, parameters) 5835 if err != nil { 5836 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", nil, "Failure preparing request") 5837 return 5838 } 5839 5840 resp, err := client.RegenerateStorageAccountKeySender(req) 5841 if err != nil { 5842 result.Response = autorest.Response{Response: resp} 5843 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure sending request") 5844 return 5845 } 5846 5847 result, err = client.RegenerateStorageAccountKeyResponder(resp) 5848 if err != nil { 5849 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RegenerateStorageAccountKey", resp, "Failure responding to request") 5850 return 5851 } 5852 5853 return 5854} 5855 5856// RegenerateStorageAccountKeyPreparer prepares the RegenerateStorageAccountKey request. 5857func (client BaseClient) RegenerateStorageAccountKeyPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountRegenerteKeyParameters) (*http.Request, error) { 5858 urlParameters := map[string]interface{}{ 5859 "vaultBaseUrl": vaultBaseURL, 5860 } 5861 5862 pathParameters := map[string]interface{}{ 5863 "storage-account-name": autorest.Encode("path", storageAccountName), 5864 } 5865 5866 const APIVersion = "7.2-preview" 5867 queryParameters := map[string]interface{}{ 5868 "api-version": APIVersion, 5869 } 5870 5871 preparer := autorest.CreatePreparer( 5872 autorest.AsContentType("application/json; charset=utf-8"), 5873 autorest.AsPost(), 5874 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5875 autorest.WithPathParameters("/storage/{storage-account-name}/regeneratekey", pathParameters), 5876 autorest.WithJSON(parameters), 5877 autorest.WithQueryParameters(queryParameters)) 5878 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5879} 5880 5881// RegenerateStorageAccountKeySender sends the RegenerateStorageAccountKey request. The method will close the 5882// http.Response Body if it receives an error. 5883func (client BaseClient) RegenerateStorageAccountKeySender(req *http.Request) (*http.Response, error) { 5884 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5885} 5886 5887// RegenerateStorageAccountKeyResponder handles the response to the RegenerateStorageAccountKey request. The method always 5888// closes the http.Response Body. 5889func (client BaseClient) RegenerateStorageAccountKeyResponder(resp *http.Response) (result StorageBundle, err error) { 5890 err = autorest.Respond( 5891 resp, 5892 azure.WithErrorUnlessStatusCode(http.StatusOK), 5893 autorest.ByUnmarshallingJSON(&result), 5894 autorest.ByClosing()) 5895 result.Response = autorest.Response{Response: resp} 5896 return 5897} 5898 5899// RestoreCertificate restores a backed up certificate, and all its versions, to a vault. This operation requires the 5900// certificates/restore permission. 5901// Parameters: 5902// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5903// parameters - the parameters to restore the certificate. 5904func (client BaseClient) RestoreCertificate(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (result CertificateBundle, err error) { 5905 if tracing.IsEnabled() { 5906 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreCertificate") 5907 defer func() { 5908 sc := -1 5909 if result.Response.Response != nil { 5910 sc = result.Response.Response.StatusCode 5911 } 5912 tracing.EndSpan(ctx, sc, err) 5913 }() 5914 } 5915 if err := validation.Validate([]validation.Validation{ 5916 {TargetValue: parameters, 5917 Constraints: []validation.Constraint{{Target: "parameters.CertificateBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 5918 return result, validation.NewError("keyvault.BaseClient", "RestoreCertificate", err.Error()) 5919 } 5920 5921 req, err := client.RestoreCertificatePreparer(ctx, vaultBaseURL, parameters) 5922 if err != nil { 5923 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", nil, "Failure preparing request") 5924 return 5925 } 5926 5927 resp, err := client.RestoreCertificateSender(req) 5928 if err != nil { 5929 result.Response = autorest.Response{Response: resp} 5930 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure sending request") 5931 return 5932 } 5933 5934 result, err = client.RestoreCertificateResponder(resp) 5935 if err != nil { 5936 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreCertificate", resp, "Failure responding to request") 5937 return 5938 } 5939 5940 return 5941} 5942 5943// RestoreCertificatePreparer prepares the RestoreCertificate request. 5944func (client BaseClient) RestoreCertificatePreparer(ctx context.Context, vaultBaseURL string, parameters CertificateRestoreParameters) (*http.Request, error) { 5945 urlParameters := map[string]interface{}{ 5946 "vaultBaseUrl": vaultBaseURL, 5947 } 5948 5949 const APIVersion = "7.2-preview" 5950 queryParameters := map[string]interface{}{ 5951 "api-version": APIVersion, 5952 } 5953 5954 preparer := autorest.CreatePreparer( 5955 autorest.AsContentType("application/json; charset=utf-8"), 5956 autorest.AsPost(), 5957 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 5958 autorest.WithPath("/certificates/restore"), 5959 autorest.WithJSON(parameters), 5960 autorest.WithQueryParameters(queryParameters)) 5961 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 5962} 5963 5964// RestoreCertificateSender sends the RestoreCertificate request. The method will close the 5965// http.Response Body if it receives an error. 5966func (client BaseClient) RestoreCertificateSender(req *http.Request) (*http.Response, error) { 5967 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5968} 5969 5970// RestoreCertificateResponder handles the response to the RestoreCertificate request. The method always 5971// closes the http.Response Body. 5972func (client BaseClient) RestoreCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 5973 err = autorest.Respond( 5974 resp, 5975 azure.WithErrorUnlessStatusCode(http.StatusOK), 5976 autorest.ByUnmarshallingJSON(&result), 5977 autorest.ByClosing()) 5978 result.Response = autorest.Response{Response: resp} 5979 return 5980} 5981 5982// RestoreKey imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, 5983// attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. 5984// Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it 5985// had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be 5986// rejected. While the key name is retained during restore, the final key identifier will change if the key is restored 5987// to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is 5988// subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the 5989// source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the 5990// keys/restore permission. 5991// Parameters: 5992// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 5993// parameters - the parameters to restore the key. 5994func (client BaseClient) RestoreKey(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (result KeyBundle, err error) { 5995 if tracing.IsEnabled() { 5996 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreKey") 5997 defer func() { 5998 sc := -1 5999 if result.Response.Response != nil { 6000 sc = result.Response.Response.StatusCode 6001 } 6002 tracing.EndSpan(ctx, sc, err) 6003 }() 6004 } 6005 if err := validation.Validate([]validation.Validation{ 6006 {TargetValue: parameters, 6007 Constraints: []validation.Constraint{{Target: "parameters.KeyBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6008 return result, validation.NewError("keyvault.BaseClient", "RestoreKey", err.Error()) 6009 } 6010 6011 req, err := client.RestoreKeyPreparer(ctx, vaultBaseURL, parameters) 6012 if err != nil { 6013 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", nil, "Failure preparing request") 6014 return 6015 } 6016 6017 resp, err := client.RestoreKeySender(req) 6018 if err != nil { 6019 result.Response = autorest.Response{Response: resp} 6020 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure sending request") 6021 return 6022 } 6023 6024 result, err = client.RestoreKeyResponder(resp) 6025 if err != nil { 6026 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreKey", resp, "Failure responding to request") 6027 return 6028 } 6029 6030 return 6031} 6032 6033// RestoreKeyPreparer prepares the RestoreKey request. 6034func (client BaseClient) RestoreKeyPreparer(ctx context.Context, vaultBaseURL string, parameters KeyRestoreParameters) (*http.Request, error) { 6035 urlParameters := map[string]interface{}{ 6036 "vaultBaseUrl": vaultBaseURL, 6037 } 6038 6039 const APIVersion = "7.2-preview" 6040 queryParameters := map[string]interface{}{ 6041 "api-version": APIVersion, 6042 } 6043 6044 preparer := autorest.CreatePreparer( 6045 autorest.AsContentType("application/json; charset=utf-8"), 6046 autorest.AsPost(), 6047 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6048 autorest.WithPath("/keys/restore"), 6049 autorest.WithJSON(parameters), 6050 autorest.WithQueryParameters(queryParameters)) 6051 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6052} 6053 6054// RestoreKeySender sends the RestoreKey request. The method will close the 6055// http.Response Body if it receives an error. 6056func (client BaseClient) RestoreKeySender(req *http.Request) (*http.Response, error) { 6057 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6058} 6059 6060// RestoreKeyResponder handles the response to the RestoreKey request. The method always 6061// closes the http.Response Body. 6062func (client BaseClient) RestoreKeyResponder(resp *http.Response) (result KeyBundle, err error) { 6063 err = autorest.Respond( 6064 resp, 6065 azure.WithErrorUnlessStatusCode(http.StatusOK), 6066 autorest.ByUnmarshallingJSON(&result), 6067 autorest.ByClosing()) 6068 result.Response = autorest.Response{Response: resp} 6069 return 6070} 6071 6072// RestoreSecret restores a backed up secret, and all its versions, to a vault. This operation requires the 6073// secrets/restore permission. 6074// Parameters: 6075// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6076// parameters - the parameters to restore the secret. 6077func (client BaseClient) RestoreSecret(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (result SecretBundle, err error) { 6078 if tracing.IsEnabled() { 6079 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreSecret") 6080 defer func() { 6081 sc := -1 6082 if result.Response.Response != nil { 6083 sc = result.Response.Response.StatusCode 6084 } 6085 tracing.EndSpan(ctx, sc, err) 6086 }() 6087 } 6088 if err := validation.Validate([]validation.Validation{ 6089 {TargetValue: parameters, 6090 Constraints: []validation.Constraint{{Target: "parameters.SecretBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6091 return result, validation.NewError("keyvault.BaseClient", "RestoreSecret", err.Error()) 6092 } 6093 6094 req, err := client.RestoreSecretPreparer(ctx, vaultBaseURL, parameters) 6095 if err != nil { 6096 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", nil, "Failure preparing request") 6097 return 6098 } 6099 6100 resp, err := client.RestoreSecretSender(req) 6101 if err != nil { 6102 result.Response = autorest.Response{Response: resp} 6103 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure sending request") 6104 return 6105 } 6106 6107 result, err = client.RestoreSecretResponder(resp) 6108 if err != nil { 6109 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreSecret", resp, "Failure responding to request") 6110 return 6111 } 6112 6113 return 6114} 6115 6116// RestoreSecretPreparer prepares the RestoreSecret request. 6117func (client BaseClient) RestoreSecretPreparer(ctx context.Context, vaultBaseURL string, parameters SecretRestoreParameters) (*http.Request, error) { 6118 urlParameters := map[string]interface{}{ 6119 "vaultBaseUrl": vaultBaseURL, 6120 } 6121 6122 const APIVersion = "7.2-preview" 6123 queryParameters := map[string]interface{}{ 6124 "api-version": APIVersion, 6125 } 6126 6127 preparer := autorest.CreatePreparer( 6128 autorest.AsContentType("application/json; charset=utf-8"), 6129 autorest.AsPost(), 6130 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6131 autorest.WithPath("/secrets/restore"), 6132 autorest.WithJSON(parameters), 6133 autorest.WithQueryParameters(queryParameters)) 6134 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6135} 6136 6137// RestoreSecretSender sends the RestoreSecret request. The method will close the 6138// http.Response Body if it receives an error. 6139func (client BaseClient) RestoreSecretSender(req *http.Request) (*http.Response, error) { 6140 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6141} 6142 6143// RestoreSecretResponder handles the response to the RestoreSecret request. The method always 6144// closes the http.Response Body. 6145func (client BaseClient) RestoreSecretResponder(resp *http.Response) (result SecretBundle, err error) { 6146 err = autorest.Respond( 6147 resp, 6148 azure.WithErrorUnlessStatusCode(http.StatusOK), 6149 autorest.ByUnmarshallingJSON(&result), 6150 autorest.ByClosing()) 6151 result.Response = autorest.Response{Response: resp} 6152 return 6153} 6154 6155// RestoreStatus returns the status of restore operation 6156// Parameters: 6157// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6158// jobID - the Job Id returned part of the restore operation 6159func (client BaseClient) RestoreStatus(ctx context.Context, vaultBaseURL string, jobID string) (result RestoreOperation, err error) { 6160 if tracing.IsEnabled() { 6161 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreStatus") 6162 defer func() { 6163 sc := -1 6164 if result.Response.Response != nil { 6165 sc = result.Response.Response.StatusCode 6166 } 6167 tracing.EndSpan(ctx, sc, err) 6168 }() 6169 } 6170 req, err := client.RestoreStatusPreparer(ctx, vaultBaseURL, jobID) 6171 if err != nil { 6172 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStatus", nil, "Failure preparing request") 6173 return 6174 } 6175 6176 resp, err := client.RestoreStatusSender(req) 6177 if err != nil { 6178 result.Response = autorest.Response{Response: resp} 6179 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStatus", resp, "Failure sending request") 6180 return 6181 } 6182 6183 result, err = client.RestoreStatusResponder(resp) 6184 if err != nil { 6185 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStatus", resp, "Failure responding to request") 6186 return 6187 } 6188 6189 return 6190} 6191 6192// RestoreStatusPreparer prepares the RestoreStatus request. 6193func (client BaseClient) RestoreStatusPreparer(ctx context.Context, vaultBaseURL string, jobID string) (*http.Request, error) { 6194 urlParameters := map[string]interface{}{ 6195 "vaultBaseUrl": vaultBaseURL, 6196 } 6197 6198 pathParameters := map[string]interface{}{ 6199 "jobId": autorest.Encode("path", jobID), 6200 } 6201 6202 const APIVersion = "7.2-preview" 6203 queryParameters := map[string]interface{}{ 6204 "api-version": APIVersion, 6205 } 6206 6207 preparer := autorest.CreatePreparer( 6208 autorest.AsGet(), 6209 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6210 autorest.WithPathParameters("/restore/{jobId}/pending", pathParameters), 6211 autorest.WithQueryParameters(queryParameters)) 6212 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6213} 6214 6215// RestoreStatusSender sends the RestoreStatus request. The method will close the 6216// http.Response Body if it receives an error. 6217func (client BaseClient) RestoreStatusSender(req *http.Request) (*http.Response, error) { 6218 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6219} 6220 6221// RestoreStatusResponder handles the response to the RestoreStatus request. The method always 6222// closes the http.Response Body. 6223func (client BaseClient) RestoreStatusResponder(resp *http.Response) (result RestoreOperation, err error) { 6224 err = autorest.Respond( 6225 resp, 6226 azure.WithErrorUnlessStatusCode(http.StatusOK), 6227 autorest.ByUnmarshallingJSON(&result), 6228 autorest.ByClosing()) 6229 result.Response = autorest.Response{Response: resp} 6230 return 6231} 6232 6233// RestoreStorageAccount restores a backed up storage account to a vault. This operation requires the storage/restore 6234// permission. 6235// Parameters: 6236// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6237// parameters - the parameters to restore the storage account. 6238func (client BaseClient) RestoreStorageAccount(ctx context.Context, vaultBaseURL string, parameters StorageRestoreParameters) (result StorageBundle, err error) { 6239 if tracing.IsEnabled() { 6240 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.RestoreStorageAccount") 6241 defer func() { 6242 sc := -1 6243 if result.Response.Response != nil { 6244 sc = result.Response.Response.StatusCode 6245 } 6246 tracing.EndSpan(ctx, sc, err) 6247 }() 6248 } 6249 if err := validation.Validate([]validation.Validation{ 6250 {TargetValue: parameters, 6251 Constraints: []validation.Constraint{{Target: "parameters.StorageBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6252 return result, validation.NewError("keyvault.BaseClient", "RestoreStorageAccount", err.Error()) 6253 } 6254 6255 req, err := client.RestoreStorageAccountPreparer(ctx, vaultBaseURL, parameters) 6256 if err != nil { 6257 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", nil, "Failure preparing request") 6258 return 6259 } 6260 6261 resp, err := client.RestoreStorageAccountSender(req) 6262 if err != nil { 6263 result.Response = autorest.Response{Response: resp} 6264 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", resp, "Failure sending request") 6265 return 6266 } 6267 6268 result, err = client.RestoreStorageAccountResponder(resp) 6269 if err != nil { 6270 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "RestoreStorageAccount", resp, "Failure responding to request") 6271 return 6272 } 6273 6274 return 6275} 6276 6277// RestoreStorageAccountPreparer prepares the RestoreStorageAccount request. 6278func (client BaseClient) RestoreStorageAccountPreparer(ctx context.Context, vaultBaseURL string, parameters StorageRestoreParameters) (*http.Request, error) { 6279 urlParameters := map[string]interface{}{ 6280 "vaultBaseUrl": vaultBaseURL, 6281 } 6282 6283 const APIVersion = "7.2-preview" 6284 queryParameters := map[string]interface{}{ 6285 "api-version": APIVersion, 6286 } 6287 6288 preparer := autorest.CreatePreparer( 6289 autorest.AsContentType("application/json; charset=utf-8"), 6290 autorest.AsPost(), 6291 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6292 autorest.WithPath("/storage/restore"), 6293 autorest.WithJSON(parameters), 6294 autorest.WithQueryParameters(queryParameters)) 6295 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6296} 6297 6298// RestoreStorageAccountSender sends the RestoreStorageAccount request. The method will close the 6299// http.Response Body if it receives an error. 6300func (client BaseClient) RestoreStorageAccountSender(req *http.Request) (*http.Response, error) { 6301 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6302} 6303 6304// RestoreStorageAccountResponder handles the response to the RestoreStorageAccount request. The method always 6305// closes the http.Response Body. 6306func (client BaseClient) RestoreStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { 6307 err = autorest.Respond( 6308 resp, 6309 azure.WithErrorUnlessStatusCode(http.StatusOK), 6310 autorest.ByUnmarshallingJSON(&result), 6311 autorest.ByClosing()) 6312 result.Response = autorest.Response{Response: resp} 6313 return 6314} 6315 6316// SelectiveKeyRestoreOperationMethod restores all key versions of a given key using user supplied SAS token pointing 6317// to a previously stored Azure Blob storage backup folder 6318// Parameters: 6319// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6320// keyName - the name of the key to be restored from the user supplied backup 6321// restoreBlobDetails - the Azure blob SAS token pointing to a folder where the previous successful full backup 6322// was stored 6323func (client BaseClient) SelectiveKeyRestoreOperationMethod(ctx context.Context, vaultBaseURL string, keyName string, restoreBlobDetails *SelectiveKeyRestoreOperationParameters) (result SelectiveKeyRestoreOperationMethodFuture, err error) { 6324 if tracing.IsEnabled() { 6325 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SelectiveKeyRestoreOperationMethod") 6326 defer func() { 6327 sc := -1 6328 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 6329 sc = result.FutureAPI.Response().StatusCode 6330 } 6331 tracing.EndSpan(ctx, sc, err) 6332 }() 6333 } 6334 if err := validation.Validate([]validation.Validation{ 6335 {TargetValue: restoreBlobDetails, 6336 Constraints: []validation.Constraint{{Target: "restoreBlobDetails", Name: validation.Null, Rule: false, 6337 Chain: []validation.Constraint{{Target: "restoreBlobDetails.SasTokenParameters", Name: validation.Null, Rule: true, 6338 Chain: []validation.Constraint{{Target: "restoreBlobDetails.SasTokenParameters.StorageResourceURI", Name: validation.Null, Rule: true, Chain: nil}, 6339 {Target: "restoreBlobDetails.SasTokenParameters.Token", Name: validation.Null, Rule: true, Chain: nil}, 6340 }}, 6341 {Target: "restoreBlobDetails.Folder", Name: validation.Null, Rule: true, Chain: nil}, 6342 }}}}}); err != nil { 6343 return result, validation.NewError("keyvault.BaseClient", "SelectiveKeyRestoreOperationMethod", err.Error()) 6344 } 6345 6346 req, err := client.SelectiveKeyRestoreOperationMethodPreparer(ctx, vaultBaseURL, keyName, restoreBlobDetails) 6347 if err != nil { 6348 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SelectiveKeyRestoreOperationMethod", nil, "Failure preparing request") 6349 return 6350 } 6351 6352 result, err = client.SelectiveKeyRestoreOperationMethodSender(req) 6353 if err != nil { 6354 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SelectiveKeyRestoreOperationMethod", nil, "Failure sending request") 6355 return 6356 } 6357 6358 return 6359} 6360 6361// SelectiveKeyRestoreOperationMethodPreparer prepares the SelectiveKeyRestoreOperationMethod request. 6362func (client BaseClient) SelectiveKeyRestoreOperationMethodPreparer(ctx context.Context, vaultBaseURL string, keyName string, restoreBlobDetails *SelectiveKeyRestoreOperationParameters) (*http.Request, error) { 6363 urlParameters := map[string]interface{}{ 6364 "vaultBaseUrl": vaultBaseURL, 6365 } 6366 6367 pathParameters := map[string]interface{}{ 6368 "keyName": autorest.Encode("path", keyName), 6369 } 6370 6371 const APIVersion = "7.2-preview" 6372 queryParameters := map[string]interface{}{ 6373 "api-version": APIVersion, 6374 } 6375 6376 preparer := autorest.CreatePreparer( 6377 autorest.AsContentType("application/json; charset=utf-8"), 6378 autorest.AsPut(), 6379 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6380 autorest.WithPathParameters("/keys/{keyName}/restore", pathParameters), 6381 autorest.WithQueryParameters(queryParameters)) 6382 if restoreBlobDetails != nil { 6383 preparer = autorest.DecoratePreparer(preparer, 6384 autorest.WithJSON(restoreBlobDetails)) 6385 } 6386 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6387} 6388 6389// SelectiveKeyRestoreOperationMethodSender sends the SelectiveKeyRestoreOperationMethod request. The method will close the 6390// http.Response Body if it receives an error. 6391func (client BaseClient) SelectiveKeyRestoreOperationMethodSender(req *http.Request) (future SelectiveKeyRestoreOperationMethodFuture, err error) { 6392 var resp *http.Response 6393 resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6394 if err != nil { 6395 return 6396 } 6397 var azf azure.Future 6398 azf, err = azure.NewFutureFromResponse(resp) 6399 future.FutureAPI = &azf 6400 future.Result = func(client BaseClient) (skro SelectiveKeyRestoreOperation, err error) { 6401 var done bool 6402 done, err = future.DoneWithContext(context.Background(), client) 6403 if err != nil { 6404 err = autorest.NewErrorWithError(err, "keyvault.SelectiveKeyRestoreOperationMethodFuture", "Result", future.Response(), "Polling failure") 6405 return 6406 } 6407 if !done { 6408 err = azure.NewAsyncOpIncompleteError("keyvault.SelectiveKeyRestoreOperationMethodFuture") 6409 return 6410 } 6411 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6412 skro.Response.Response, err = future.GetResult(sender) 6413 if skro.Response.Response == nil && err == nil { 6414 err = autorest.NewErrorWithError(err, "keyvault.SelectiveKeyRestoreOperationMethodFuture", "Result", nil, "received nil response and error") 6415 } 6416 if err == nil && skro.Response.Response.StatusCode != http.StatusNoContent { 6417 skro, err = client.SelectiveKeyRestoreOperationMethodResponder(skro.Response.Response) 6418 if err != nil { 6419 err = autorest.NewErrorWithError(err, "keyvault.SelectiveKeyRestoreOperationMethodFuture", "Result", skro.Response.Response, "Failure responding to request") 6420 } 6421 } 6422 return 6423 } 6424 return 6425} 6426 6427// SelectiveKeyRestoreOperationMethodResponder handles the response to the SelectiveKeyRestoreOperationMethod request. The method always 6428// closes the http.Response Body. 6429func (client BaseClient) SelectiveKeyRestoreOperationMethodResponder(resp *http.Response) (result SelectiveKeyRestoreOperation, err error) { 6430 err = autorest.Respond( 6431 resp, 6432 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 6433 autorest.ByUnmarshallingJSON(&result), 6434 autorest.ByClosing()) 6435 result.Response = autorest.Response{Response: resp} 6436 return 6437} 6438 6439// SetCertificateContacts sets the certificate contacts for the specified key vault. This operation requires the 6440// certificates/managecontacts permission. 6441// Parameters: 6442// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6443// contacts - the contacts for the key vault certificate. 6444func (client BaseClient) SetCertificateContacts(ctx context.Context, vaultBaseURL string, contacts Contacts) (result Contacts, err error) { 6445 if tracing.IsEnabled() { 6446 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetCertificateContacts") 6447 defer func() { 6448 sc := -1 6449 if result.Response.Response != nil { 6450 sc = result.Response.Response.StatusCode 6451 } 6452 tracing.EndSpan(ctx, sc, err) 6453 }() 6454 } 6455 req, err := client.SetCertificateContactsPreparer(ctx, vaultBaseURL, contacts) 6456 if err != nil { 6457 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", nil, "Failure preparing request") 6458 return 6459 } 6460 6461 resp, err := client.SetCertificateContactsSender(req) 6462 if err != nil { 6463 result.Response = autorest.Response{Response: resp} 6464 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure sending request") 6465 return 6466 } 6467 6468 result, err = client.SetCertificateContactsResponder(resp) 6469 if err != nil { 6470 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateContacts", resp, "Failure responding to request") 6471 return 6472 } 6473 6474 return 6475} 6476 6477// SetCertificateContactsPreparer prepares the SetCertificateContacts request. 6478func (client BaseClient) SetCertificateContactsPreparer(ctx context.Context, vaultBaseURL string, contacts Contacts) (*http.Request, error) { 6479 urlParameters := map[string]interface{}{ 6480 "vaultBaseUrl": vaultBaseURL, 6481 } 6482 6483 const APIVersion = "7.2-preview" 6484 queryParameters := map[string]interface{}{ 6485 "api-version": APIVersion, 6486 } 6487 6488 contacts.ID = nil 6489 preparer := autorest.CreatePreparer( 6490 autorest.AsContentType("application/json; charset=utf-8"), 6491 autorest.AsPut(), 6492 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6493 autorest.WithPath("/certificates/contacts"), 6494 autorest.WithJSON(contacts), 6495 autorest.WithQueryParameters(queryParameters)) 6496 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6497} 6498 6499// SetCertificateContactsSender sends the SetCertificateContacts request. The method will close the 6500// http.Response Body if it receives an error. 6501func (client BaseClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) { 6502 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6503} 6504 6505// SetCertificateContactsResponder handles the response to the SetCertificateContacts request. The method always 6506// closes the http.Response Body. 6507func (client BaseClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { 6508 err = autorest.Respond( 6509 resp, 6510 azure.WithErrorUnlessStatusCode(http.StatusOK), 6511 autorest.ByUnmarshallingJSON(&result), 6512 autorest.ByClosing()) 6513 result.Response = autorest.Response{Response: resp} 6514 return 6515} 6516 6517// SetCertificateIssuer the SetCertificateIssuer operation adds or updates the specified certificate issuer. This 6518// operation requires the certificates/setissuers permission. 6519// Parameters: 6520// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6521// issuerName - the name of the issuer. 6522// parameter - certificate issuer set parameter. 6523func (client BaseClient) SetCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (result IssuerBundle, err error) { 6524 if tracing.IsEnabled() { 6525 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetCertificateIssuer") 6526 defer func() { 6527 sc := -1 6528 if result.Response.Response != nil { 6529 sc = result.Response.Response.StatusCode 6530 } 6531 tracing.EndSpan(ctx, sc, err) 6532 }() 6533 } 6534 if err := validation.Validate([]validation.Validation{ 6535 {TargetValue: parameter, 6536 Constraints: []validation.Constraint{{Target: "parameter.Provider", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6537 return result, validation.NewError("keyvault.BaseClient", "SetCertificateIssuer", err.Error()) 6538 } 6539 6540 req, err := client.SetCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter) 6541 if err != nil { 6542 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", nil, "Failure preparing request") 6543 return 6544 } 6545 6546 resp, err := client.SetCertificateIssuerSender(req) 6547 if err != nil { 6548 result.Response = autorest.Response{Response: resp} 6549 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure sending request") 6550 return 6551 } 6552 6553 result, err = client.SetCertificateIssuerResponder(resp) 6554 if err != nil { 6555 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetCertificateIssuer", resp, "Failure responding to request") 6556 return 6557 } 6558 6559 return 6560} 6561 6562// SetCertificateIssuerPreparer prepares the SetCertificateIssuer request. 6563func (client BaseClient) SetCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (*http.Request, error) { 6564 urlParameters := map[string]interface{}{ 6565 "vaultBaseUrl": vaultBaseURL, 6566 } 6567 6568 pathParameters := map[string]interface{}{ 6569 "issuer-name": autorest.Encode("path", issuerName), 6570 } 6571 6572 const APIVersion = "7.2-preview" 6573 queryParameters := map[string]interface{}{ 6574 "api-version": APIVersion, 6575 } 6576 6577 preparer := autorest.CreatePreparer( 6578 autorest.AsContentType("application/json; charset=utf-8"), 6579 autorest.AsPut(), 6580 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6581 autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), 6582 autorest.WithJSON(parameter), 6583 autorest.WithQueryParameters(queryParameters)) 6584 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6585} 6586 6587// SetCertificateIssuerSender sends the SetCertificateIssuer request. The method will close the 6588// http.Response Body if it receives an error. 6589func (client BaseClient) SetCertificateIssuerSender(req *http.Request) (*http.Response, error) { 6590 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6591} 6592 6593// SetCertificateIssuerResponder handles the response to the SetCertificateIssuer request. The method always 6594// closes the http.Response Body. 6595func (client BaseClient) SetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { 6596 err = autorest.Respond( 6597 resp, 6598 azure.WithErrorUnlessStatusCode(http.StatusOK), 6599 autorest.ByUnmarshallingJSON(&result), 6600 autorest.ByClosing()) 6601 result.Response = autorest.Response{Response: resp} 6602 return 6603} 6604 6605// SetSasDefinition creates or updates a new SAS definition for the specified storage account. This operation requires 6606// the storage/setsas permission. 6607// Parameters: 6608// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6609// storageAccountName - the name of the storage account. 6610// sasDefinitionName - the name of the SAS definition. 6611// parameters - the parameters to create a SAS definition. 6612func (client BaseClient) SetSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (result SasDefinitionBundle, err error) { 6613 if tracing.IsEnabled() { 6614 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetSasDefinition") 6615 defer func() { 6616 sc := -1 6617 if result.Response.Response != nil { 6618 sc = result.Response.Response.StatusCode 6619 } 6620 tracing.EndSpan(ctx, sc, err) 6621 }() 6622 } 6623 if err := validation.Validate([]validation.Validation{ 6624 {TargetValue: storageAccountName, 6625 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 6626 {TargetValue: sasDefinitionName, 6627 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 6628 {TargetValue: parameters, 6629 Constraints: []validation.Constraint{{Target: "parameters.TemplateURI", Name: validation.Null, Rule: true, Chain: nil}, 6630 {Target: "parameters.ValidityPeriod", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6631 return result, validation.NewError("keyvault.BaseClient", "SetSasDefinition", err.Error()) 6632 } 6633 6634 req, err := client.SetSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters) 6635 if err != nil { 6636 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", nil, "Failure preparing request") 6637 return 6638 } 6639 6640 resp, err := client.SetSasDefinitionSender(req) 6641 if err != nil { 6642 result.Response = autorest.Response{Response: resp} 6643 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure sending request") 6644 return 6645 } 6646 6647 result, err = client.SetSasDefinitionResponder(resp) 6648 if err != nil { 6649 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSasDefinition", resp, "Failure responding to request") 6650 return 6651 } 6652 6653 return 6654} 6655 6656// SetSasDefinitionPreparer prepares the SetSasDefinition request. 6657func (client BaseClient) SetSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionCreateParameters) (*http.Request, error) { 6658 urlParameters := map[string]interface{}{ 6659 "vaultBaseUrl": vaultBaseURL, 6660 } 6661 6662 pathParameters := map[string]interface{}{ 6663 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 6664 "storage-account-name": autorest.Encode("path", storageAccountName), 6665 } 6666 6667 const APIVersion = "7.2-preview" 6668 queryParameters := map[string]interface{}{ 6669 "api-version": APIVersion, 6670 } 6671 6672 preparer := autorest.CreatePreparer( 6673 autorest.AsContentType("application/json; charset=utf-8"), 6674 autorest.AsPut(), 6675 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6676 autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), 6677 autorest.WithJSON(parameters), 6678 autorest.WithQueryParameters(queryParameters)) 6679 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6680} 6681 6682// SetSasDefinitionSender sends the SetSasDefinition request. The method will close the 6683// http.Response Body if it receives an error. 6684func (client BaseClient) SetSasDefinitionSender(req *http.Request) (*http.Response, error) { 6685 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6686} 6687 6688// SetSasDefinitionResponder handles the response to the SetSasDefinition request. The method always 6689// closes the http.Response Body. 6690func (client BaseClient) SetSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { 6691 err = autorest.Respond( 6692 resp, 6693 azure.WithErrorUnlessStatusCode(http.StatusOK), 6694 autorest.ByUnmarshallingJSON(&result), 6695 autorest.ByClosing()) 6696 result.Response = autorest.Response{Response: resp} 6697 return 6698} 6699 6700// SetSecret the SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key 6701// Vault creates a new version of that secret. This operation requires the secrets/set permission. 6702// Parameters: 6703// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6704// secretName - the name of the secret. 6705// parameters - the parameters for setting the secret. 6706func (client BaseClient) SetSecret(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (result SecretBundle, err error) { 6707 if tracing.IsEnabled() { 6708 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetSecret") 6709 defer func() { 6710 sc := -1 6711 if result.Response.Response != nil { 6712 sc = result.Response.Response.StatusCode 6713 } 6714 tracing.EndSpan(ctx, sc, err) 6715 }() 6716 } 6717 if err := validation.Validate([]validation.Validation{ 6718 {TargetValue: secretName, 6719 Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, 6720 {TargetValue: parameters, 6721 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6722 return result, validation.NewError("keyvault.BaseClient", "SetSecret", err.Error()) 6723 } 6724 6725 req, err := client.SetSecretPreparer(ctx, vaultBaseURL, secretName, parameters) 6726 if err != nil { 6727 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", nil, "Failure preparing request") 6728 return 6729 } 6730 6731 resp, err := client.SetSecretSender(req) 6732 if err != nil { 6733 result.Response = autorest.Response{Response: resp} 6734 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure sending request") 6735 return 6736 } 6737 6738 result, err = client.SetSecretResponder(resp) 6739 if err != nil { 6740 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetSecret", resp, "Failure responding to request") 6741 return 6742 } 6743 6744 return 6745} 6746 6747// SetSecretPreparer prepares the SetSecret request. 6748func (client BaseClient) SetSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, parameters SecretSetParameters) (*http.Request, error) { 6749 urlParameters := map[string]interface{}{ 6750 "vaultBaseUrl": vaultBaseURL, 6751 } 6752 6753 pathParameters := map[string]interface{}{ 6754 "secret-name": autorest.Encode("path", secretName), 6755 } 6756 6757 const APIVersion = "7.2-preview" 6758 queryParameters := map[string]interface{}{ 6759 "api-version": APIVersion, 6760 } 6761 6762 preparer := autorest.CreatePreparer( 6763 autorest.AsContentType("application/json; charset=utf-8"), 6764 autorest.AsPut(), 6765 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6766 autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), 6767 autorest.WithJSON(parameters), 6768 autorest.WithQueryParameters(queryParameters)) 6769 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6770} 6771 6772// SetSecretSender sends the SetSecret request. The method will close the 6773// http.Response Body if it receives an error. 6774func (client BaseClient) SetSecretSender(req *http.Request) (*http.Response, error) { 6775 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6776} 6777 6778// SetSecretResponder handles the response to the SetSecret request. The method always 6779// closes the http.Response Body. 6780func (client BaseClient) SetSecretResponder(resp *http.Response) (result SecretBundle, err error) { 6781 err = autorest.Respond( 6782 resp, 6783 azure.WithErrorUnlessStatusCode(http.StatusOK), 6784 autorest.ByUnmarshallingJSON(&result), 6785 autorest.ByClosing()) 6786 result.Response = autorest.Response{Response: resp} 6787 return 6788} 6789 6790// SetStorageAccount creates or updates a new storage account. This operation requires the storage/set permission. 6791// Parameters: 6792// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6793// storageAccountName - the name of the storage account. 6794// parameters - the parameters to create a storage account. 6795func (client BaseClient) SetStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (result StorageBundle, err error) { 6796 if tracing.IsEnabled() { 6797 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SetStorageAccount") 6798 defer func() { 6799 sc := -1 6800 if result.Response.Response != nil { 6801 sc = result.Response.Response.StatusCode 6802 } 6803 tracing.EndSpan(ctx, sc, err) 6804 }() 6805 } 6806 if err := validation.Validate([]validation.Validation{ 6807 {TargetValue: storageAccountName, 6808 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 6809 {TargetValue: parameters, 6810 Constraints: []validation.Constraint{{Target: "parameters.ResourceID", Name: validation.Null, Rule: true, Chain: nil}, 6811 {Target: "parameters.ActiveKeyName", Name: validation.Null, Rule: true, Chain: nil}, 6812 {Target: "parameters.AutoRegenerateKey", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6813 return result, validation.NewError("keyvault.BaseClient", "SetStorageAccount", err.Error()) 6814 } 6815 6816 req, err := client.SetStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters) 6817 if err != nil { 6818 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", nil, "Failure preparing request") 6819 return 6820 } 6821 6822 resp, err := client.SetStorageAccountSender(req) 6823 if err != nil { 6824 result.Response = autorest.Response{Response: resp} 6825 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure sending request") 6826 return 6827 } 6828 6829 result, err = client.SetStorageAccountResponder(resp) 6830 if err != nil { 6831 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "SetStorageAccount", resp, "Failure responding to request") 6832 return 6833 } 6834 6835 return 6836} 6837 6838// SetStorageAccountPreparer prepares the SetStorageAccount request. 6839func (client BaseClient) SetStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountCreateParameters) (*http.Request, error) { 6840 urlParameters := map[string]interface{}{ 6841 "vaultBaseUrl": vaultBaseURL, 6842 } 6843 6844 pathParameters := map[string]interface{}{ 6845 "storage-account-name": autorest.Encode("path", storageAccountName), 6846 } 6847 6848 const APIVersion = "7.2-preview" 6849 queryParameters := map[string]interface{}{ 6850 "api-version": APIVersion, 6851 } 6852 6853 preparer := autorest.CreatePreparer( 6854 autorest.AsContentType("application/json; charset=utf-8"), 6855 autorest.AsPut(), 6856 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6857 autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), 6858 autorest.WithJSON(parameters), 6859 autorest.WithQueryParameters(queryParameters)) 6860 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6861} 6862 6863// SetStorageAccountSender sends the SetStorageAccount request. The method will close the 6864// http.Response Body if it receives an error. 6865func (client BaseClient) SetStorageAccountSender(req *http.Request) (*http.Response, error) { 6866 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6867} 6868 6869// SetStorageAccountResponder handles the response to the SetStorageAccount request. The method always 6870// closes the http.Response Body. 6871func (client BaseClient) SetStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { 6872 err = autorest.Respond( 6873 resp, 6874 azure.WithErrorUnlessStatusCode(http.StatusOK), 6875 autorest.ByUnmarshallingJSON(&result), 6876 autorest.ByClosing()) 6877 result.Response = autorest.Response{Response: resp} 6878 return 6879} 6880 6881// Sign the SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this 6882// operation uses the private portion of the key. This operation requires the keys/sign permission. 6883// Parameters: 6884// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6885// keyName - the name of the key. 6886// keyVersion - the version of the key. 6887// parameters - the parameters for the signing operation. 6888func (client BaseClient) Sign(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (result KeyOperationResult, err error) { 6889 if tracing.IsEnabled() { 6890 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Sign") 6891 defer func() { 6892 sc := -1 6893 if result.Response.Response != nil { 6894 sc = result.Response.Response.StatusCode 6895 } 6896 tracing.EndSpan(ctx, sc, err) 6897 }() 6898 } 6899 if err := validation.Validate([]validation.Validation{ 6900 {TargetValue: parameters, 6901 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6902 return result, validation.NewError("keyvault.BaseClient", "Sign", err.Error()) 6903 } 6904 6905 req, err := client.SignPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 6906 if err != nil { 6907 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", nil, "Failure preparing request") 6908 return 6909 } 6910 6911 resp, err := client.SignSender(req) 6912 if err != nil { 6913 result.Response = autorest.Response{Response: resp} 6914 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure sending request") 6915 return 6916 } 6917 6918 result, err = client.SignResponder(resp) 6919 if err != nil { 6920 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Sign", resp, "Failure responding to request") 6921 return 6922 } 6923 6924 return 6925} 6926 6927// SignPreparer prepares the Sign request. 6928func (client BaseClient) SignPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (*http.Request, error) { 6929 urlParameters := map[string]interface{}{ 6930 "vaultBaseUrl": vaultBaseURL, 6931 } 6932 6933 pathParameters := map[string]interface{}{ 6934 "key-name": autorest.Encode("path", keyName), 6935 "key-version": autorest.Encode("path", keyVersion), 6936 } 6937 6938 const APIVersion = "7.2-preview" 6939 queryParameters := map[string]interface{}{ 6940 "api-version": APIVersion, 6941 } 6942 6943 preparer := autorest.CreatePreparer( 6944 autorest.AsContentType("application/json; charset=utf-8"), 6945 autorest.AsPost(), 6946 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 6947 autorest.WithPathParameters("/keys/{key-name}/{key-version}/sign", pathParameters), 6948 autorest.WithJSON(parameters), 6949 autorest.WithQueryParameters(queryParameters)) 6950 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 6951} 6952 6953// SignSender sends the Sign request. The method will close the 6954// http.Response Body if it receives an error. 6955func (client BaseClient) SignSender(req *http.Request) (*http.Response, error) { 6956 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6957} 6958 6959// SignResponder handles the response to the Sign request. The method always 6960// closes the http.Response Body. 6961func (client BaseClient) SignResponder(resp *http.Response) (result KeyOperationResult, err error) { 6962 err = autorest.Respond( 6963 resp, 6964 azure.WithErrorUnlessStatusCode(http.StatusOK), 6965 autorest.ByUnmarshallingJSON(&result), 6966 autorest.ByClosing()) 6967 result.Response = autorest.Response{Response: resp} 6968 return 6969} 6970 6971// UnwrapKey the UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This 6972// operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored 6973// in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey 6974// permission. 6975// Parameters: 6976// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 6977// keyName - the name of the key. 6978// keyVersion - the version of the key. 6979// parameters - the parameters for the key operation. 6980func (client BaseClient) UnwrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { 6981 if tracing.IsEnabled() { 6982 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UnwrapKey") 6983 defer func() { 6984 sc := -1 6985 if result.Response.Response != nil { 6986 sc = result.Response.Response.StatusCode 6987 } 6988 tracing.EndSpan(ctx, sc, err) 6989 }() 6990 } 6991 if err := validation.Validate([]validation.Validation{ 6992 {TargetValue: parameters, 6993 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 6994 return result, validation.NewError("keyvault.BaseClient", "UnwrapKey", err.Error()) 6995 } 6996 6997 req, err := client.UnwrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 6998 if err != nil { 6999 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", nil, "Failure preparing request") 7000 return 7001 } 7002 7003 resp, err := client.UnwrapKeySender(req) 7004 if err != nil { 7005 result.Response = autorest.Response{Response: resp} 7006 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure sending request") 7007 return 7008 } 7009 7010 result, err = client.UnwrapKeyResponder(resp) 7011 if err != nil { 7012 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UnwrapKey", resp, "Failure responding to request") 7013 return 7014 } 7015 7016 return 7017} 7018 7019// UnwrapKeyPreparer prepares the UnwrapKey request. 7020func (client BaseClient) UnwrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { 7021 urlParameters := map[string]interface{}{ 7022 "vaultBaseUrl": vaultBaseURL, 7023 } 7024 7025 pathParameters := map[string]interface{}{ 7026 "key-name": autorest.Encode("path", keyName), 7027 "key-version": autorest.Encode("path", keyVersion), 7028 } 7029 7030 const APIVersion = "7.2-preview" 7031 queryParameters := map[string]interface{}{ 7032 "api-version": APIVersion, 7033 } 7034 7035 preparer := autorest.CreatePreparer( 7036 autorest.AsContentType("application/json; charset=utf-8"), 7037 autorest.AsPost(), 7038 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7039 autorest.WithPathParameters("/keys/{key-name}/{key-version}/unwrapkey", pathParameters), 7040 autorest.WithJSON(parameters), 7041 autorest.WithQueryParameters(queryParameters)) 7042 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7043} 7044 7045// UnwrapKeySender sends the UnwrapKey request. The method will close the 7046// http.Response Body if it receives an error. 7047func (client BaseClient) UnwrapKeySender(req *http.Request) (*http.Response, error) { 7048 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7049} 7050 7051// UnwrapKeyResponder handles the response to the UnwrapKey request. The method always 7052// closes the http.Response Body. 7053func (client BaseClient) UnwrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { 7054 err = autorest.Respond( 7055 resp, 7056 azure.WithErrorUnlessStatusCode(http.StatusOK), 7057 autorest.ByUnmarshallingJSON(&result), 7058 autorest.ByClosing()) 7059 result.Response = autorest.Response{Response: resp} 7060 return 7061} 7062 7063// UpdateCertificate the UpdateCertificate operation applies the specified update on the given certificate; the only 7064// elements updated are the certificate's attributes. This operation requires the certificates/update permission. 7065// Parameters: 7066// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7067// certificateName - the name of the certificate in the given key vault. 7068// certificateVersion - the version of the certificate. 7069// parameters - the parameters for certificate update. 7070func (client BaseClient) UpdateCertificate(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (result CertificateBundle, err error) { 7071 if tracing.IsEnabled() { 7072 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificate") 7073 defer func() { 7074 sc := -1 7075 if result.Response.Response != nil { 7076 sc = result.Response.Response.StatusCode 7077 } 7078 tracing.EndSpan(ctx, sc, err) 7079 }() 7080 } 7081 req, err := client.UpdateCertificatePreparer(ctx, vaultBaseURL, certificateName, certificateVersion, parameters) 7082 if err != nil { 7083 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", nil, "Failure preparing request") 7084 return 7085 } 7086 7087 resp, err := client.UpdateCertificateSender(req) 7088 if err != nil { 7089 result.Response = autorest.Response{Response: resp} 7090 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure sending request") 7091 return 7092 } 7093 7094 result, err = client.UpdateCertificateResponder(resp) 7095 if err != nil { 7096 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificate", resp, "Failure responding to request") 7097 return 7098 } 7099 7100 return 7101} 7102 7103// UpdateCertificatePreparer prepares the UpdateCertificate request. 7104func (client BaseClient) UpdateCertificatePreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (*http.Request, error) { 7105 urlParameters := map[string]interface{}{ 7106 "vaultBaseUrl": vaultBaseURL, 7107 } 7108 7109 pathParameters := map[string]interface{}{ 7110 "certificate-name": autorest.Encode("path", certificateName), 7111 "certificate-version": autorest.Encode("path", certificateVersion), 7112 } 7113 7114 const APIVersion = "7.2-preview" 7115 queryParameters := map[string]interface{}{ 7116 "api-version": APIVersion, 7117 } 7118 7119 preparer := autorest.CreatePreparer( 7120 autorest.AsContentType("application/json; charset=utf-8"), 7121 autorest.AsPatch(), 7122 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7123 autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), 7124 autorest.WithJSON(parameters), 7125 autorest.WithQueryParameters(queryParameters)) 7126 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7127} 7128 7129// UpdateCertificateSender sends the UpdateCertificate request. The method will close the 7130// http.Response Body if it receives an error. 7131func (client BaseClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { 7132 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7133} 7134 7135// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always 7136// closes the http.Response Body. 7137func (client BaseClient) UpdateCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { 7138 err = autorest.Respond( 7139 resp, 7140 azure.WithErrorUnlessStatusCode(http.StatusOK), 7141 autorest.ByUnmarshallingJSON(&result), 7142 autorest.ByClosing()) 7143 result.Response = autorest.Response{Response: resp} 7144 return 7145} 7146 7147// UpdateCertificateIssuer the UpdateCertificateIssuer operation performs an update on the specified certificate issuer 7148// entity. This operation requires the certificates/setissuers permission. 7149// Parameters: 7150// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7151// issuerName - the name of the issuer. 7152// parameter - certificate issuer update parameter. 7153func (client BaseClient) UpdateCertificateIssuer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (result IssuerBundle, err error) { 7154 if tracing.IsEnabled() { 7155 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificateIssuer") 7156 defer func() { 7157 sc := -1 7158 if result.Response.Response != nil { 7159 sc = result.Response.Response.StatusCode 7160 } 7161 tracing.EndSpan(ctx, sc, err) 7162 }() 7163 } 7164 req, err := client.UpdateCertificateIssuerPreparer(ctx, vaultBaseURL, issuerName, parameter) 7165 if err != nil { 7166 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", nil, "Failure preparing request") 7167 return 7168 } 7169 7170 resp, err := client.UpdateCertificateIssuerSender(req) 7171 if err != nil { 7172 result.Response = autorest.Response{Response: resp} 7173 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure sending request") 7174 return 7175 } 7176 7177 result, err = client.UpdateCertificateIssuerResponder(resp) 7178 if err != nil { 7179 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateIssuer", resp, "Failure responding to request") 7180 return 7181 } 7182 7183 return 7184} 7185 7186// UpdateCertificateIssuerPreparer prepares the UpdateCertificateIssuer request. 7187func (client BaseClient) UpdateCertificateIssuerPreparer(ctx context.Context, vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (*http.Request, error) { 7188 urlParameters := map[string]interface{}{ 7189 "vaultBaseUrl": vaultBaseURL, 7190 } 7191 7192 pathParameters := map[string]interface{}{ 7193 "issuer-name": autorest.Encode("path", issuerName), 7194 } 7195 7196 const APIVersion = "7.2-preview" 7197 queryParameters := map[string]interface{}{ 7198 "api-version": APIVersion, 7199 } 7200 7201 preparer := autorest.CreatePreparer( 7202 autorest.AsContentType("application/json; charset=utf-8"), 7203 autorest.AsPatch(), 7204 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7205 autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), 7206 autorest.WithJSON(parameter), 7207 autorest.WithQueryParameters(queryParameters)) 7208 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7209} 7210 7211// UpdateCertificateIssuerSender sends the UpdateCertificateIssuer request. The method will close the 7212// http.Response Body if it receives an error. 7213func (client BaseClient) UpdateCertificateIssuerSender(req *http.Request) (*http.Response, error) { 7214 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7215} 7216 7217// UpdateCertificateIssuerResponder handles the response to the UpdateCertificateIssuer request. The method always 7218// closes the http.Response Body. 7219func (client BaseClient) UpdateCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { 7220 err = autorest.Respond( 7221 resp, 7222 azure.WithErrorUnlessStatusCode(http.StatusOK), 7223 autorest.ByUnmarshallingJSON(&result), 7224 autorest.ByClosing()) 7225 result.Response = autorest.Response{Response: resp} 7226 return 7227} 7228 7229// UpdateCertificateOperation updates a certificate creation operation that is already in progress. This operation 7230// requires the certificates/update permission. 7231// Parameters: 7232// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7233// certificateName - the name of the certificate. 7234// certificateOperation - the certificate operation response. 7235func (client BaseClient) UpdateCertificateOperation(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (result CertificateOperation, err error) { 7236 if tracing.IsEnabled() { 7237 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificateOperation") 7238 defer func() { 7239 sc := -1 7240 if result.Response.Response != nil { 7241 sc = result.Response.Response.StatusCode 7242 } 7243 tracing.EndSpan(ctx, sc, err) 7244 }() 7245 } 7246 req, err := client.UpdateCertificateOperationPreparer(ctx, vaultBaseURL, certificateName, certificateOperation) 7247 if err != nil { 7248 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", nil, "Failure preparing request") 7249 return 7250 } 7251 7252 resp, err := client.UpdateCertificateOperationSender(req) 7253 if err != nil { 7254 result.Response = autorest.Response{Response: resp} 7255 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure sending request") 7256 return 7257 } 7258 7259 result, err = client.UpdateCertificateOperationResponder(resp) 7260 if err != nil { 7261 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificateOperation", resp, "Failure responding to request") 7262 return 7263 } 7264 7265 return 7266} 7267 7268// UpdateCertificateOperationPreparer prepares the UpdateCertificateOperation request. 7269func (client BaseClient) UpdateCertificateOperationPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (*http.Request, error) { 7270 urlParameters := map[string]interface{}{ 7271 "vaultBaseUrl": vaultBaseURL, 7272 } 7273 7274 pathParameters := map[string]interface{}{ 7275 "certificate-name": autorest.Encode("path", certificateName), 7276 } 7277 7278 const APIVersion = "7.2-preview" 7279 queryParameters := map[string]interface{}{ 7280 "api-version": APIVersion, 7281 } 7282 7283 preparer := autorest.CreatePreparer( 7284 autorest.AsContentType("application/json; charset=utf-8"), 7285 autorest.AsPatch(), 7286 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7287 autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), 7288 autorest.WithJSON(certificateOperation), 7289 autorest.WithQueryParameters(queryParameters)) 7290 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7291} 7292 7293// UpdateCertificateOperationSender sends the UpdateCertificateOperation request. The method will close the 7294// http.Response Body if it receives an error. 7295func (client BaseClient) UpdateCertificateOperationSender(req *http.Request) (*http.Response, error) { 7296 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7297} 7298 7299// UpdateCertificateOperationResponder handles the response to the UpdateCertificateOperation request. The method always 7300// closes the http.Response Body. 7301func (client BaseClient) UpdateCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { 7302 err = autorest.Respond( 7303 resp, 7304 azure.WithErrorUnlessStatusCode(http.StatusOK), 7305 autorest.ByUnmarshallingJSON(&result), 7306 autorest.ByClosing()) 7307 result.Response = autorest.Response{Response: resp} 7308 return 7309} 7310 7311// UpdateCertificatePolicy set specified members in the certificate policy. Leave others as null. This operation 7312// requires the certificates/update permission. 7313// Parameters: 7314// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7315// certificateName - the name of the certificate in the given vault. 7316// certificatePolicy - the policy for the certificate. 7317func (client BaseClient) UpdateCertificatePolicy(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (result CertificatePolicy, err error) { 7318 if tracing.IsEnabled() { 7319 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateCertificatePolicy") 7320 defer func() { 7321 sc := -1 7322 if result.Response.Response != nil { 7323 sc = result.Response.Response.StatusCode 7324 } 7325 tracing.EndSpan(ctx, sc, err) 7326 }() 7327 } 7328 req, err := client.UpdateCertificatePolicyPreparer(ctx, vaultBaseURL, certificateName, certificatePolicy) 7329 if err != nil { 7330 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", nil, "Failure preparing request") 7331 return 7332 } 7333 7334 resp, err := client.UpdateCertificatePolicySender(req) 7335 if err != nil { 7336 result.Response = autorest.Response{Response: resp} 7337 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure sending request") 7338 return 7339 } 7340 7341 result, err = client.UpdateCertificatePolicyResponder(resp) 7342 if err != nil { 7343 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateCertificatePolicy", resp, "Failure responding to request") 7344 return 7345 } 7346 7347 return 7348} 7349 7350// UpdateCertificatePolicyPreparer prepares the UpdateCertificatePolicy request. 7351func (client BaseClient) UpdateCertificatePolicyPreparer(ctx context.Context, vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (*http.Request, error) { 7352 urlParameters := map[string]interface{}{ 7353 "vaultBaseUrl": vaultBaseURL, 7354 } 7355 7356 pathParameters := map[string]interface{}{ 7357 "certificate-name": autorest.Encode("path", certificateName), 7358 } 7359 7360 const APIVersion = "7.2-preview" 7361 queryParameters := map[string]interface{}{ 7362 "api-version": APIVersion, 7363 } 7364 7365 certificatePolicy.ID = nil 7366 preparer := autorest.CreatePreparer( 7367 autorest.AsContentType("application/json; charset=utf-8"), 7368 autorest.AsPatch(), 7369 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7370 autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), 7371 autorest.WithJSON(certificatePolicy), 7372 autorest.WithQueryParameters(queryParameters)) 7373 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7374} 7375 7376// UpdateCertificatePolicySender sends the UpdateCertificatePolicy request. The method will close the 7377// http.Response Body if it receives an error. 7378func (client BaseClient) UpdateCertificatePolicySender(req *http.Request) (*http.Response, error) { 7379 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7380} 7381 7382// UpdateCertificatePolicyResponder handles the response to the UpdateCertificatePolicy request. The method always 7383// closes the http.Response Body. 7384func (client BaseClient) UpdateCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { 7385 err = autorest.Respond( 7386 resp, 7387 azure.WithErrorUnlessStatusCode(http.StatusOK), 7388 autorest.ByUnmarshallingJSON(&result), 7389 autorest.ByClosing()) 7390 result.Response = autorest.Response{Response: resp} 7391 return 7392} 7393 7394// UpdateKey in order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic 7395// material of a key itself cannot be changed. This operation requires the keys/update permission. 7396// Parameters: 7397// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7398// keyName - the name of key to update. 7399// keyVersion - the version of the key to update. 7400// parameters - the parameters of the key to update. 7401func (client BaseClient) UpdateKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (result KeyBundle, err error) { 7402 if tracing.IsEnabled() { 7403 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateKey") 7404 defer func() { 7405 sc := -1 7406 if result.Response.Response != nil { 7407 sc = result.Response.Response.StatusCode 7408 } 7409 tracing.EndSpan(ctx, sc, err) 7410 }() 7411 } 7412 req, err := client.UpdateKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 7413 if err != nil { 7414 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", nil, "Failure preparing request") 7415 return 7416 } 7417 7418 resp, err := client.UpdateKeySender(req) 7419 if err != nil { 7420 result.Response = autorest.Response{Response: resp} 7421 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure sending request") 7422 return 7423 } 7424 7425 result, err = client.UpdateKeyResponder(resp) 7426 if err != nil { 7427 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateKey", resp, "Failure responding to request") 7428 return 7429 } 7430 7431 return 7432} 7433 7434// UpdateKeyPreparer prepares the UpdateKey request. 7435func (client BaseClient) UpdateKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (*http.Request, error) { 7436 urlParameters := map[string]interface{}{ 7437 "vaultBaseUrl": vaultBaseURL, 7438 } 7439 7440 pathParameters := map[string]interface{}{ 7441 "key-name": autorest.Encode("path", keyName), 7442 "key-version": autorest.Encode("path", keyVersion), 7443 } 7444 7445 const APIVersion = "7.2-preview" 7446 queryParameters := map[string]interface{}{ 7447 "api-version": APIVersion, 7448 } 7449 7450 preparer := autorest.CreatePreparer( 7451 autorest.AsContentType("application/json; charset=utf-8"), 7452 autorest.AsPatch(), 7453 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7454 autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), 7455 autorest.WithJSON(parameters), 7456 autorest.WithQueryParameters(queryParameters)) 7457 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7458} 7459 7460// UpdateKeySender sends the UpdateKey request. The method will close the 7461// http.Response Body if it receives an error. 7462func (client BaseClient) UpdateKeySender(req *http.Request) (*http.Response, error) { 7463 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7464} 7465 7466// UpdateKeyResponder handles the response to the UpdateKey request. The method always 7467// closes the http.Response Body. 7468func (client BaseClient) UpdateKeyResponder(resp *http.Response) (result KeyBundle, err error) { 7469 err = autorest.Respond( 7470 resp, 7471 azure.WithErrorUnlessStatusCode(http.StatusOK), 7472 autorest.ByUnmarshallingJSON(&result), 7473 autorest.ByClosing()) 7474 result.Response = autorest.Response{Response: resp} 7475 return 7476} 7477 7478// UpdateSasDefinition updates the specified attributes associated with the given SAS definition. This operation 7479// requires the storage/setsas permission. 7480// Parameters: 7481// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7482// storageAccountName - the name of the storage account. 7483// sasDefinitionName - the name of the SAS definition. 7484// parameters - the parameters to update a SAS definition. 7485func (client BaseClient) UpdateSasDefinition(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (result SasDefinitionBundle, err error) { 7486 if tracing.IsEnabled() { 7487 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateSasDefinition") 7488 defer func() { 7489 sc := -1 7490 if result.Response.Response != nil { 7491 sc = result.Response.Response.StatusCode 7492 } 7493 tracing.EndSpan(ctx, sc, err) 7494 }() 7495 } 7496 if err := validation.Validate([]validation.Validation{ 7497 {TargetValue: storageAccountName, 7498 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}, 7499 {TargetValue: sasDefinitionName, 7500 Constraints: []validation.Constraint{{Target: "sasDefinitionName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 7501 return result, validation.NewError("keyvault.BaseClient", "UpdateSasDefinition", err.Error()) 7502 } 7503 7504 req, err := client.UpdateSasDefinitionPreparer(ctx, vaultBaseURL, storageAccountName, sasDefinitionName, parameters) 7505 if err != nil { 7506 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", nil, "Failure preparing request") 7507 return 7508 } 7509 7510 resp, err := client.UpdateSasDefinitionSender(req) 7511 if err != nil { 7512 result.Response = autorest.Response{Response: resp} 7513 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure sending request") 7514 return 7515 } 7516 7517 result, err = client.UpdateSasDefinitionResponder(resp) 7518 if err != nil { 7519 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSasDefinition", resp, "Failure responding to request") 7520 return 7521 } 7522 7523 return 7524} 7525 7526// UpdateSasDefinitionPreparer prepares the UpdateSasDefinition request. 7527func (client BaseClient) UpdateSasDefinitionPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, sasDefinitionName string, parameters SasDefinitionUpdateParameters) (*http.Request, error) { 7528 urlParameters := map[string]interface{}{ 7529 "vaultBaseUrl": vaultBaseURL, 7530 } 7531 7532 pathParameters := map[string]interface{}{ 7533 "sas-definition-name": autorest.Encode("path", sasDefinitionName), 7534 "storage-account-name": autorest.Encode("path", storageAccountName), 7535 } 7536 7537 const APIVersion = "7.2-preview" 7538 queryParameters := map[string]interface{}{ 7539 "api-version": APIVersion, 7540 } 7541 7542 preparer := autorest.CreatePreparer( 7543 autorest.AsContentType("application/json; charset=utf-8"), 7544 autorest.AsPatch(), 7545 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7546 autorest.WithPathParameters("/storage/{storage-account-name}/sas/{sas-definition-name}", pathParameters), 7547 autorest.WithJSON(parameters), 7548 autorest.WithQueryParameters(queryParameters)) 7549 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7550} 7551 7552// UpdateSasDefinitionSender sends the UpdateSasDefinition request. The method will close the 7553// http.Response Body if it receives an error. 7554func (client BaseClient) UpdateSasDefinitionSender(req *http.Request) (*http.Response, error) { 7555 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7556} 7557 7558// UpdateSasDefinitionResponder handles the response to the UpdateSasDefinition request. The method always 7559// closes the http.Response Body. 7560func (client BaseClient) UpdateSasDefinitionResponder(resp *http.Response) (result SasDefinitionBundle, err error) { 7561 err = autorest.Respond( 7562 resp, 7563 azure.WithErrorUnlessStatusCode(http.StatusOK), 7564 autorest.ByUnmarshallingJSON(&result), 7565 autorest.ByClosing()) 7566 result.Response = autorest.Response{Response: resp} 7567 return 7568} 7569 7570// UpdateSecret the UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not 7571// specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires 7572// the secrets/set permission. 7573// Parameters: 7574// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7575// secretName - the name of the secret. 7576// secretVersion - the version of the secret. 7577// parameters - the parameters for update secret operation. 7578func (client BaseClient) UpdateSecret(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (result SecretBundle, err error) { 7579 if tracing.IsEnabled() { 7580 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateSecret") 7581 defer func() { 7582 sc := -1 7583 if result.Response.Response != nil { 7584 sc = result.Response.Response.StatusCode 7585 } 7586 tracing.EndSpan(ctx, sc, err) 7587 }() 7588 } 7589 req, err := client.UpdateSecretPreparer(ctx, vaultBaseURL, secretName, secretVersion, parameters) 7590 if err != nil { 7591 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", nil, "Failure preparing request") 7592 return 7593 } 7594 7595 resp, err := client.UpdateSecretSender(req) 7596 if err != nil { 7597 result.Response = autorest.Response{Response: resp} 7598 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure sending request") 7599 return 7600 } 7601 7602 result, err = client.UpdateSecretResponder(resp) 7603 if err != nil { 7604 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateSecret", resp, "Failure responding to request") 7605 return 7606 } 7607 7608 return 7609} 7610 7611// UpdateSecretPreparer prepares the UpdateSecret request. 7612func (client BaseClient) UpdateSecretPreparer(ctx context.Context, vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (*http.Request, error) { 7613 urlParameters := map[string]interface{}{ 7614 "vaultBaseUrl": vaultBaseURL, 7615 } 7616 7617 pathParameters := map[string]interface{}{ 7618 "secret-name": autorest.Encode("path", secretName), 7619 "secret-version": autorest.Encode("path", secretVersion), 7620 } 7621 7622 const APIVersion = "7.2-preview" 7623 queryParameters := map[string]interface{}{ 7624 "api-version": APIVersion, 7625 } 7626 7627 preparer := autorest.CreatePreparer( 7628 autorest.AsContentType("application/json; charset=utf-8"), 7629 autorest.AsPatch(), 7630 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7631 autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), 7632 autorest.WithJSON(parameters), 7633 autorest.WithQueryParameters(queryParameters)) 7634 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7635} 7636 7637// UpdateSecretSender sends the UpdateSecret request. The method will close the 7638// http.Response Body if it receives an error. 7639func (client BaseClient) UpdateSecretSender(req *http.Request) (*http.Response, error) { 7640 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7641} 7642 7643// UpdateSecretResponder handles the response to the UpdateSecret request. The method always 7644// closes the http.Response Body. 7645func (client BaseClient) UpdateSecretResponder(resp *http.Response) (result SecretBundle, err error) { 7646 err = autorest.Respond( 7647 resp, 7648 azure.WithErrorUnlessStatusCode(http.StatusOK), 7649 autorest.ByUnmarshallingJSON(&result), 7650 autorest.ByClosing()) 7651 result.Response = autorest.Response{Response: resp} 7652 return 7653} 7654 7655// UpdateStorageAccount updates the specified attributes associated with the given storage account. This operation 7656// requires the storage/set/update permission. 7657// Parameters: 7658// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7659// storageAccountName - the name of the storage account. 7660// parameters - the parameters to update a storage account. 7661func (client BaseClient) UpdateStorageAccount(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (result StorageBundle, err error) { 7662 if tracing.IsEnabled() { 7663 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateStorageAccount") 7664 defer func() { 7665 sc := -1 7666 if result.Response.Response != nil { 7667 sc = result.Response.Response.StatusCode 7668 } 7669 tracing.EndSpan(ctx, sc, err) 7670 }() 7671 } 7672 if err := validation.Validate([]validation.Validation{ 7673 {TargetValue: storageAccountName, 7674 Constraints: []validation.Constraint{{Target: "storageAccountName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z]+$`, Chain: nil}}}}); err != nil { 7675 return result, validation.NewError("keyvault.BaseClient", "UpdateStorageAccount", err.Error()) 7676 } 7677 7678 req, err := client.UpdateStorageAccountPreparer(ctx, vaultBaseURL, storageAccountName, parameters) 7679 if err != nil { 7680 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", nil, "Failure preparing request") 7681 return 7682 } 7683 7684 resp, err := client.UpdateStorageAccountSender(req) 7685 if err != nil { 7686 result.Response = autorest.Response{Response: resp} 7687 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure sending request") 7688 return 7689 } 7690 7691 result, err = client.UpdateStorageAccountResponder(resp) 7692 if err != nil { 7693 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "UpdateStorageAccount", resp, "Failure responding to request") 7694 return 7695 } 7696 7697 return 7698} 7699 7700// UpdateStorageAccountPreparer prepares the UpdateStorageAccount request. 7701func (client BaseClient) UpdateStorageAccountPreparer(ctx context.Context, vaultBaseURL string, storageAccountName string, parameters StorageAccountUpdateParameters) (*http.Request, error) { 7702 urlParameters := map[string]interface{}{ 7703 "vaultBaseUrl": vaultBaseURL, 7704 } 7705 7706 pathParameters := map[string]interface{}{ 7707 "storage-account-name": autorest.Encode("path", storageAccountName), 7708 } 7709 7710 const APIVersion = "7.2-preview" 7711 queryParameters := map[string]interface{}{ 7712 "api-version": APIVersion, 7713 } 7714 7715 preparer := autorest.CreatePreparer( 7716 autorest.AsContentType("application/json; charset=utf-8"), 7717 autorest.AsPatch(), 7718 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7719 autorest.WithPathParameters("/storage/{storage-account-name}", pathParameters), 7720 autorest.WithJSON(parameters), 7721 autorest.WithQueryParameters(queryParameters)) 7722 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7723} 7724 7725// UpdateStorageAccountSender sends the UpdateStorageAccount request. The method will close the 7726// http.Response Body if it receives an error. 7727func (client BaseClient) UpdateStorageAccountSender(req *http.Request) (*http.Response, error) { 7728 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7729} 7730 7731// UpdateStorageAccountResponder handles the response to the UpdateStorageAccount request. The method always 7732// closes the http.Response Body. 7733func (client BaseClient) UpdateStorageAccountResponder(resp *http.Response) (result StorageBundle, err error) { 7734 err = autorest.Respond( 7735 resp, 7736 azure.WithErrorUnlessStatusCode(http.StatusOK), 7737 autorest.ByUnmarshallingJSON(&result), 7738 autorest.ByClosing()) 7739 result.Response = autorest.Response{Response: resp} 7740 return 7741} 7742 7743// Verify the VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly 7744// necessary for asymmetric keys stored in Azure Key Vault since signature verification can be performed using the 7745// public portion of the key but this operation is supported as a convenience for callers that only have a 7746// key-reference and not the public portion of the key. This operation requires the keys/verify permission. 7747// Parameters: 7748// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7749// keyName - the name of the key. 7750// keyVersion - the version of the key. 7751// parameters - the parameters for verify operations. 7752func (client BaseClient) Verify(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (result KeyVerifyResult, err error) { 7753 if tracing.IsEnabled() { 7754 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Verify") 7755 defer func() { 7756 sc := -1 7757 if result.Response.Response != nil { 7758 sc = result.Response.Response.StatusCode 7759 } 7760 tracing.EndSpan(ctx, sc, err) 7761 }() 7762 } 7763 if err := validation.Validate([]validation.Validation{ 7764 {TargetValue: parameters, 7765 Constraints: []validation.Constraint{{Target: "parameters.Digest", Name: validation.Null, Rule: true, Chain: nil}, 7766 {Target: "parameters.Signature", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 7767 return result, validation.NewError("keyvault.BaseClient", "Verify", err.Error()) 7768 } 7769 7770 req, err := client.VerifyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 7771 if err != nil { 7772 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", nil, "Failure preparing request") 7773 return 7774 } 7775 7776 resp, err := client.VerifySender(req) 7777 if err != nil { 7778 result.Response = autorest.Response{Response: resp} 7779 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure sending request") 7780 return 7781 } 7782 7783 result, err = client.VerifyResponder(resp) 7784 if err != nil { 7785 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "Verify", resp, "Failure responding to request") 7786 return 7787 } 7788 7789 return 7790} 7791 7792// VerifyPreparer prepares the Verify request. 7793func (client BaseClient) VerifyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (*http.Request, error) { 7794 urlParameters := map[string]interface{}{ 7795 "vaultBaseUrl": vaultBaseURL, 7796 } 7797 7798 pathParameters := map[string]interface{}{ 7799 "key-name": autorest.Encode("path", keyName), 7800 "key-version": autorest.Encode("path", keyVersion), 7801 } 7802 7803 const APIVersion = "7.2-preview" 7804 queryParameters := map[string]interface{}{ 7805 "api-version": APIVersion, 7806 } 7807 7808 preparer := autorest.CreatePreparer( 7809 autorest.AsContentType("application/json; charset=utf-8"), 7810 autorest.AsPost(), 7811 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7812 autorest.WithPathParameters("/keys/{key-name}/{key-version}/verify", pathParameters), 7813 autorest.WithJSON(parameters), 7814 autorest.WithQueryParameters(queryParameters)) 7815 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7816} 7817 7818// VerifySender sends the Verify request. The method will close the 7819// http.Response Body if it receives an error. 7820func (client BaseClient) VerifySender(req *http.Request) (*http.Response, error) { 7821 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7822} 7823 7824// VerifyResponder handles the response to the Verify request. The method always 7825// closes the http.Response Body. 7826func (client BaseClient) VerifyResponder(resp *http.Response) (result KeyVerifyResult, err error) { 7827 err = autorest.Respond( 7828 resp, 7829 azure.WithErrorUnlessStatusCode(http.StatusOK), 7830 autorest.ByUnmarshallingJSON(&result), 7831 autorest.ByClosing()) 7832 result.Response = autorest.Response{Response: resp} 7833 return 7834} 7835 7836// WrapKey the WRAP operation supports encryption of a symmetric key using a key encryption key that has previously 7837// been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure 7838// Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This 7839// operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have 7840// access to the public key material. This operation requires the keys/wrapKey permission. 7841// Parameters: 7842// vaultBaseURL - the vault name, for example https://myvault.vault.azure.net. 7843// keyName - the name of the key. 7844// keyVersion - the version of the key. 7845// parameters - the parameters for wrap operation. 7846func (client BaseClient) WrapKey(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { 7847 if tracing.IsEnabled() { 7848 ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.WrapKey") 7849 defer func() { 7850 sc := -1 7851 if result.Response.Response != nil { 7852 sc = result.Response.Response.StatusCode 7853 } 7854 tracing.EndSpan(ctx, sc, err) 7855 }() 7856 } 7857 if err := validation.Validate([]validation.Validation{ 7858 {TargetValue: parameters, 7859 Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 7860 return result, validation.NewError("keyvault.BaseClient", "WrapKey", err.Error()) 7861 } 7862 7863 req, err := client.WrapKeyPreparer(ctx, vaultBaseURL, keyName, keyVersion, parameters) 7864 if err != nil { 7865 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", nil, "Failure preparing request") 7866 return 7867 } 7868 7869 resp, err := client.WrapKeySender(req) 7870 if err != nil { 7871 result.Response = autorest.Response{Response: resp} 7872 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure sending request") 7873 return 7874 } 7875 7876 result, err = client.WrapKeyResponder(resp) 7877 if err != nil { 7878 err = autorest.NewErrorWithError(err, "keyvault.BaseClient", "WrapKey", resp, "Failure responding to request") 7879 return 7880 } 7881 7882 return 7883} 7884 7885// WrapKeyPreparer prepares the WrapKey request. 7886func (client BaseClient) WrapKeyPreparer(ctx context.Context, vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { 7887 urlParameters := map[string]interface{}{ 7888 "vaultBaseUrl": vaultBaseURL, 7889 } 7890 7891 pathParameters := map[string]interface{}{ 7892 "key-name": autorest.Encode("path", keyName), 7893 "key-version": autorest.Encode("path", keyVersion), 7894 } 7895 7896 const APIVersion = "7.2-preview" 7897 queryParameters := map[string]interface{}{ 7898 "api-version": APIVersion, 7899 } 7900 7901 preparer := autorest.CreatePreparer( 7902 autorest.AsContentType("application/json; charset=utf-8"), 7903 autorest.AsPost(), 7904 autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), 7905 autorest.WithPathParameters("/keys/{key-name}/{key-version}/wrapkey", pathParameters), 7906 autorest.WithJSON(parameters), 7907 autorest.WithQueryParameters(queryParameters)) 7908 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 7909} 7910 7911// WrapKeySender sends the WrapKey request. The method will close the 7912// http.Response Body if it receives an error. 7913func (client BaseClient) WrapKeySender(req *http.Request) (*http.Response, error) { 7914 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7915} 7916 7917// WrapKeyResponder handles the response to the WrapKey request. The method always 7918// closes the http.Response Body. 7919func (client BaseClient) WrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { 7920 err = autorest.Respond( 7921 resp, 7922 azure.WithErrorUnlessStatusCode(http.StatusOK), 7923 autorest.ByUnmarshallingJSON(&result), 7924 autorest.ByClosing()) 7925 result.Response = autorest.Response{Response: resp} 7926 return 7927} 7928