Chilkat Online Tools

CreateWebACL Swift3 Example

AWS WAFV2

func chilkatTest() {
    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let rest = CkoRest()!
    var success: Bool

    let authAws = CkoAuthAws()!
    authAws.accessKey = "AWS_ACCESS_KEY"
    authAws.secretKey = "AWS_SECRET_KEY"

    // Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
    authAws.region = "us-west-2"
    authAws.serviceName = "wafv2"
    // SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    rest.setAuthAws(authAws)

    // URL: https://wafv2.us-west-2.amazonaws.com/
    // Use the same region as specified above.
    success = rest.connect("wafv2.us-west-2.amazonaws.com", port: 443, tls: true, autoReconnect: true)
    if success != true {
        print("ConnectFailReason: \(rest.connectFailReason.intValue)")
        print("\(rest.lastErrorText!)")
        return
    }

    // The following code creates the JSON request body.
    // The JSON created by this code is shown below.

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    let json = CkoJsonObject()!
    json.updateInt("CaptchaConfig.ImmunityTimeProperty.ImmunityTime", value: 123)
    json.update("CustomResponseBodies.string.Content", value: "string")
    json.update("CustomResponseBodies.string.ContentType", value: "string")
    json.update("DefaultAction.Allow.CustomRequestHandling.InsertHeaders[0].Name", value: "string")
    json.update("DefaultAction.Allow.CustomRequestHandling.InsertHeaders[0].Value", value: "string")
    json.update("DefaultAction.Block.CustomResponse.CustomResponseBodyKey", value: "string")
    json.updateInt("DefaultAction.Block.CustomResponse.ResponseCode", value: 123)
    json.update("DefaultAction.Block.CustomResponse.ResponseHeaders[0].Name", value: "string")
    json.update("DefaultAction.Block.CustomResponse.ResponseHeaders[0].Value", value: "string")
    json.update("Description", value: "string")
    json.update("Name", value: "string")
    json.update("Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Name", value: "string")
    json.update("Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Value", value: "string")
    json.update("Rules[0].Action.Block.CustomResponse.CustomResponseBodyKey", value: "string")
    json.updateInt("Rules[0].Action.Block.CustomResponse.ResponseCode", value: 123)
    json.update("Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Name", value: "string")
    json.update("Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Value", value: "string")
    json.update("Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Name", value: "string")
    json.update("Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Value", value: "string")
    json.update("Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Name", value: "string")
    json.update("Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Value", value: "string")
    json.updateInt("Rules[0].CaptchaConfig.ImmunityTimeProperty.ImmunityTime", value: 123)
    json.update("Rules[0].Name", value: "string")
    json.update("Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Name", value: "string")
    json.update("Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Value", value: "string")
    json.updateNewObject("Rules[0].OverrideAction.None")
    json.updateInt("Rules[0].Priority", value: 123)
    json.update("Rules[0].RuleLabels[0].Name", value: "string")
    json.update("Rules[0].Statement.AndStatement.Statements[0]", value: "Statement")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.ByteMatchStatement.FieldToMatch.UriPath")
    json.update("Rules[0].Statement.ByteMatchStatement.PositionalConstraint", value: "string")
    json.updateInt("Rules[0].Statement.ByteMatchStatement.SearchString", value: 123)
    json.updateInt("Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Type", value: "string")
    json.update("Rules[0].Statement.GeoMatchStatement.CountryCodes[0]", value: "string")
    json.update("Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.FallbackBehavior", value: "string")
    json.update("Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.HeaderName", value: "string")
    json.update("Rules[0].Statement.IPSetReferenceStatement.ARN", value: "string")
    json.update("Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.FallbackBehavior", value: "string")
    json.update("Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.HeaderName", value: "string")
    json.update("Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.Position", value: "string")
    json.update("Rules[0].Statement.LabelMatchStatement.Key", value: "string")
    json.update("Rules[0].Statement.LabelMatchStatement.Scope", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ExcludedRules[0].Name", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].LoginPath", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PasswordField.Identifier", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PayloadType", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].UsernameField.Identifier", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.Name", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.ScopeDownStatement", value: "Statement")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.VendorName", value: "string")
    json.update("Rules[0].Statement.ManagedRuleGroupStatement.Version", value: "string")
    json.update("Rules[0].Statement.NotStatement.Statement", value: "Statement")
    json.update("Rules[0].Statement.OrStatement.Statements[0]", value: "Statement")
    json.update("Rules[0].Statement.RateBasedStatement.AggregateKeyType", value: "string")
    json.update("Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.FallbackBehavior", value: "string")
    json.update("Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.HeaderName", value: "string")
    json.updateInt("Rules[0].Statement.RateBasedStatement.Limit", value: 123)
    json.update("Rules[0].Statement.RateBasedStatement.ScopeDownStatement", value: "Statement")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexMatchStatement.FieldToMatch.UriPath")
    json.update("Rules[0].Statement.RegexMatchStatement.RegexString", value: "string")
    json.updateInt("Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Type", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.ARN", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.UriPath")
    json.updateInt("Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Type", value: "string")
    json.update("Rules[0].Statement.RuleGroupReferenceStatement.ARN", value: "string")
    json.update("Rules[0].Statement.RuleGroupReferenceStatement.ExcludedRules[0].Name", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.ComparisonOperator", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.SizeConstraintStatement.FieldToMatch.UriPath")
    json.updateInt("Rules[0].Statement.SizeConstraintStatement.Size", value: 123)
    json.updateInt("Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Type", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.SqliMatchStatement.FieldToMatch.UriPath")
    json.updateInt("Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Type", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.AllQueryArguments")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Body.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchScope", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.All")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchScope", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.OversizeHandling", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchScope", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.OversizeHandling", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.Method")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.QueryString")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleHeader.Name", value: "string")
    json.update("Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleQueryArgument.Name", value: "string")
    json.updateNewObject("Rules[0].Statement.XssMatchStatement.FieldToMatch.UriPath")
    json.updateInt("Rules[0].Statement.XssMatchStatement.TextTransformations[0].Priority", value: 123)
    json.update("Rules[0].Statement.XssMatchStatement.TextTransformations[0].Type", value: "string")
    json.updateInt("Rules[0].VisibilityConfig.CloudWatchMetricsEnabled", value: 123)
    json.update("Rules[0].VisibilityConfig.MetricName", value: "string")
    json.updateInt("Rules[0].VisibilityConfig.SampledRequestsEnabled", value: 123)
    json.update("Scope", value: "string")
    json.update("Tags[0].Key", value: "string")
    json.update("Tags[0].Value", value: "string")
    json.updateInt("VisibilityConfig.CloudWatchMetricsEnabled", value: 123)
    json.update("VisibilityConfig.MetricName", value: "string")
    json.updateInt("VisibilityConfig.SampledRequestsEnabled", value: 123)

    // The JSON request body created by the above code:

    // {
    //   "CaptchaConfig": {
    //     "ImmunityTimeProperty": {
    //       "ImmunityTime": number
    //     }
    //   },
    //   "CustomResponseBodies": {
    //     "string": {
    //       "Content": "string",
    //       "ContentType": "string"
    //     }
    //   },
    //   "DefaultAction": {
    //     "Allow": {
    //       "CustomRequestHandling": {
    //         "InsertHeaders": [
    //           {
    //             "Name": "string",
    //             "Value": "string"
    //           }
    //         ]
    //       }
    //     },
    //     "Block": {
    //       "CustomResponse": {
    //         "CustomResponseBodyKey": "string",
    //         "ResponseCode": number,
    //         "ResponseHeaders": [
    //           {
    //             "Name": "string",
    //             "Value": "string"
    //           }
    //         ]
    //       }
    //     }
    //   },
    //   "Description": "string",
    //   "Name": "string",
    //   "Rules": [
    //     {
    //       "Action": {
    //         "Allow": {
    //           "CustomRequestHandling": {
    //             "InsertHeaders": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ]
    //           }
    //         },
    //         "Block": {
    //           "CustomResponse": {
    //             "CustomResponseBodyKey": "string",
    //             "ResponseCode": number,
    //             "ResponseHeaders": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ]
    //           }
    //         },
    //         "Captcha": {
    //           "CustomRequestHandling": {
    //             "InsertHeaders": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ]
    //           }
    //         },
    //         "Count": {
    //           "CustomRequestHandling": {
    //             "InsertHeaders": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ]
    //           }
    //         }
    //       },
    //       "CaptchaConfig": {
    //         "ImmunityTimeProperty": {
    //           "ImmunityTime": number
    //         }
    //       },
    //       "Name": "string",
    //       "OverrideAction": {
    //         "Count": {
    //           "CustomRequestHandling": {
    //             "InsertHeaders": [
    //               {
    //                 "Name": "string",
    //                 "Value": "string"
    //               }
    //             ]
    //           }
    //         },
    //         "None": {}
    //       },
    //       "Priority": number,
    //       "RuleLabels": [
    //         {
    //           "Name": "string"
    //         }
    //       ],
    //       "Statement": {
    //         "AndStatement": {
    //           "Statements": [
    //             "Statement"
    //           ]
    //         },
    //         "ByteMatchStatement": {
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "PositionalConstraint": "string",
    //           "SearchString": blob,
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         },
    //         "GeoMatchStatement": {
    //           "CountryCodes": [
    //             "string"
    //           ],
    //           "ForwardedIPConfig": {
    //             "FallbackBehavior": "string",
    //             "HeaderName": "string"
    //           }
    //         },
    //         "IPSetReferenceStatement": {
    //           "ARN": "string",
    //           "IPSetForwardedIPConfig": {
    //             "FallbackBehavior": "string",
    //             "HeaderName": "string",
    //             "Position": "string"
    //           }
    //         },
    //         "LabelMatchStatement": {
    //           "Key": "string",
    //           "Scope": "string"
    //         },
    //         "ManagedRuleGroupStatement": {
    //           "ExcludedRules": [
    //             {
    //               "Name": "string"
    //             }
    //           ],
    //           "ManagedRuleGroupConfigs": [
    //             {
    //               "LoginPath": "string",
    //               "PasswordField": {
    //                 "Identifier": "string"
    //               },
    //               "PayloadType": "string",
    //               "UsernameField": {
    //                 "Identifier": "string"
    //               }
    //             }
    //           ],
    //           "Name": "string",
    //           "ScopeDownStatement": "Statement",
    //           "VendorName": "string",
    //           "Version": "string"
    //         },
    //         "NotStatement": {
    //           "Statement": "Statement"
    //         },
    //         "OrStatement": {
    //           "Statements": [
    //             "Statement"
    //           ]
    //         },
    //         "RateBasedStatement": {
    //           "AggregateKeyType": "string",
    //           "ForwardedIPConfig": {
    //             "FallbackBehavior": "string",
    //             "HeaderName": "string"
    //           },
    //           "Limit": number,
    //           "ScopeDownStatement": "Statement"
    //         },
    //         "RegexMatchStatement": {
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "RegexString": "string",
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         },
    //         "RegexPatternSetReferenceStatement": {
    //           "ARN": "string",
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         },
    //         "RuleGroupReferenceStatement": {
    //           "ARN": "string",
    //           "ExcludedRules": [
    //             {
    //               "Name": "string"
    //             }
    //           ]
    //         },
    //         "SizeConstraintStatement": {
    //           "ComparisonOperator": "string",
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "Size": number,
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         },
    //         "SqliMatchStatement": {
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         },
    //         "XssMatchStatement": {
    //           "FieldToMatch": {
    //             "AllQueryArguments": {},
    //             "Body": {
    //               "OversizeHandling": "string"
    //             },
    //             "Cookies": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedCookies": [
    //                   "string"
    //                 ],
    //                 "IncludedCookies": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Headers": {
    //               "MatchPattern": {
    //                 "All": {},
    //                 "ExcludedHeaders": [
    //                   "string"
    //                 ],
    //                 "IncludedHeaders": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "JsonBody": {
    //               "InvalidFallbackBehavior": "string",
    //               "MatchPattern": {
    //                 "All": {},
    //                 "IncludedPaths": [
    //                   "string"
    //                 ]
    //               },
    //               "MatchScope": "string",
    //               "OversizeHandling": "string"
    //             },
    //             "Method": {},
    //             "QueryString": {},
    //             "SingleHeader": {
    //               "Name": "string"
    //             },
    //             "SingleQueryArgument": {
    //               "Name": "string"
    //             },
    //             "UriPath": {}
    //           },
    //           "TextTransformations": [
    //             {
    //               "Priority": number,
    //               "Type": "string"
    //             }
    //           ]
    //         }
    //       },
    //       "VisibilityConfig": {
    //         "CloudWatchMetricsEnabled": boolean,
    //         "MetricName": "string",
    //         "SampledRequestsEnabled": boolean
    //       }
    //     }
    //   ],
    //   "Scope": "string",
    //   "Tags": [
    //     {
    //       "Key": "string",
    //       "Value": "string"
    //     }
    //   ],
    //   "VisibilityConfig": {
    //     "CloudWatchMetricsEnabled": boolean,
    //     "MetricName": "string",
    //     "SampledRequestsEnabled": boolean
    //   }
    // }

    rest.addHeader("Content-Type", value: "application/x-amz-json-1.1")
    rest.addHeader("X-Amz-Target", value: "AWSWAF_20190729.CreateWebACL")

    let sbRequestBody = CkoStringBuilder()!
    json.emitSb(sbRequestBody)
    let sbResponseBody = CkoStringBuilder()!
    success = rest.fullRequestSb("POST", uriPath: "/", requestBody: sbRequestBody, responseBody: sbResponseBody)
    if success != true {
        print("\(rest.lastErrorText!)")
        return
    }

    var respStatusCode: Int = rest.responseStatusCode.intValue
    print("response status code = \(respStatusCode)")
    if respStatusCode != 200 {
        print("Response Header:")
        print("\(rest.responseHeader!)")
        print("Response Body:")
        print("\(sbResponseBody.getAsString()!)")
        return
    }

    let jResp = CkoJsonObject()!
    jResp.loadSb(sbResponseBody)

    // The following code parses the JSON response.
    // A sample JSON response is shown below the sample code.

    // Use this online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    var ARN: String? = jResp.string(of: "Summary.ARN")
    var Description: String? = jResp.string(of: "Summary.Description")
    var Id: String? = jResp.string(of: "Summary.Id")
    var LockToken: String? = jResp.string(of: "Summary.LockToken")
    var Name: String? = jResp.string(of: "Summary.Name")

    // A sample JSON response body parsed by the above code:

    // {
    //   "Summary": {
    //     "ARN": "string",
    //     "Description": "string",
    //     "Id": "string",
    //     "LockToken": "string",
    //     "Name": "string"
    //   }
    // }

}