UpdateWebACL PureBasic Example
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkRest.pb"
IncludeFile "CkAuthAws.pb"
Procedure ChilkatExample()
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
authAws.i = CkAuthAws::ckCreate()
If authAws.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkAuthAws::setCkAccessKey(authAws, "AWS_ACCESS_KEY")
CkAuthAws::setCkSecretKey(authAws, "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.)
CkAuthAws::setCkRegion(authAws, "us-west-2")
CkAuthAws::setCkServiceName(authAws, "wafv2")
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRest::ckSetAuthAws(rest,authAws)
; URL: https://wafv2.us-west-2.amazonaws.com/
; Use the same region as specified above.
success = CkRest::ckConnect(rest,"wafv2.us-west-2.amazonaws.com",443,1,1)
If success <> 1
Debug "ConnectFailReason: " + Str(CkRest::ckConnectFailReason(rest))
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkAuthAws::ckDispose(authAws)
ProcedureReturn
EndIf
; 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
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateInt(json,"CaptchaConfig.ImmunityTimeProperty.ImmunityTime",123)
CkJsonObject::ckUpdateString(json,"CustomResponseBodies.string.Content","string")
CkJsonObject::ckUpdateString(json,"CustomResponseBodies.string.ContentType","string")
CkJsonObject::ckUpdateString(json,"DefaultAction.Allow.CustomRequestHandling.InsertHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"DefaultAction.Allow.CustomRequestHandling.InsertHeaders[0].Value","string")
CkJsonObject::ckUpdateString(json,"DefaultAction.Block.CustomResponse.CustomResponseBodyKey","string")
CkJsonObject::ckUpdateInt(json,"DefaultAction.Block.CustomResponse.ResponseCode",123)
CkJsonObject::ckUpdateString(json,"DefaultAction.Block.CustomResponse.ResponseHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"DefaultAction.Block.CustomResponse.ResponseHeaders[0].Value","string")
CkJsonObject::ckUpdateString(json,"Description","string")
CkJsonObject::ckUpdateString(json,"Id","string")
CkJsonObject::ckUpdateString(json,"LockToken","string")
CkJsonObject::ckUpdateString(json,"Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Value","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Block.CustomResponse.CustomResponseBodyKey","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].Action.Block.CustomResponse.ResponseCode",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Value","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Value","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Value","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].CaptchaConfig.ImmunityTimeProperty.ImmunityTime",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Value","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].OverrideAction.None")
CkJsonObject::ckUpdateInt(json,"Rules[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].RuleLabels[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.AndStatement.Statements[0]","Statement")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.ByteMatchStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.PositionalConstraint","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.ByteMatchStatement.SearchString",123)
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.GeoMatchStatement.CountryCodes[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.FallbackBehavior","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.HeaderName","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.IPSetReferenceStatement.ARN","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.FallbackBehavior","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.HeaderName","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.Position","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.LabelMatchStatement.Key","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.LabelMatchStatement.Scope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ExcludedRules[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].LoginPath","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PasswordField.Identifier","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PayloadType","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].UsernameField.Identifier","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.ScopeDownStatement","Statement")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.VendorName","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.ManagedRuleGroupStatement.Version","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.NotStatement.Statement","Statement")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.OrStatement.Statements[0]","Statement")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RateBasedStatement.AggregateKeyType","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.FallbackBehavior","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.HeaderName","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.RateBasedStatement.Limit",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RateBasedStatement.ScopeDownStatement","Statement")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexMatchStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.RegexString","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.ARN","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RuleGroupReferenceStatement.ARN","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.RuleGroupReferenceStatement.ExcludedRules[0].Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.ComparisonOperator","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.SizeConstraintStatement.Size",123)
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.SqliMatchStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.AllQueryArguments")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Body.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.OversizeHandling","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.All")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchScope","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.OversizeHandling","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.Method")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.QueryString")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleHeader.Name","string")
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleQueryArgument.Name","string")
CkJsonObject::ckUpdateNewObject(json,"Rules[0].Statement.XssMatchStatement.FieldToMatch.UriPath")
CkJsonObject::ckUpdateInt(json,"Rules[0].Statement.XssMatchStatement.TextTransformations[0].Priority",123)
CkJsonObject::ckUpdateString(json,"Rules[0].Statement.XssMatchStatement.TextTransformations[0].Type","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].VisibilityConfig.CloudWatchMetricsEnabled",123)
CkJsonObject::ckUpdateString(json,"Rules[0].VisibilityConfig.MetricName","string")
CkJsonObject::ckUpdateInt(json,"Rules[0].VisibilityConfig.SampledRequestsEnabled",123)
CkJsonObject::ckUpdateString(json,"Scope","string")
CkJsonObject::ckUpdateInt(json,"VisibilityConfig.CloudWatchMetricsEnabled",123)
CkJsonObject::ckUpdateString(json,"VisibilityConfig.MetricName","string")
CkJsonObject::ckUpdateInt(json,"VisibilityConfig.SampledRequestsEnabled",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",
; "Id": "string",
; "LockToken": "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",
; "VisibilityConfig": {
; "CloudWatchMetricsEnabled": boolean,
; "MetricName": "string",
; "SampledRequestsEnabled": boolean
; }
; }
CkRest::ckAddHeader(rest,"Content-Type","application/x-amz-json-1.1")
CkRest::ckAddHeader(rest,"X-Amz-Target","AWSWAF_20190729.UpdateWebACL")
sbRequestBody.i = CkStringBuilder::ckCreate()
If sbRequestBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckEmitSb(json,sbRequestBody)
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkRest::ckFullRequestSb(rest,"POST","/",sbRequestBody,sbResponseBody)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkAuthAws::ckDispose(authAws)
CkJsonObject::ckDispose(json)
CkStringBuilder::ckDispose(sbRequestBody)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
respStatusCode.i = CkRest::ckResponseStatusCode(rest)
Debug "response status code = " + Str(respStatusCode)
If respStatusCode <> 200
Debug "Response Header:"
Debug CkRest::ckResponseHeader(rest)
Debug "Response Body:"
Debug CkStringBuilder::ckGetAsString(sbResponseBody)
CkRest::ckDispose(rest)
CkAuthAws::ckDispose(authAws)
CkJsonObject::ckDispose(json)
CkStringBuilder::ckDispose(sbRequestBody)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,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
NextLockToken.s = CkJsonObject::ckStringOf(jResp,"NextLockToken")
; A sample JSON response body parsed by the above code:
; {
; "NextLockToken": "string"
; }
CkRest::ckDispose(rest)
CkAuthAws::ckDispose(authAws)
CkJsonObject::ckDispose(json)
CkStringBuilder::ckDispose(sbRequestBody)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure