protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeleteTargetRequest request;

            try
            {
                request = new DeleteTargetRequest
                {
                    TargetId     = TargetId,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteTarget(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        /// <summary>
        /// Deletes a specified target for notifications.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DeleteTarget service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the DeleteTarget service method, as returned by CodeStarNotifications.</returns>
        /// <exception cref="Amazon.CodeStarNotifications.Model.ValidationException">
        /// One or more parameter values are not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codestar-notifications-2019-10-15/DeleteTarget">REST API Reference for DeleteTarget Operation</seealso>
        public virtual Task <DeleteTargetResponse> DeleteTargetAsync(DeleteTargetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteTargetRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteTargetResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteTargetResponse>(request, options, cancellationToken));
        }
        internal virtual DeleteTargetResponse DeleteTarget(DeleteTargetRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteTargetRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteTargetResponseUnmarshaller.Instance;

            return(Invoke <DeleteTargetResponse>(request, options));
        }
Beispiel #4
0
        public async Task <GenericResponse> DeleteTarget(DeleteTargetRequest request)
        {
            var @params = new Requests.delete_target();

            if (null != request)
            {
                CopyPropertiesFrom(@params, request);
            }

            var result = await Omp.QueryAsync <Responses.delete_target_response>(this.Address, @params);

            return(Generic(result));
        }
        /// <summary>
        /// 删除事件目标
        /// </summary>
        /// <param name="req"><see cref="DeleteTargetRequest"/></param>
        /// <returns><see cref="DeleteTargetResponse"/></returns>
        public DeleteTargetResponse DeleteTargetSync(DeleteTargetRequest req)
        {
            JsonResponseModel <DeleteTargetResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DeleteTarget");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteTargetResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }