private async Task GenerateMasterKey(string keyAlias) { var createKeyResponse = await mAmazonKeyManagementService.CreateKeyAsync(new CreateKeyRequest { }); if (mEnableAutomaticKeyRotation) { await mAmazonKeyManagementService.EnableKeyRotationAsync( new EnableKeyRotationRequest { KeyId = createKeyResponse.KeyMetadata.KeyId }); } await mAmazonKeyManagementService.CreateAliasAsync(keyAlias, createKeyResponse.KeyMetadata.KeyId); }
private async Task GenerateMasterKey(string keyAlias) { var createKeyResponse = await mAmazonKeyManagementService.CreateKeyAsync(new CreateKeyRequest { }); if (mEnableAutomaticKeyRotation) { await mAmazonKeyManagementService.EnableKeyRotationAsync( new EnableKeyRotationRequest { KeyId = createKeyResponse.KeyMetadata.KeyId }); } await Policy .Handle <NotFoundException>() .WaitAndRetry(3, attempt => TimeSpan.FromSeconds(0.5 * attempt)) .Execute(async() => await mAmazonKeyManagementService.CreateAliasAsync(keyAlias, createKeyResponse.KeyMetadata.KeyId)); }
private Amazon.KeyManagementService.Model.CreateKeyResponse CallAWSServiceOperation(IAmazonKeyManagementService client, Amazon.KeyManagementService.Model.CreateKeyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Key Management Service", "CreateKey"); try { #if DESKTOP return(client.CreateKey(request)); #elif CORECLR return(client.CreateKeyAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
private async Task GenerateMasterKey(string keyAlias) { var createKeyResponse = await mAmazonKeyManagementService.CreateKeyAsync(new CreateKeyRequest()); await mAmazonKeyManagementService.CreateAliasAsync(keyAlias, createKeyResponse.KeyMetadata.KeyId); }