public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WAF.Model.UpdateSizeConstraintSetRequest(); if (cmdletContext.ChangeToken != null) { request.ChangeToken = cmdletContext.ChangeToken; } if (cmdletContext.SizeConstraintSetId != null) { request.SizeConstraintSetId = cmdletContext.SizeConstraintSetId; } if (cmdletContext.Update != null) { request.Updates = cmdletContext.Update; } 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 UpdateSizeConstraintSet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateSizeConstraintSet operation on AmazonWAFClient.</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 EndUpdateSizeConstraintSet /// operation.</returns> public IAsyncResult BeginUpdateSizeConstraintSet(UpdateSizeConstraintSetRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateSizeConstraintSetRequestMarshaller(); var unmarshaller = UpdateSizeConstraintSetResponseUnmarshaller.Instance; return BeginInvoke<UpdateSizeConstraintSetRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Inserts or deletes <a>SizeConstraint</a> objects (filters) in a <a>SizeConstraintSet</a>. /// For each <code>SizeConstraint</code> object, you specify the following values: /// /// <ul> <li> /// <para> /// Whether to insert or delete the object from the array. If you want to change a <code>SizeConstraintSetUpdate</code> /// object, you delete the existing object and add a new one. /// </para> /// </li> <li> /// <para> /// The part of a web request that you want AWS WAF to evaluate, such as the length of /// a query string or the length of the <code>User-Agent</code> header. /// </para> /// </li> <li> /// <para> /// Whether to perform any transformations on the request, such as converting it to lowercase, /// before checking its length. Note that transformations of the request body are not /// supported because the AWS resource forwards only the first <code>8192</code> bytes /// of your request to AWS WAF. /// </para> /// </li> <li> /// <para> /// A <code>ComparisonOperator</code> used for evaluating the selected part of the request /// against the specified <code>Size</code>, such as equals, greater than, less than, /// and so on. /// </para> /// </li> <li> /// <para> /// The length, in bytes, that you want AWS WAF to watch for in selected part of the request. /// The length is computed after applying the transformation. /// </para> /// </li> </ul> /// <para> /// For example, you can add a <code>SizeConstraintSetUpdate</code> object that matches /// web requests in which the length of the <code>User-Agent</code> header is greater /// than 100 bytes. You can then configure AWS WAF to block those requests. /// </para> /// /// <para> /// To create and configure a <code>SizeConstraintSet</code>, perform the following steps: /// </para> /// <ol> <li> /// <para> /// Create a <code>SizeConstraintSet.</code> For more information, see <a>CreateSizeConstraintSet</a>. /// </para> /// </li> <li> /// <para> /// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code> /// parameter of an <code>UpdateSizeConstraintSet</code> request. /// </para> /// </li> <li> /// <para> /// Submit an <code>UpdateSizeConstraintSet</code> request to specify the part of the /// request that you want AWS WAF to inspect (for example, the header or the URI) and /// the value that you want AWS WAF to watch for. /// </para> /// </li> </ol> /// <para> /// For more information about how to use the AWS WAF API to allow or block HTTP requests, /// 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 UpdateSizeConstraintSet service method.</param> /// /// <returns>The response from the UpdateSizeConstraintSet service method, as returned by WAF.</returns> /// <exception cref="Amazon.WAF.Model.WAFInternalErrorException"> /// The operation failed because of a system problem, even though the request was valid. /// Retry your request. /// </exception> /// <exception cref="Amazon.WAF.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.WAF.Model.WAFInvalidOperationException"> /// The operation failed because there was nothing to do. For example: /// /// <ul> <li> /// <para> /// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code> /// isn't in the specified <code>WebACL</code>. /// </para> /// </li> <li> /// <para> /// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't /// in the specified <code>IPSet</code>. /// </para> /// </li> <li> /// <para> /// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>, /// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>. /// </para> /// </li> <li> /// <para> /// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code> /// already exists in the specified <code>WebACL</code>. /// </para> /// </li> <li> /// <para> /// You tried to add an IP address to an <code>IPSet</code>, but the IP address already /// exists in the specified <code>IPSet</code>. /// </para> /// </li> <li> /// <para> /// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but /// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAF.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> </ul> /// </exception> /// <exception cref="Amazon.WAF.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.WAF.Model.WAFNonexistentContainerException"> /// The operation failed because you tried to add an object to or delete an object from /// another object that doesn't exist. For example: /// /// <ul> <li> /// <para> /// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code> /// that doesn't exist. /// </para> /// </li> <li> /// <para> /// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code> /// from a <code>Rule</code> that doesn't exist. /// </para> /// </li> <li> /// <para> /// You tried to add an IP address to or delete an IP address from an <code>IPSet</code> /// that doesn't exist. /// </para> /// </li> <li> /// <para> /// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code> /// from a <code>ByteMatchSet</code> that doesn't exist. /// </para> /// </li> </ul> /// </exception> /// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException"> /// The operation failed because the referenced object doesn't exist. /// </exception> /// <exception cref="Amazon.WAF.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.WAF.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 UpdateSizeConstraintSetResponse UpdateSizeConstraintSet(UpdateSizeConstraintSetRequest request) { var marshaller = new UpdateSizeConstraintSetRequestMarshaller(); var unmarshaller = UpdateSizeConstraintSetResponseUnmarshaller.Instance; return Invoke<UpdateSizeConstraintSetRequest,UpdateSizeConstraintSetResponse>(request, marshaller, unmarshaller); }
private Amazon.WAF.Model.UpdateSizeConstraintSetResponse CallAWSServiceOperation(IAmazonWAF client, Amazon.WAF.Model.UpdateSizeConstraintSetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS WAF", "UpdateSizeConstraintSet"); try { #if DESKTOP return(client.UpdateSizeConstraintSet(request)); #elif CORECLR return(client.UpdateSizeConstraintSetAsync(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 UpdateSizeConstraintSet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateSizeConstraintSet 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<UpdateSizeConstraintSetResponse> UpdateSizeConstraintSetAsync(UpdateSizeConstraintSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateSizeConstraintSetRequestMarshaller(); var unmarshaller = UpdateSizeConstraintSetResponseUnmarshaller.Instance; return InvokeAsync<UpdateSizeConstraintSetRequest,UpdateSizeConstraintSetResponse>(request, marshaller, unmarshaller, cancellationToken); }