protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIComputeBootVolume", "DisMount")) { return; } DetachBootVolumeRequest request; try { request = new DetachBootVolumeRequest { BootVolumeAttachmentId = BootVolumeAttachmentId, IfMatch = IfMatch }; response = client.DetachBootVolume(request).GetAwaiter().GetResult(); WriteOutput(response); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Detaches a boot volume from an instance. You must specify the OCID of the boot volume attachment. ///This is an asynchronous operation.The attachment's lifecycleState will change to DETACHING ///temporarily until the attachment is completely removed. /// </summary> /// <param name="request"></param> /// <returns></returns> public DetachBootVolumeResponse DetachBootVolume(DetachBootVolumeRequest request) { var uri = new Uri($"{GetEndPoint(CoreServices.BootVolumeAttachment, this.Region)}/{request.BootVolumeAttachmentId}"); 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 DetachBootVolumeResponse() { OpcRequestId = webResponse.Headers.Get("opc-request-id") }); } }