Chilkat Online Tools

CheckCapacity PowerBuilder Example

AWS WAFV2

integer li_rc
oleobject loo_Rest
integer li_Success
oleobject loo_AuthAws
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_JResp
integer li_Capacity

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

loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
    destroy loo_Rest
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_AuthAws = create oleobject
li_rc = loo_AuthAws.ConnectToNewObject("Chilkat_9_5_0.AuthAws")

loo_AuthAws.AccessKey = "AWS_ACCESS_KEY"
loo_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.)
loo_AuthAws.Region = "us-west-2"
loo_AuthAws.ServiceName = "wafv2"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loo_Rest.SetAuthAws(loo_AuthAws)

// URL: https://wafv2.us-west-2.amazonaws.com/
// Use the same region as specified above.
li_Success = loo_Rest.Connect("wafv2.us-west-2.amazonaws.com",443,1,1)
if li_Success <> 1 then
    Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    destroy loo_AuthAws
    return
end if

// 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

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

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

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

// {
//   "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"
// }

loo_Rest.AddHeader("Content-Type","application/x-amz-json-1.1")
loo_Rest.AddHeader("X-Amz-Target","AWSWAF_20190729.CheckCapacity")

loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

li_Success = loo_Rest.FullRequestSb("POST","/",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    destroy loo_AuthAws
    destroy loo_Json
    destroy loo_SbRequestBody
    destroy loo_SbResponseBody
    return
end if

li_RespStatusCode = loo_Rest.ResponseStatusCode
Write-Debug "response status code = " + string(li_RespStatusCode)
if li_RespStatusCode <> 200 then
    Write-Debug "Response Header:"
    Write-Debug loo_Rest.ResponseHeader
    Write-Debug "Response Body:"
    Write-Debug loo_SbResponseBody.GetAsString()
    destroy loo_Rest
    destroy loo_AuthAws
    destroy loo_Json
    destroy loo_SbRequestBody
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_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

li_Capacity = loo_JResp.IntOf("Capacity")

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

// {
//   "Capacity": number
// }


destroy loo_Rest
destroy loo_AuthAws
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp