/// <summary> /// Schedules the deletion of the specified vault. This sets the lifecycle state of the vault and all keys in it /// that are not already scheduled for deletion to `PENDING_DELETION` and then deletes them after the /// retention period ends. The lifecycle state and time of deletion for keys already scheduled for deletion won't /// change. If any keys in the vault are scheduled to be deleted after the specified time of /// deletion for the vault, the call is rejected with the error code 409. /// <br/> /// As a provisioning operation, this call is subject to a Key Management limit that applies to /// the total number of requests across all provisioning write operations. Key Management might /// throttle this call to reject an otherwise valid request when the total rate of provisioning /// write operations exceeds 10 requests per second for a given tenancy. /// /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/keymanagement/ScheduleVaultDeletion.cs.html">here</a> to see an example of how to use ScheduleVaultDeletion API.</example> public async Task <ScheduleVaultDeletionResponse> ScheduleVaultDeletion(ScheduleVaultDeletionRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called scheduleVaultDeletion"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/20180608/vaults/{vaultId}/actions/scheduleDeletion".Trim('/'))); HttpMethod method = new HttpMethod("POST"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false); } else { responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false); } this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage); return(Converter.FromHttpResponseMessage <ScheduleVaultDeletionResponse>(responseMessage)); } catch (Exception e) { logger.Error($"ScheduleVaultDeletion failed with error: {e.Message}"); throw; } }
protected override void ProcessRecord() { base.ProcessRecord(); ScheduleVaultDeletionRequest request; try { request = new ScheduleVaultDeletionRequest { VaultId = VaultId, ScheduleVaultDeletionDetails = ScheduleVaultDeletionDetails, IfMatch = IfMatch, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken }; response = client.ScheduleVaultDeletion(request).GetAwaiter().GetResult(); WriteOutput(response, response.Vault); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
private static async Task ScheduleVaultDeletion(KmsVaultClient kmsVaultClient, string vaultId) { logger.Info("Schedule Vault Deletion"); ScheduleVaultDeletionDetails scheduleVaultDeletionDetails = new ScheduleVaultDeletionDetails { TimeOfDeletion = null }; ScheduleVaultDeletionRequest scheduleVaultDeletionRequest = new ScheduleVaultDeletionRequest { ScheduleVaultDeletionDetails = scheduleVaultDeletionDetails, VaultId = vaultId }; ScheduleVaultDeletionResponse scheduleVaultDeletionResponse = await kmsVaultClient.ScheduleVaultDeletion(scheduleVaultDeletionRequest); logger.Info("Deletion Scheduled Successfully"); }