Exemple #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIComputeConsoleHistory", "Remove"))
            {
                return;
            }

            DeleteConsoleHistoryRequest request;

            try
            {
                request = new DeleteConsoleHistoryRequest
                {
                    InstanceConsoleHistoryId = InstanceConsoleHistoryId,
                    IfMatch = IfMatch
                };

                response = client.DeleteConsoleHistory(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Deletes the specified console history metadata and the console history data.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DeleteConsoleHistoryResponse DeleteConsoleHistory(DeleteConsoleHistoryRequest request)
        {
            var uri = new Uri($"{GetEndPoint(CoreServices.InstanceConsoleHistory, this.Region)}/{request.InstanceConsoleHistoryId}");

            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 DeleteConsoleHistoryResponse()
                        {
                            OpcRequestId = webResponse.Headers.Get("opc-request-id")
                        });
                    }
        }