public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WAFRegional.Model.DeleteRuleRequest(); if (cmdletContext.ChangeToken != null) { request.ChangeToken = cmdletContext.ChangeToken; } if (cmdletContext.RuleId != null) { request.RuleId = cmdletContext.RuleId; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the DeleteRule operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteRule 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> public Task<DeleteRuleResponse> DeleteRuleAsync(DeleteRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteRuleRequestMarshaller(); var unmarshaller = DeleteRuleResponseUnmarshaller.Instance; return InvokeAsync<DeleteRuleRequest,DeleteRuleResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still /// used in any <code>WebACL</code> objects or if it still includes any predicates, such /// as <code>ByteMatchSet</code> objects. /// /// /// <para> /// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>. /// </para> /// /// <para> /// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps: /// </para> /// <ol> <li> /// <para> /// Update the <code>Rule</code> to remove predicates, if any. For more information, see /// <a>UpdateRule</a>. /// </para> /// </li> <li> /// <para> /// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code> /// parameter of a <code>DeleteRule</code> request. /// </para> /// </li> <li> /// <para> /// Submit a <code>DeleteRule</code> request. /// </para> /// </li> </ol> /// </summary> /// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to delete. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param> /// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</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 DeleteRule service method, as returned by WAFRegional.</returns> /// <exception cref="Amazon.WAFRegional.Model.WAFInternalErrorException"> /// The operation failed because of a system problem, even though the request was valid. /// Retry your request. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFInvalidAccountException"> /// The operation failed because you tried to create, update, or delete an object by using /// an invalid account identifier. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonEmptyEntityException"> /// The operation failed because you tried to delete an object that isn't empty. For example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code> /// objects or other predicates. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete an <code>IPSet</code> that references one or more IP addresses. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonexistentItemException"> /// The operation failed because the referenced object doesn't exist. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFReferencedItemException"> /// The operation failed because you tried to delete an object that is still in use. For /// example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFStaleDataException"> /// The operation failed because you tried to create, update, or delete an object by using /// a change token that has already been used. /// </exception> public Task<DeleteRuleResponse> DeleteRuleAsync(string ruleId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new DeleteRuleRequest(); request.RuleId = ruleId; request.ChangeToken = changeToken; return DeleteRuleAsync(request, cancellationToken); }
/// <summary> /// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still /// used in any <code>WebACL</code> objects or if it still includes any predicates, such /// as <code>ByteMatchSet</code> objects. /// /// /// <para> /// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>. /// </para> /// /// <para> /// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps: /// </para> /// <ol> <li> /// <para> /// Update the <code>Rule</code> to remove predicates, if any. For more information, see /// <a>UpdateRule</a>. /// </para> /// </li> <li> /// <para> /// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code> /// parameter of a <code>DeleteRule</code> request. /// </para> /// </li> <li> /// <para> /// Submit a <code>DeleteRule</code> request. /// </para> /// </li> </ol> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteRule service method.</param> /// /// <returns>The response from the DeleteRule service method, as returned by WAFRegional.</returns> /// <exception cref="Amazon.WAFRegional.Model.WAFInternalErrorException"> /// The operation failed because of a system problem, even though the request was valid. /// Retry your request. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFInvalidAccountException"> /// The operation failed because you tried to create, update, or delete an object by using /// an invalid account identifier. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonEmptyEntityException"> /// The operation failed because you tried to delete an object that isn't empty. For example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code> /// objects or other predicates. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete an <code>IPSet</code> that references one or more IP addresses. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonexistentItemException"> /// The operation failed because the referenced object doesn't exist. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFReferencedItemException"> /// The operation failed because you tried to delete an object that is still in use. For /// example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFStaleDataException"> /// The operation failed because you tried to create, update, or delete an object by using /// a change token that has already been used. /// </exception> public DeleteRuleResponse DeleteRule(DeleteRuleRequest request) { var marshaller = new DeleteRuleRequestMarshaller(); var unmarshaller = DeleteRuleResponseUnmarshaller.Instance; return Invoke<DeleteRuleRequest,DeleteRuleResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still /// used in any <code>WebACL</code> objects or if it still includes any predicates, such /// as <code>ByteMatchSet</code> objects. /// /// /// <para> /// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>. /// </para> /// /// <para> /// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps: /// </para> /// <ol> <li> /// <para> /// Update the <code>Rule</code> to remove predicates, if any. For more information, see /// <a>UpdateRule</a>. /// </para> /// </li> <li> /// <para> /// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code> /// parameter of a <code>DeleteRule</code> request. /// </para> /// </li> <li> /// <para> /// Submit a <code>DeleteRule</code> request. /// </para> /// </li> </ol> /// </summary> /// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to delete. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param> /// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param> /// /// <returns>The response from the DeleteRule service method, as returned by WAFRegional.</returns> /// <exception cref="Amazon.WAFRegional.Model.WAFInternalErrorException"> /// The operation failed because of a system problem, even though the request was valid. /// Retry your request. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFInvalidAccountException"> /// The operation failed because you tried to create, update, or delete an object by using /// an invalid account identifier. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonEmptyEntityException"> /// The operation failed because you tried to delete an object that isn't empty. For example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code> /// objects or other predicates. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code> /// objects. /// </para> /// </li> <li> /// <para> /// You tried to delete an <code>IPSet</code> that references one or more IP addresses. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFNonexistentItemException"> /// The operation failed because the referenced object doesn't exist. /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFReferencedItemException"> /// The operation failed because you tried to delete an object that is still in use. For /// example: /// /// <ul> <li> /// <para> /// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>. /// </para> /// </li> <li> /// <para> /// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFStaleDataException"> /// The operation failed because you tried to create, update, or delete an object by using /// a change token that has already been used. /// </exception> public DeleteRuleResponse DeleteRule(string ruleId, string changeToken) { var request = new DeleteRuleRequest(); request.RuleId = ruleId; request.ChangeToken = changeToken; return DeleteRule(request); }
private Amazon.WAFRegional.Model.DeleteRuleResponse CallAWSServiceOperation(IAmazonWAFRegional client, Amazon.WAFRegional.Model.DeleteRuleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS WAF Regional", "DeleteRule"); try { #if DESKTOP return(client.DeleteRule(request)); #elif CORECLR return(client.DeleteRuleAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the DeleteRule operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteRule operation on AmazonWAFRegionalClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteRule /// operation.</returns> public IAsyncResult BeginDeleteRule(DeleteRuleRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteRuleRequestMarshaller(); var unmarshaller = DeleteRuleResponseUnmarshaller.Instance; return BeginInvoke<DeleteRuleRequest>(request, marshaller, unmarshaller, callback, state); }