Exemplo n.º 1
0
        internal virtual DeletePolicyResponse DeletePolicy(DeletePolicyRequest request)
        {
            var marshaller   = DeletePolicyRequestMarshaller.Instance;
            var unmarshaller = DeletePolicyResponseUnmarshaller.Instance;

            return(Invoke <DeletePolicyRequest, DeletePolicyResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// <para>Deletes a policy created by PutScalingPolicy </para>
        /// </summary>
        ///
        /// <param name="deletePolicyRequest">Container for the necessary parameters to execute the DeletePolicy service method on
        ///           AmazonAutoScaling.</param>
        ///
        public DeletePolicyResponse DeletePolicy(DeletePolicyRequest deletePolicyRequest)
        {
            IRequest <DeletePolicyRequest> request  = new DeletePolicyRequestMarshaller().Marshall(deletePolicyRequest);
            DeletePolicyResponse           response = Invoke <DeletePolicyRequest, DeletePolicyResponse> (request, this.signer, DeletePolicyResponseUnmarshaller.GetInstance());

            return(response);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

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

            DeletePolicyRequest request;

            try
            {
                request = new DeletePolicyRequest
                {
                    PolicyId = PolicyId,
                    IfMatch  = IfMatch
                };

                response = client.DeletePolicy(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除内容转发策略
        /// </summary>
        /// <param name="requestParams">请求参数.</param>
        /// <returns>返回对象<see cref="UCloudSDK.Models.DeletePolicyResponse"/></returns>
        public DeletePolicyResponse DeletePolicy(DeletePolicyRequest requestParams)
        {
            var request = new RestRequest(Method.GET);

            request.AddUObject(requestParams);
            return(Execute <DeletePolicyResponse>(request));
        }
Exemplo n.º 5
0
        public void DeletePolicyTest()
        {
            var entity   = new DeletePolicyRequest(Config.region, groupId, policyId);
            var response = ulb.DeletePolicy(entity);

            Assert.AreEqual(response.RetCode, 0);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeletePolicy operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeletePolicy 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/fms-2018-01-01/DeletePolicy">REST API Reference for DeletePolicy Operation</seealso>
        public virtual Task <DeletePolicyResponse> DeletePolicyAsync(DeletePolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = DeletePolicyRequestMarshaller.Instance;
            var unmarshaller = DeletePolicyResponseUnmarshaller.Instance;

            return(InvokeAsync <DeletePolicyRequest, DeletePolicyResponse>(request, marshaller,
                                                                           unmarshaller, cancellationToken));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Permanently deletes an AWS Firewall Manager policy.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DeletePolicy 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 DeletePolicy service method, as returned by FMS.</returns>
        /// <exception cref="Amazon.FMS.Model.InternalErrorException">
        /// The operation failed because of a system problem, even though the request was valid.
        /// Retry your request.
        /// </exception>
        /// <exception cref="Amazon.FMS.Model.InvalidOperationException">
        /// The operation failed because there was nothing to do. For example, you might have
        /// submitted an <code>AssociateAdminAccount</code> request, but the account ID that you
        /// submitted was already set as the AWS Firewall Manager administrator.
        /// </exception>
        /// <exception cref="Amazon.FMS.Model.ResourceNotFoundException">
        /// The specified resource was not found.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/fms-2018-01-01/DeletePolicy">REST API Reference for DeletePolicy Operation</seealso>
        public virtual Task <DeletePolicyResponse> DeletePolicyAsync(DeletePolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeletePolicyRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeletePolicyResponseUnmarshaller.Instance;

            return(InvokeAsync <DeletePolicyResponse>(request, options, cancellationToken));
        }
Exemplo n.º 8
0
        internal virtual DeletePolicyResponse DeletePolicy(DeletePolicyRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeletePolicyRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeletePolicyResponseUnmarshaller.Instance;

            return(Invoke <DeletePolicyResponse>(request, options));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 删除策略
        /// </summary>
        public async Task <DeletePolicyResponse> DeletePolicyAsync(DeletePolicyRequest deletePolicyRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("policy_id", deletePolicyRequest.PolicyId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v3/{project_id}/policies/{policy_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", deletePolicyRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeletePolicyResponse>(response));
        }
Exemplo n.º 10
0
        public void DeletePolicyResourceNames()
        {
            moq::Mock <OrgPolicy.OrgPolicyClient> mockGrpcClient = new moq::Mock <OrgPolicy.OrgPolicyClient>(moq::MockBehavior.Strict);
            DeletePolicyRequest request = new DeletePolicyRequest
            {
                PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeletePolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            OrgPolicyClient client = new OrgPolicyClientImpl(mockGrpcClient.Object, null);

            client.DeletePolicy(request.PolicyName);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// 本接口(DeletePolicy)可用于删除策略。
        /// </summary>
        /// <param name="req">参考<see cref="DeletePolicyRequest"/></param>
        /// <returns>参考<see cref="DeletePolicyResponse"/>实例</returns>
        public async Task <DeletePolicyResponse> DeletePolicy(DeletePolicyRequest req)
        {
            JsonResponseModel <DeletePolicyResponse> rsp = null;

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

                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeletePolicyResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Exemplo n.º 12
0
        public async stt::Task DeletePolicyResourceNamesAsync()
        {
            moq::Mock <OrgPolicy.OrgPolicyClient> mockGrpcClient = new moq::Mock <OrgPolicy.OrgPolicyClient>(moq::MockBehavior.Strict);
            DeletePolicyRequest request = new DeletePolicyRequest
            {
                PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeletePolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            OrgPolicyClient client = new OrgPolicyClientImpl(mockGrpcClient.Object, null);
            await client.DeletePolicyAsync(request.PolicyName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeletePolicyAsync(request.PolicyName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 13
0
        public async override Task <Task> Handle(DeletePolicyCommand command, CancellationToken cancellationToken = default)
        {
            using var client = _awsClientFactory.Create <AmazonIdentityManagementServiceClient>(command.AssumeProfile);

            var request = new DeletePolicyRequest()
            {
                PolicyArn = command.PolicyArn
            };

            try
            {
                await client.DeletePolicyAsync(request, cancellationToken);
            }
            catch (AmazonServiceException e)
            {
                throw new Exception(e.Message, e);
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Initializes the Organizations client object and then uses it to
        /// delete the Policy with the specified Policy Id.
        /// </summary>
        /// <returns></returns>
        public static async Task Main()
        {
            // Create the client object using the default account.
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            var policyId = "p-c0hsjgmq";

            var request = new DeletePolicyRequest
            {
                PolicyId = policyId,
            };

            var response = await client.DeletePolicyAsync(request);

            if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"Successfully deleted Policy: {policyId}.");
            }
            else
            {
                Console.WriteLine($"Could not delete Policy: {policyId}.");
            }
        }
 public Task <DeletePolicyResponse> DeletePolicyAsync(DeletePolicyRequest request, CancellationToken cancellationToken = new CancellationToken())
 {
     throw new System.NotImplementedException();
 }