コード例 #1
0
        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);
            }
        }
コード例 #2
0
        /// <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")
                        });
                    }
        }
コード例 #3
0
        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));
        }