/// <summary> /// Deletes the gateway with the given identifier. /// </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/apigateway/DeleteGateway.cs.html">here</a> to see an example of how to use DeleteGateway API.</example> public async Task <DeleteGatewayResponse> DeleteGateway(DeleteGatewayRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called deleteGateway"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/gateways/{gatewayId}".Trim('/'))); HttpMethod method = new HttpMethod("DELETE"); 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 <DeleteGatewayResponse>(responseMessage)); } catch (Exception e) { logger.Error($"DeleteGateway failed with error: {e.Message}"); throw; } }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIApigatewayGateway", "Remove")) { return; } DeleteGatewayRequest request; try { request = new DeleteGatewayRequest { GatewayId = GatewayId, IfMatch = IfMatch, OpcRequestId = OpcRequestId }; response = client.DeleteGateway(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary>Snippet for DeleteGateway</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void DeleteGatewayRequestObject() { // Create client ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create(); // Initialize request argument(s) DeleteGatewayRequest request = new DeleteGatewayRequest { GatewayName = GatewayName.FromProjectLocationGateway("[PROJECT]", "[LOCATION]", "[GATEWAY]"), }; // Make the request Operation <Empty, OperationMetadata> response = apiGatewayServiceClient.DeleteGateway(request); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Empty result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Empty, OperationMetadata> retrievedResponse = apiGatewayServiceClient.PollOnceDeleteGateway(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } }
/// <summary> /// Deletes a backup gateway. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteGateway service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DeleteGateway service method, as returned by BackupGateway.</returns> /// <exception cref="Amazon.BackupGateway.Model.InternalServerException"> /// The operation did not succeed because an internal error occurred. Try again later. /// </exception> /// <exception cref="Amazon.BackupGateway.Model.ResourceNotFoundException"> /// A resource that is required for the action wasn't found. /// </exception> /// <exception cref="Amazon.BackupGateway.Model.ValidationException"> /// The operation did not succeed because a validation error occurred. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/backup-gateway-2021-01-01/DeleteGateway">REST API Reference for DeleteGateway Operation</seealso> public virtual Task <DeleteGatewayResponse> DeleteGatewayAsync(DeleteGatewayRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteGatewayRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteGatewayResponseUnmarshaller.Instance; return(InvokeAsync <DeleteGatewayResponse>(request, options, cancellationToken)); }
internal virtual DeleteGatewayResponse DeleteGateway(DeleteGatewayRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteGatewayRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteGatewayResponseUnmarshaller.Instance; return(Invoke <DeleteGatewayResponse>(request, options)); }