protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIDatabaseDbHome", "Remove")) { return; } DeleteDbHomeRequest request; try { request = new DeleteDbHomeRequest { DbHomeId = DbHomeId, IfMatch = IfMatch, PerformFinalBackup = PerformFinalBackup }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes a DB Home. The DB Home and its database data are local to the DB system and will be lost when it is deleted. /// Oracle recommends that you back up any data in the DB system prior to deleting it. /// </summary> /// <param name="request"></param> /// <returns></returns> public DeleteDbHomeResponse DeleteDbHome(DeleteDbHomeRequest request) { var uri = new Uri($"{GetEndPoint(DatabaseServices.DbHomes, this.Region)}/{request.DbHomeId}?performFinalBackup={request.PerformFinalBackup}"); using (var webResponse = this.RestClient.Delete(uri, new HttpRequestHeaderParam() { IfMatch = request.IfMatch })) using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = reader.ReadToEnd(); return(new DeleteDbHomeResponse() { OpcRequestId = webResponse.Headers.Get("opc-request-id") }); } }
private void HandleOutput(DeleteDbHomeRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case StatusParamSet: response = client.Waiters.ForDeleteDbHome(request, waiterConfig, WaitForStatus).Execute(); break; case Default: response = client.DeleteDbHome(request).GetAwaiter().GetResult(); break; } WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); }