Beispiel #1
0
        internal virtual DeleteBackupResponse DeleteBackup(DeleteBackupRequest request)
        {
            var marshaller   = DeleteBackupRequestMarshaller.Instance;
            var unmarshaller = DeleteBackupResponseUnmarshaller.Instance;

            return(Invoke <DeleteBackupRequest, DeleteBackupResponse>(request, marshaller, unmarshaller));
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeleteBackupRequest request;

            try
            {
                request = new DeleteBackupRequest
                {
                    BackupId     = BackupId,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteBackup(request).GetAwaiter().GetResult();
                WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId));
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Beispiel #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeleteBackupRequest request;

            try
            {
                request = new DeleteBackupRequest
                {
                    BackupId = BackupId,
                    IfMatch  = IfMatch
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Delete a Backup.
        ///
        /// </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/mysql/DeleteBackup.cs.html">here</a> to see an example of how to use DeleteBackup API.</example>
        public async Task <DeleteBackupResponse> DeleteBackup(DeleteBackupRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called deleteBackup");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/backups/{backupId}".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 <DeleteBackupResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"DeleteBackup failed with error: {e.Message}");
                throw;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteBackup operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteBackup operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/opsworkscm-2016-11-01/DeleteBackup">REST API Reference for DeleteBackup Operation</seealso>
        public virtual Task <DeleteBackupResponse> DeleteBackupAsync(DeleteBackupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = DeleteBackupRequestMarshaller.Instance;
            var unmarshaller = DeleteBackupResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteBackupRequest, DeleteBackupResponse>(request, marshaller,
                                                                           unmarshaller, cancellationToken));
        }
Beispiel #6
0
        internal virtual DeleteBackupResponse DeleteBackup(DeleteBackupRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteBackupRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteBackupResponseUnmarshaller.Instance;

            return(Invoke <DeleteBackupResponse>(request, options));
        }
Beispiel #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteBackup operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteBackup operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cloudhsmv2-2017-04-28/DeleteBackup">REST API Reference for DeleteBackup Operation</seealso>
        public virtual Task <DeleteBackupResponse> DeleteBackupAsync(DeleteBackupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteBackupRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteBackupResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteBackupResponse>(request, options, cancellationToken));
        }
Beispiel #8
0
        /// <summary>
        /// 删除备份
        /// </summary>
        public async Task <DeleteBackupResponse> DeleteBackupAsync(DeleteBackupRequest deleteBackupRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("backup_id", deleteBackupRequest.BackupId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/backups/{backup_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteBackupRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteBackupResponse>(response));
        }
Beispiel #9
0
        public void TestDeleteBackup()
        {
            MongodbClient       mongodbClient = GetMongodbClient();
            DeleteBackupRequest request       = new DeleteBackupRequest();

            request.RegionId = "cn-north-1";
            request.BackupId = "mongo-hfu1w2uhbc@115306868213070";
            var response = mongodbClient.DeleteBackup(request).Result;

            _output.WriteLine(JsonConvert.SerializeObject(response));
        }
Beispiel #10
0
        /// <summary>Snippet for DeleteBackup</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteBackupRequestObject()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
            // Initialize request argument(s)
            DeleteBackupRequest request = new DeleteBackupRequest
            {
                BackupName = BackupName.FromProjectInstanceClusterBackup("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"),
            };

            // Make the request
            bigtableTableAdminClient.DeleteBackup(request);
        }
        /// <summary>
        /// 本接口(DeleteBackup)用于删除数据库备份。
        /// </summary>
        /// <param name="req">参考<see cref="DeleteBackupRequest"/></param>
        /// <returns>参考<see cref="DeleteBackupResponse"/>实例</returns>
        public async Task <DeleteBackupResponse> DeleteBackup(DeleteBackupRequest req)
        {
            JsonResponseModel <DeleteBackupResponse> rsp = null;

            try
            {
                var strResp = await this.InternalRequest(req, "DeleteBackup");

                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteBackupResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Beispiel #12
0
        private void HandleOutput(DeleteBackupRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

            switch (ParameterSetName)
            {
            case StatusParamSet:
                response = client.Waiters.ForDeleteBackup(request, waiterConfig, WaitForStatus).Execute();
                break;

            case Default:
                response = client.DeleteBackup(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId));
        }
        public static void DelelteBackups()
        {
            DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create();

            //delete backup contains "a"
            var dataTime          = DateTime.UtcNow.AddDays(1).ToString("yyyy-MM-dd");
            var listBackupRequest = new ListBackupsRequest
            {
                Parent = InstanceName.Format(projectId, instanceId),
                Filter = $"create_time < {dataTime}"
            };

            var backups = databaseAdminClient.ListBackups(listBackupRequest);

            foreach (var backup in backups)
            {
                var deleteBackupRequest = new DeleteBackupRequest()
                {
                    Name = backup.Name
                };
                databaseAdminClient.DeleteBackup(deleteBackupRequest);
            }
        }
Beispiel #14
0
 public Task <DeleteBackupResponse> DeleteBackupAsync(DeleteBackupRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
Beispiel #15
0
 Task <DeleteBackupResponse> IAmazonDynamoDB.DeleteBackupAsync(DeleteBackupRequest request, CancellationToken cancellationToken)
 {
     throw new NotSupportedException();
 }
 partial void Modify_DeleteBackupRequest(ref DeleteBackupRequest request, ref CallSettings settings) =>
 ApplyResourcePrefixHeaderFromBackup(ref settings, request.Name);
 /// <summary>
 ///  删除备份
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <DeleteBackupResponse> DeleteBackup(DeleteBackupRequest request)
 {
     return(await new DeleteBackupExecutor().Client(this).Execute <DeleteBackupResponse, DeleteBackupResult, DeleteBackupRequest>(request).ConfigureAwait(false));
 }
 /// <summary>
 ///  删除备份
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public DeleteBackupResponse DeleteBackup(DeleteBackupRequest request)
 {
     return(new DeleteBackupExecutor().Client(this).Execute <DeleteBackupResponse, DeleteBackupResult, DeleteBackupRequest>(request));
 }