private Amazon.WAFRegional.Model.CreateWebACLResponse CallAWSServiceOperation(IAmazonWAFRegional client, Amazon.WAFRegional.Model.CreateWebACLRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS WAF Regional", "CreateWebACL"); try { #if DESKTOP return(client.CreateWebACL(request)); #elif CORECLR return(client.CreateWebACLAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WAFRegional.Model.CreateWebACLRequest(); if (cmdletContext.ChangeToken != null) { request.ChangeToken = cmdletContext.ChangeToken; } // populate DefaultAction var requestDefaultActionIsNull = true; request.DefaultAction = new Amazon.WAFRegional.Model.WafAction(); Amazon.WAFRegional.WafActionType requestDefaultAction_defaultAction_Type = null; if (cmdletContext.DefaultAction_Type != null) { requestDefaultAction_defaultAction_Type = cmdletContext.DefaultAction_Type; } if (requestDefaultAction_defaultAction_Type != null) { request.DefaultAction.Type = requestDefaultAction_defaultAction_Type; requestDefaultActionIsNull = false; } // determine if request.DefaultAction should be set to null if (requestDefaultActionIsNull) { request.DefaultAction = null; } if (cmdletContext.MetricName != null) { request.MetricName = cmdletContext.MetricName; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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> /// Creates a <code>WebACL</code>, which contains the <code>Rules</code> that identify /// the CloudFront web requests that you want to allow, block, or count. AWS WAF evaluates /// <code>Rules</code> in order based on the value of <code>Priority</code> for each <code>Rule</code>. /// /// /// <para> /// You also specify a default action, either <code>ALLOW</code> or <code>BLOCK</code>. /// If a web request doesn't match any of the <code>Rules</code> in a <code>WebACL</code>, /// AWS WAF responds to the request with the default action. /// </para> /// /// <para> /// To create and configure a <code>WebACL</code>, perform the following steps: /// </para> /// <ol> <li> /// <para> /// Create and update the <code>ByteMatchSet</code> objects and other predicates that /// you want to include in <code>Rules</code>. For more information, see <a>CreateByteMatchSet</a>, /// <a>UpdateByteMatchSet</a>, <a>CreateIPSet</a>, <a>UpdateIPSet</a>, <a>CreateSqlInjectionMatchSet</a>, /// and <a>UpdateSqlInjectionMatchSet</a>. /// </para> /// </li> <li> /// <para> /// Create and update the <code>Rules</code> that you want to include in the <code>WebACL</code>. /// For more information, see <a>CreateRule</a> and <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>CreateWebACL</code> request. /// </para> /// </li> <li> /// <para> /// Submit a <code>CreateWebACL</code> request. /// </para> /// </li> <li> /// <para> /// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> /// parameter of an <a>UpdateWebACL</a> request. /// </para> /// </li> <li> /// <para> /// Submit an <a>UpdateWebACL</a> request to specify the <code>Rules</code> that you want /// to include in the <code>WebACL</code>, to specify the default action, and to associate /// the <code>WebACL</code> with a CloudFront distribution. /// </para> /// </li> </ol> /// <para> /// For more information about how to use the AWS WAF API, see the <a href="http://docs.aws.amazon.com/waf/latest/developerguide/">AWS /// WAF Developer Guide</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateWebACL service method.</param> /// /// <returns>The response from the CreateWebACL service method, as returned by WAFRegional.</returns> /// <exception cref="Amazon.WAFRegional.Model.WAFDisallowedNameException"> /// The name specified is invalid. /// </exception> /// <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.WAFInvalidParameterException"> /// The operation failed because AWS WAF didn't recognize a parameter in the request. /// For example: /// /// <ul> <li> /// <para> /// You specified an invalid parameter name. /// </para> /// </li> <li> /// <para> /// You specified an invalid value. /// </para> /// </li> <li> /// <para> /// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>, /// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>. /// </para> /// </li> <li> /// <para> /// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code> /// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code> /// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code> /// other than HEADER, QUERY_STRING, or URI. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code> /// but no value for <code>Data</code>. /// </para> /// </li> <li> /// <para> /// Your request references an ARN that is malformed, or corresponds to a resource with /// which a web ACL cannot be associated. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAFRegional.Model.WAFLimitsExceededException"> /// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code> /// objects that you can create for an AWS account. For more information, see <a href="http://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a> /// in the <i>AWS WAF Developer Guide</i>. /// </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 CreateWebACLResponse CreateWebACL(CreateWebACLRequest request) { var marshaller = new CreateWebACLRequestMarshaller(); var unmarshaller = CreateWebACLResponseUnmarshaller.Instance; return Invoke<CreateWebACLRequest,CreateWebACLResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateWebACL operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateWebACL 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<CreateWebACLResponse> CreateWebACLAsync(CreateWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateWebACLRequestMarshaller(); var unmarshaller = CreateWebACLResponseUnmarshaller.Instance; return InvokeAsync<CreateWebACLRequest,CreateWebACLResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the CreateWebACL operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateWebACL 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 EndCreateWebACL /// operation.</returns> public IAsyncResult BeginCreateWebACL(CreateWebACLRequest request, AsyncCallback callback, object state) { var marshaller = new CreateWebACLRequestMarshaller(); var unmarshaller = CreateWebACLResponseUnmarshaller.Instance; return BeginInvoke<CreateWebACLRequest>(request, marshaller, unmarshaller, callback, state); }