From 8dad19de4710ec987623641714e794ce97130309 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Thu, 11 Apr 2024 23:47:25 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .stats.yml | 2 +- api.md | 50 +- keyless_certificates/keylesscertificate.go | 82 - rulesets/phase.go | 6689 +-------- rulesets/phaseversion.go | 2452 +--- rulesets/rule.go | 9754 ++++--------- rulesets/ruleset.go | 11271 +--------------- rulesets/version.go | 2439 +--- rulesets/versionbytag.go | 2452 +--- warp_connector/warpconnector.go | 260 +- .../dispatchnamespacescript.go | 4 + .../dispatchnamespacescriptsecret.go | 228 + .../dispatchnamespacescriptsecret_test.go | 80 + .../dispatchnamespacescripttag.go | 192 + .../dispatchnamespacescripttag_test.go | 110 + zero_trust/tunnel.go | 307 +- zero_trust/tunnelconnection.go | 47 +- 17 files changed, 5142 insertions(+), 31277 deletions(-) create mode 100644 workers_for_platforms/dispatchnamespacescriptsecret.go create mode 100644 workers_for_platforms/dispatchnamespacescriptsecret_test.go create mode 100644 workers_for_platforms/dispatchnamespacescripttag.go create mode 100644 workers_for_platforms/dispatchnamespacescripttag_test.go diff --git a/.stats.yml b/.stats.yml index 0818ecbb822..d0e375fdcb3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1251 +configured_endpoints: 1256 diff --git a/api.md b/api.md index 05ab375c6f4..f40143a6332 100644 --- a/api.md +++ b/api.md @@ -1876,12 +1876,10 @@ Methods: Params Types: -- keyless_certificates.HostnameParam - keyless_certificates.TunnelParam Response Types: -- keyless_certificates.Hostname - keyless_certificates.KeylessCertificate - keyless_certificates.Tunnel - keyless_certificates.KeylessCertificateDeleteResponse @@ -2842,17 +2840,41 @@ Methods: Params Types: - rulesets.BlockRuleParam +- rulesets.ChallengeRuleParam +- rulesets.CompressResponseRuleParam - rulesets.ExecuteRuleParam +- rulesets.JsChallengeRuleParam - rulesets.LogRuleParam - rulesets.LoggingParam +- rulesets.ManagedChallengeRuleParam +- rulesets.RedirectRuleParam +- rulesets.RewriteRuleParam +- rulesets.RewriteURIPartUnionParam +- rulesets.RouteRuleParam +- rulesets.ScoreRuleParam +- rulesets.ServeErrorRuleParam +- rulesets.SetCacheSettingsRuleParam +- rulesets.SetConfigRuleParam - rulesets.SkipRuleParam Response Types: - rulesets.BlockRule +- rulesets.ChallengeRule +- rulesets.CompressResponseRule - rulesets.ExecuteRule +- rulesets.JsChallengeRule - rulesets.LogRule - rulesets.Logging +- rulesets.ManagedChallengeRule +- rulesets.RedirectRule +- rulesets.RewriteRule +- rulesets.RewriteURIPart +- rulesets.RouteRule +- rulesets.ScoreRule +- rulesets.ServeErrorRule +- rulesets.SetCacheSettingsRule +- rulesets.SetConfigRule - rulesets.SkipRule - rulesets.RuleNewResponse - rulesets.RuleDeleteResponse @@ -4348,6 +4370,30 @@ Methods: - client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Bindings.Get(ctx context.Context, dispatchNamespace string, scriptName string, query workers_for_platforms.DispatchNamespaceScriptBindingGetParams) ([]workers.Binding, error) +##### Secrets + +Response Types: + +- workers_for_platforms.DispatchNamespaceScriptSecretUpdateResponse +- workers_for_platforms.DispatchNamespaceScriptSecretListResponse + +Methods: + +- client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Update(ctx context.Context, dispatchNamespace string, scriptName string, params workers_for_platforms.DispatchNamespaceScriptSecretUpdateParams) (workers_for_platforms.DispatchNamespaceScriptSecretUpdateResponse, error) +- client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.List(ctx context.Context, dispatchNamespace string, scriptName string, query workers_for_platforms.DispatchNamespaceScriptSecretListParams) (pagination.SinglePage[workers_for_platforms.DispatchNamespaceScriptSecretListResponse], error) + +##### Tags + +Response Types: + +- workers_for_platforms.DispatchNamespaceScriptTagDeleteResponse + +Methods: + +- client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Update(ctx context.Context, dispatchNamespace string, scriptName string, params workers_for_platforms.DispatchNamespaceScriptTagUpdateParams) ([]string, error) +- client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.List(ctx context.Context, dispatchNamespace string, scriptName string, query workers_for_platforms.DispatchNamespaceScriptTagListParams) (pagination.SinglePage[string], error) +- client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Delete(ctx context.Context, dispatchNamespace string, scriptName string, tag string, body workers_for_platforms.DispatchNamespaceScriptTagDeleteParams) (workers_for_platforms.DispatchNamespaceScriptTagDeleteResponse, error) + # ZeroTrust ## Devices diff --git a/keyless_certificates/keylesscertificate.go b/keyless_certificates/keylesscertificate.go index 7459814807c..1cdf1bd4dd1 100644 --- a/keyless_certificates/keylesscertificate.go +++ b/keyless_certificates/keylesscertificate.go @@ -111,88 +111,6 @@ func (r *KeylessCertificateService) Get(ctx context.Context, keylessCertificateI return } -type Hostname struct { - // Keyless certificate identifier tag. - ID string `json:"id,required"` - // When the Keyless SSL was created. - CreatedOn time.Time `json:"created_on,required" format:"date-time"` - // Whether or not the Keyless SSL is on or off. - Enabled bool `json:"enabled,required"` - // The keyless SSL name. - Host string `json:"host,required" format:"hostname"` - // When the Keyless SSL was last modified. - ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` - // The keyless SSL name. - Name string `json:"name,required"` - // Available permissions for the Keyless SSL for the current user requesting the - // item. - Permissions []interface{} `json:"permissions,required"` - // The keyless SSL port used to communicate between Cloudflare and the client's - // Keyless SSL server. - Port float64 `json:"port,required"` - // Status of the Keyless SSL. - Status HostnameStatus `json:"status,required"` - // Configuration for using Keyless SSL through a Cloudflare Tunnel - Tunnel Tunnel `json:"tunnel"` - JSON hostnameJSON `json:"-"` -} - -// hostnameJSON contains the JSON metadata for the struct [Hostname] -type hostnameJSON struct { - ID apijson.Field - CreatedOn apijson.Field - Enabled apijson.Field - Host apijson.Field - ModifiedOn apijson.Field - Name apijson.Field - Permissions apijson.Field - Port apijson.Field - Status apijson.Field - Tunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Hostname) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hostnameJSON) RawJSON() string { - return r.raw -} - -func (r Hostname) ImplementsRulesListItemGetResponseUnion() {} - -// Status of the Keyless SSL. -type HostnameStatus string - -const ( - HostnameStatusActive HostnameStatus = "active" - HostnameStatusDeleted HostnameStatus = "deleted" -) - -func (r HostnameStatus) IsKnown() bool { - switch r { - case HostnameStatusActive, HostnameStatusDeleted: - return true - } - return false -} - -type HostnameParam struct { - // The keyless SSL name. - Host param.Field[string] `json:"host,required" format:"hostname"` - // The keyless SSL port used to communicate between Cloudflare and the client's - // Keyless SSL server. - Port param.Field[float64] `json:"port,required"` - // Configuration for using Keyless SSL through a Cloudflare Tunnel - Tunnel param.Field[TunnelParam] `json:"tunnel"` -} - -func (r HostnameParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type KeylessCertificate struct { // Keyless certificate identifier tag. ID string `json:"id,required"` diff --git a/rulesets/phase.go b/rulesets/phase.go index 25303aa2e3d..de22ef33e95 100644 --- a/rulesets/phase.go +++ b/rulesets/phase.go @@ -238,19 +238,12 @@ func (r PhaseUpdateResponseRule) AsUnion() PhaseUpdateResponseRulesUnion { return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsChallengeRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsJsChallengeRule], [rulesets.LogRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsManagedChallengeRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsRedirectRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsRouteRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsScoreRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsServeErrorRule], -// [rulesets.PhaseUpdateResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule]. +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. type PhaseUpdateResponseRulesUnion interface { implementsRulesetsPhaseUpdateResponseRule() } @@ -266,12 +259,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsChallengeRule{}), + Type: reflect.TypeOf(ChallengeRule{}), DiscriminatorValue: "challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsCompressResponseRule{}), + Type: reflect.TypeOf(CompressResponseRule{}), DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ @@ -281,7 +274,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsJsChallengeRule{}), + Type: reflect.TypeOf(JsChallengeRule{}), DiscriminatorValue: "js_challenge", }, apijson.UnionVariant{ @@ -291,37 +284,37 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsManagedChallengeRule{}), + Type: reflect.TypeOf(ManagedChallengeRule{}), DiscriminatorValue: "managed_challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRedirectRule{}), + Type: reflect.TypeOf(RedirectRule{}), DiscriminatorValue: "redirect", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRule{}), + Type: reflect.TypeOf(RewriteRule{}), DiscriminatorValue: "rewrite", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRouteRule{}), + Type: reflect.TypeOf(RouteRule{}), DiscriminatorValue: "route", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsScoreRule{}), + Type: reflect.TypeOf(ScoreRule{}), DiscriminatorValue: "score", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsServeErrorRule{}), + Type: reflect.TypeOf(ServeErrorRule{}), DiscriminatorValue: "serve_error", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsSetConfigRule{}), + Type: reflect.TypeOf(SetConfigRule{}), DiscriminatorValue: "set_config", }, apijson.UnionVariant{ @@ -331,6545 +324,413 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule{}), + Type: reflect.TypeOf(SetCacheSettingsRule{}), DiscriminatorValue: "set_cache_settings", }, ) } -type PhaseUpdateResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [PhaseUpdateResponseRulesRulesetsChallengeRule] -type phaseUpdateResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsChallengeRule) implementsRulesetsPhaseUpdateResponseRule() {} - // The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsChallengeRuleAction string +type PhaseUpdateResponseRulesAction string const ( - PhaseUpdateResponseRulesRulesetsChallengeRuleActionChallenge PhaseUpdateResponseRulesRulesetsChallengeRuleAction = "challenge" + PhaseUpdateResponseRulesActionBlock PhaseUpdateResponseRulesAction = "block" + PhaseUpdateResponseRulesActionChallenge PhaseUpdateResponseRulesAction = "challenge" + PhaseUpdateResponseRulesActionCompressResponse PhaseUpdateResponseRulesAction = "compress_response" + PhaseUpdateResponseRulesActionExecute PhaseUpdateResponseRulesAction = "execute" + PhaseUpdateResponseRulesActionJsChallenge PhaseUpdateResponseRulesAction = "js_challenge" + PhaseUpdateResponseRulesActionLog PhaseUpdateResponseRulesAction = "log" + PhaseUpdateResponseRulesActionManagedChallenge PhaseUpdateResponseRulesAction = "managed_challenge" + PhaseUpdateResponseRulesActionRedirect PhaseUpdateResponseRulesAction = "redirect" + PhaseUpdateResponseRulesActionRewrite PhaseUpdateResponseRulesAction = "rewrite" + PhaseUpdateResponseRulesActionRoute PhaseUpdateResponseRulesAction = "route" + PhaseUpdateResponseRulesActionScore PhaseUpdateResponseRulesAction = "score" + PhaseUpdateResponseRulesActionServeError PhaseUpdateResponseRulesAction = "serve_error" + PhaseUpdateResponseRulesActionSetConfig PhaseUpdateResponseRulesAction = "set_config" + PhaseUpdateResponseRulesActionSkip PhaseUpdateResponseRulesAction = "skip" + PhaseUpdateResponseRulesActionSetCacheSettings PhaseUpdateResponseRulesAction = "set_cache_settings" ) -func (r PhaseUpdateResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { +func (r PhaseUpdateResponseRulesAction) IsKnown() bool { switch r { - case PhaseUpdateResponseRulesRulesetsChallengeRuleActionChallenge: + case PhaseUpdateResponseRulesActionBlock, PhaseUpdateResponseRulesActionChallenge, PhaseUpdateResponseRulesActionCompressResponse, PhaseUpdateResponseRulesActionExecute, PhaseUpdateResponseRulesActionJsChallenge, PhaseUpdateResponseRulesActionLog, PhaseUpdateResponseRulesActionManagedChallenge, PhaseUpdateResponseRulesActionRedirect, PhaseUpdateResponseRulesActionRewrite, PhaseUpdateResponseRulesActionRoute, PhaseUpdateResponseRulesActionScore, PhaseUpdateResponseRulesActionServeError, PhaseUpdateResponseRulesActionSetConfig, PhaseUpdateResponseRulesActionSkip, PhaseUpdateResponseRulesActionSetCacheSettings: return true } return false } -type PhaseUpdateResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. +// A ruleset object. +type PhaseGetResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind PhaseGetResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase PhaseGetResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []PhaseGetResponseRule `json:"rules,required"` + // The version of the ruleset. Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON phaseGetResponseJSON `json:"-"` } -// phaseUpdateResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [PhaseUpdateResponseRulesRulesetsCompressResponseRule] -type phaseUpdateResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// phaseGetResponseJSON contains the JSON metadata for the struct +// [PhaseGetResponse] +type phaseGetResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *PhaseUpdateResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { +func (r *PhaseGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r phaseUpdateResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { +func (r phaseGetResponseJSON) RawJSON() string { return r.raw } -func (r PhaseUpdateResponseRulesRulesetsCompressResponseRule) implementsRulesetsPhaseUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsCompressResponseRuleAction string +// The kind of the ruleset. +type PhaseGetResponseKind string const ( - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionCompressResponse PhaseUpdateResponseRulesRulesetsCompressResponseRuleAction = "compress_response" + PhaseGetResponseKindManaged PhaseGetResponseKind = "managed" + PhaseGetResponseKindCustom PhaseGetResponseKind = "custom" + PhaseGetResponseKindRoot PhaseGetResponseKind = "root" + PhaseGetResponseKindZone PhaseGetResponseKind = "zone" ) -func (r PhaseUpdateResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { +func (r PhaseGetResponseKind) IsKnown() bool { switch r { - case PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionCompressResponse: + case PhaseGetResponseKindManaged, PhaseGetResponseKindCustom, PhaseGetResponseKindRoot, PhaseGetResponseKindZone: return true } return false } -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParameters] -type phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string +// The phase of the ruleset. +type PhaseGetResponsePhase string const ( - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" + PhaseGetResponsePhaseDDoSL4 PhaseGetResponsePhase = "ddos_l4" + PhaseGetResponsePhaseDDoSL7 PhaseGetResponsePhase = "ddos_l7" + PhaseGetResponsePhaseHTTPConfigSettings PhaseGetResponsePhase = "http_config_settings" + PhaseGetResponsePhaseHTTPCustomErrors PhaseGetResponsePhase = "http_custom_errors" + PhaseGetResponsePhaseHTTPLogCustomFields PhaseGetResponsePhase = "http_log_custom_fields" + PhaseGetResponsePhaseHTTPRatelimit PhaseGetResponsePhase = "http_ratelimit" + PhaseGetResponsePhaseHTTPRequestCacheSettings PhaseGetResponsePhase = "http_request_cache_settings" + PhaseGetResponsePhaseHTTPRequestDynamicRedirect PhaseGetResponsePhase = "http_request_dynamic_redirect" + PhaseGetResponsePhaseHTTPRequestFirewallCustom PhaseGetResponsePhase = "http_request_firewall_custom" + PhaseGetResponsePhaseHTTPRequestFirewallManaged PhaseGetResponsePhase = "http_request_firewall_managed" + PhaseGetResponsePhaseHTTPRequestLateTransform PhaseGetResponsePhase = "http_request_late_transform" + PhaseGetResponsePhaseHTTPRequestOrigin PhaseGetResponsePhase = "http_request_origin" + PhaseGetResponsePhaseHTTPRequestRedirect PhaseGetResponsePhase = "http_request_redirect" + PhaseGetResponsePhaseHTTPRequestSanitize PhaseGetResponsePhase = "http_request_sanitize" + PhaseGetResponsePhaseHTTPRequestSbfm PhaseGetResponsePhase = "http_request_sbfm" + PhaseGetResponsePhaseHTTPRequestSelectConfiguration PhaseGetResponsePhase = "http_request_select_configuration" + PhaseGetResponsePhaseHTTPRequestTransform PhaseGetResponsePhase = "http_request_transform" + PhaseGetResponsePhaseHTTPResponseCompression PhaseGetResponsePhase = "http_response_compression" + PhaseGetResponsePhaseHTTPResponseFirewallManaged PhaseGetResponsePhase = "http_response_firewall_managed" + PhaseGetResponsePhaseHTTPResponseHeadersTransform PhaseGetResponsePhase = "http_response_headers_transform" + PhaseGetResponsePhaseMagicTransit PhaseGetResponsePhase = "magic_transit" + PhaseGetResponsePhaseMagicTransitIDsManaged PhaseGetResponsePhase = "magic_transit_ids_managed" + PhaseGetResponsePhaseMagicTransitManaged PhaseGetResponsePhase = "magic_transit_managed" ) -func (r PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { +func (r PhaseGetResponsePhase) IsKnown() bool { switch r { - case PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, PhaseUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: + case PhaseGetResponsePhaseDDoSL4, PhaseGetResponsePhaseDDoSL7, PhaseGetResponsePhaseHTTPConfigSettings, PhaseGetResponsePhaseHTTPCustomErrors, PhaseGetResponsePhaseHTTPLogCustomFields, PhaseGetResponsePhaseHTTPRatelimit, PhaseGetResponsePhaseHTTPRequestCacheSettings, PhaseGetResponsePhaseHTTPRequestDynamicRedirect, PhaseGetResponsePhaseHTTPRequestFirewallCustom, PhaseGetResponsePhaseHTTPRequestFirewallManaged, PhaseGetResponsePhaseHTTPRequestLateTransform, PhaseGetResponsePhaseHTTPRequestOrigin, PhaseGetResponsePhaseHTTPRequestRedirect, PhaseGetResponsePhaseHTTPRequestSanitize, PhaseGetResponsePhaseHTTPRequestSbfm, PhaseGetResponsePhaseHTTPRequestSelectConfiguration, PhaseGetResponsePhaseHTTPRequestTransform, PhaseGetResponsePhaseHTTPResponseCompression, PhaseGetResponsePhaseHTTPResponseFirewallManaged, PhaseGetResponsePhaseHTTPResponseHeadersTransform, PhaseGetResponsePhaseMagicTransit, PhaseGetResponsePhaseMagicTransitIDsManaged, PhaseGetResponsePhaseMagicTransitManaged: return true } return false } -type PhaseUpdateResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` +type PhaseGetResponseRule struct { // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + Action PhaseGetResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` // An informative description of the rule. Description string `json:"description"` // Whether the rule should be executed. Enabled bool `json:"enabled"` // The expression defining which traffic will match the rule. Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON phaseGetResponseRuleJSON `json:"-"` + union PhaseGetResponseRulesUnion } -// phaseUpdateResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [PhaseUpdateResponseRulesRulesetsJsChallengeRule] -type phaseUpdateResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field +// phaseGetResponseRuleJSON contains the JSON metadata for the struct +// [PhaseGetResponseRule] +type phaseGetResponseRuleJSON struct { Action apijson.Field ActionParameters apijson.Field Categories apijson.Field Description apijson.Field Enabled apijson.Field Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field Logging apijson.Field Ref apijson.Field + Version apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *PhaseUpdateResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { +func (r phaseGetResponseRuleJSON) RawJSON() string { return r.raw } -func (r PhaseUpdateResponseRulesRulesetsJsChallengeRule) implementsRulesetsPhaseUpdateResponseRule() { +func (r *PhaseGetResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsJsChallengeRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsJsChallengeRuleActionJsChallenge PhaseUpdateResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r PhaseUpdateResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false +func (r PhaseGetResponseRule) AsUnion() PhaseGetResponseRulesUnion { + return r.union } -type PhaseUpdateResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [PhaseUpdateResponseRulesRulesetsManagedChallengeRule] -type phaseUpdateResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsManagedChallengeRule) implementsRulesetsPhaseUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge PhaseUpdateResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r PhaseUpdateResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type PhaseUpdateResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for -// the struct [PhaseUpdateResponseRulesRulesetsRedirectRule] -type phaseUpdateResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRedirectRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsRedirectRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsRedirectRuleActionRedirect PhaseUpdateResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r PhaseUpdateResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParameters] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsPhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type PhaseGetResponseRulesUnion interface { + implementsRulesetsPhaseGetResponseRule() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", + reflect.TypeOf((*PhaseGetResponseRulesUnion)(nil)).Elem(), + "action", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", }, - ) -} - -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsPhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsPhaseUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [PhaseUpdateResponseRulesRulesetsRewriteRule] -type phaseUpdateResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsRewriteRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsRewriteRuleActionRewrite PhaseUpdateResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParameters] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", }, - ) -} - -// Remove the header from the request. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURI] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains -// the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", }, - ) -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", }, - ) -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsPhaseUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseUpdateResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [PhaseUpdateResponseRulesRulesetsRouteRule] -type phaseUpdateResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsRouteRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsRouteRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsRouteRuleActionRoute PhaseUpdateResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r PhaseUpdateResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON phaseUpdateResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRouteRuleActionParameters] -type phaseUpdateResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON phaseUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin] -type phaseUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON phaseUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersSni] -type phaseUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type PhaseUpdateResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [PhaseUpdateResponseRulesRulesetsScoreRule] -type phaseUpdateResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsScoreRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsScoreRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsScoreRuleActionScore PhaseUpdateResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r PhaseUpdateResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON phaseUpdateResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct -// [PhaseUpdateResponseRulesRulesetsScoreRuleActionParameters] -type phaseUpdateResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type PhaseUpdateResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata -// for the struct [PhaseUpdateResponseRulesRulesetsServeErrorRule] -type phaseUpdateResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsServeErrorRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsServeErrorRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsServeErrorRuleActionServeError PhaseUpdateResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r PhaseUpdateResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON phaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParameters] -type phaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, PhaseUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type PhaseUpdateResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [PhaseUpdateResponseRulesRulesetsSetConfigRule] -type phaseUpdateResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsSetConfigRule) implementsRulesetsPhaseUpdateResponseRule() {} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionSetConfig PhaseUpdateResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r PhaseUpdateResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParameters] -type phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishOff PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOff PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFull PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, PhaseUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseUpdateResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsPhaseUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type PhaseUpdateResponseRulesAction string - -const ( - PhaseUpdateResponseRulesActionBlock PhaseUpdateResponseRulesAction = "block" - PhaseUpdateResponseRulesActionChallenge PhaseUpdateResponseRulesAction = "challenge" - PhaseUpdateResponseRulesActionCompressResponse PhaseUpdateResponseRulesAction = "compress_response" - PhaseUpdateResponseRulesActionExecute PhaseUpdateResponseRulesAction = "execute" - PhaseUpdateResponseRulesActionJsChallenge PhaseUpdateResponseRulesAction = "js_challenge" - PhaseUpdateResponseRulesActionLog PhaseUpdateResponseRulesAction = "log" - PhaseUpdateResponseRulesActionManagedChallenge PhaseUpdateResponseRulesAction = "managed_challenge" - PhaseUpdateResponseRulesActionRedirect PhaseUpdateResponseRulesAction = "redirect" - PhaseUpdateResponseRulesActionRewrite PhaseUpdateResponseRulesAction = "rewrite" - PhaseUpdateResponseRulesActionRoute PhaseUpdateResponseRulesAction = "route" - PhaseUpdateResponseRulesActionScore PhaseUpdateResponseRulesAction = "score" - PhaseUpdateResponseRulesActionServeError PhaseUpdateResponseRulesAction = "serve_error" - PhaseUpdateResponseRulesActionSetConfig PhaseUpdateResponseRulesAction = "set_config" - PhaseUpdateResponseRulesActionSkip PhaseUpdateResponseRulesAction = "skip" - PhaseUpdateResponseRulesActionSetCacheSettings PhaseUpdateResponseRulesAction = "set_cache_settings" -) - -func (r PhaseUpdateResponseRulesAction) IsKnown() bool { - switch r { - case PhaseUpdateResponseRulesActionBlock, PhaseUpdateResponseRulesActionChallenge, PhaseUpdateResponseRulesActionCompressResponse, PhaseUpdateResponseRulesActionExecute, PhaseUpdateResponseRulesActionJsChallenge, PhaseUpdateResponseRulesActionLog, PhaseUpdateResponseRulesActionManagedChallenge, PhaseUpdateResponseRulesActionRedirect, PhaseUpdateResponseRulesActionRewrite, PhaseUpdateResponseRulesActionRoute, PhaseUpdateResponseRulesActionScore, PhaseUpdateResponseRulesActionServeError, PhaseUpdateResponseRulesActionSetConfig, PhaseUpdateResponseRulesActionSkip, PhaseUpdateResponseRulesActionSetCacheSettings: - return true - } - return false -} - -// A ruleset object. -type PhaseGetResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind PhaseGetResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase PhaseGetResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []PhaseGetResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON phaseGetResponseJSON `json:"-"` -} - -// phaseGetResponseJSON contains the JSON metadata for the struct -// [PhaseGetResponse] -type phaseGetResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field - Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseJSON) RawJSON() string { - return r.raw -} - -// The kind of the ruleset. -type PhaseGetResponseKind string - -const ( - PhaseGetResponseKindManaged PhaseGetResponseKind = "managed" - PhaseGetResponseKindCustom PhaseGetResponseKind = "custom" - PhaseGetResponseKindRoot PhaseGetResponseKind = "root" - PhaseGetResponseKindZone PhaseGetResponseKind = "zone" -) - -func (r PhaseGetResponseKind) IsKnown() bool { - switch r { - case PhaseGetResponseKindManaged, PhaseGetResponseKindCustom, PhaseGetResponseKindRoot, PhaseGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type PhaseGetResponsePhase string - -const ( - PhaseGetResponsePhaseDDoSL4 PhaseGetResponsePhase = "ddos_l4" - PhaseGetResponsePhaseDDoSL7 PhaseGetResponsePhase = "ddos_l7" - PhaseGetResponsePhaseHTTPConfigSettings PhaseGetResponsePhase = "http_config_settings" - PhaseGetResponsePhaseHTTPCustomErrors PhaseGetResponsePhase = "http_custom_errors" - PhaseGetResponsePhaseHTTPLogCustomFields PhaseGetResponsePhase = "http_log_custom_fields" - PhaseGetResponsePhaseHTTPRatelimit PhaseGetResponsePhase = "http_ratelimit" - PhaseGetResponsePhaseHTTPRequestCacheSettings PhaseGetResponsePhase = "http_request_cache_settings" - PhaseGetResponsePhaseHTTPRequestDynamicRedirect PhaseGetResponsePhase = "http_request_dynamic_redirect" - PhaseGetResponsePhaseHTTPRequestFirewallCustom PhaseGetResponsePhase = "http_request_firewall_custom" - PhaseGetResponsePhaseHTTPRequestFirewallManaged PhaseGetResponsePhase = "http_request_firewall_managed" - PhaseGetResponsePhaseHTTPRequestLateTransform PhaseGetResponsePhase = "http_request_late_transform" - PhaseGetResponsePhaseHTTPRequestOrigin PhaseGetResponsePhase = "http_request_origin" - PhaseGetResponsePhaseHTTPRequestRedirect PhaseGetResponsePhase = "http_request_redirect" - PhaseGetResponsePhaseHTTPRequestSanitize PhaseGetResponsePhase = "http_request_sanitize" - PhaseGetResponsePhaseHTTPRequestSbfm PhaseGetResponsePhase = "http_request_sbfm" - PhaseGetResponsePhaseHTTPRequestSelectConfiguration PhaseGetResponsePhase = "http_request_select_configuration" - PhaseGetResponsePhaseHTTPRequestTransform PhaseGetResponsePhase = "http_request_transform" - PhaseGetResponsePhaseHTTPResponseCompression PhaseGetResponsePhase = "http_response_compression" - PhaseGetResponsePhaseHTTPResponseFirewallManaged PhaseGetResponsePhase = "http_response_firewall_managed" - PhaseGetResponsePhaseHTTPResponseHeadersTransform PhaseGetResponsePhase = "http_response_headers_transform" - PhaseGetResponsePhaseMagicTransit PhaseGetResponsePhase = "magic_transit" - PhaseGetResponsePhaseMagicTransitIDsManaged PhaseGetResponsePhase = "magic_transit_ids_managed" - PhaseGetResponsePhaseMagicTransitManaged PhaseGetResponsePhase = "magic_transit_managed" -) - -func (r PhaseGetResponsePhase) IsKnown() bool { - switch r { - case PhaseGetResponsePhaseDDoSL4, PhaseGetResponsePhaseDDoSL7, PhaseGetResponsePhaseHTTPConfigSettings, PhaseGetResponsePhaseHTTPCustomErrors, PhaseGetResponsePhaseHTTPLogCustomFields, PhaseGetResponsePhaseHTTPRatelimit, PhaseGetResponsePhaseHTTPRequestCacheSettings, PhaseGetResponsePhaseHTTPRequestDynamicRedirect, PhaseGetResponsePhaseHTTPRequestFirewallCustom, PhaseGetResponsePhaseHTTPRequestFirewallManaged, PhaseGetResponsePhaseHTTPRequestLateTransform, PhaseGetResponsePhaseHTTPRequestOrigin, PhaseGetResponsePhaseHTTPRequestRedirect, PhaseGetResponsePhaseHTTPRequestSanitize, PhaseGetResponsePhaseHTTPRequestSbfm, PhaseGetResponsePhaseHTTPRequestSelectConfiguration, PhaseGetResponsePhaseHTTPRequestTransform, PhaseGetResponsePhaseHTTPResponseCompression, PhaseGetResponsePhaseHTTPResponseFirewallManaged, PhaseGetResponsePhaseHTTPResponseHeadersTransform, PhaseGetResponsePhaseMagicTransit, PhaseGetResponsePhaseMagicTransitIDsManaged, PhaseGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - -type PhaseGetResponseRule struct { - // The action to perform when the rule matches. - Action PhaseGetResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON phaseGetResponseRuleJSON `json:"-"` - union PhaseGetResponseRulesUnion -} - -// phaseGetResponseRuleJSON contains the JSON metadata for the struct -// [PhaseGetResponseRule] -type phaseGetResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseGetResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseGetResponseRule) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseGetResponseRule) AsUnion() PhaseGetResponseRulesUnion { - return r.union -} - -// Union satisfied by [rulesets.BlockRule], -// [rulesets.PhaseGetResponseRulesRulesetsChallengeRule], -// [rulesets.PhaseGetResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], [rulesets.PhaseGetResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], -// [rulesets.PhaseGetResponseRulesRulesetsManagedChallengeRule], -// [rulesets.PhaseGetResponseRulesRulesetsRedirectRule], -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRule], -// [rulesets.PhaseGetResponseRulesRulesetsRouteRule], -// [rulesets.PhaseGetResponseRulesRulesetsScoreRule], -// [rulesets.PhaseGetResponseRulesRulesetsServeErrorRule], -// [rulesets.PhaseGetResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.PhaseGetResponseRulesRulesetsSetCacheSettingsRule]. -type PhaseGetResponseRulesUnion interface { - implementsRulesetsPhaseGetResponseRule() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseGetResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", - }, - ) -} - -type PhaseGetResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [PhaseGetResponseRulesRulesetsChallengeRule] -type phaseGetResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsChallengeRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsChallengeRuleAction string - -const ( - PhaseGetResponseRulesRulesetsChallengeRuleActionChallenge PhaseGetResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r PhaseGetResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsCompressResponseRuleJSON contains the JSON metadata -// for the struct [PhaseGetResponseRulesRulesetsCompressResponseRule] -type phaseGetResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsCompressResponseRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsCompressResponseRuleAction string - -const ( - PhaseGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse PhaseGetResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r PhaseGetResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsCompressResponseRuleActionParameters] -type phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, PhaseGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata for -// the struct [PhaseGetResponseRulesRulesetsJsChallengeRule] -type phaseGetResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsJsChallengeRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsJsChallengeRuleAction string - -const ( - PhaseGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge PhaseGetResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r PhaseGetResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON metadata -// for the struct [PhaseGetResponseRulesRulesetsManagedChallengeRule] -type phaseGetResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsManagedChallengeRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - PhaseGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge PhaseGetResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r PhaseGetResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for the -// struct [PhaseGetResponseRulesRulesetsRedirectRule] -type phaseGetResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRedirectRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsRedirectRuleAction string - -const ( - PhaseGetResponseRulesRulesetsRedirectRuleActionRedirect PhaseGetResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r PhaseGetResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersJSON contains the JSON -// metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParameters] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromList] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON contains -// the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsPhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsPhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsPhaseGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseGetResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for the -// struct [PhaseGetResponseRulesRulesetsRewriteRule] -type phaseGetResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsRewriteRuleAction string - -const ( - PhaseGetResponseRulesRulesetsRewriteRuleActionRewrite PhaseGetResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r PhaseGetResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParameters] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains the -// JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, PhaseGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURI] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains the -// JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsPhaseGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseGetResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [PhaseGetResponseRulesRulesetsRouteRule] -type phaseGetResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsRouteRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsRouteRuleAction string - -const ( - PhaseGetResponseRulesRulesetsRouteRuleActionRoute PhaseGetResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r PhaseGetResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin PhaseGetResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni PhaseGetResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON phaseGetResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct [PhaseGetResponseRulesRulesetsRouteRuleActionParameters] -type phaseGetResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type PhaseGetResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON phaseGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsRouteRuleActionParametersOrigin] -type phaseGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type PhaseGetResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON phaseGetResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the JSON -// metadata for the struct -// [PhaseGetResponseRulesRulesetsRouteRuleActionParametersSni] -type phaseGetResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type PhaseGetResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [PhaseGetResponseRulesRulesetsScoreRule] -type phaseGetResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsScoreRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsScoreRuleAction string - -const ( - PhaseGetResponseRulesRulesetsScoreRuleActionScore PhaseGetResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r PhaseGetResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON phaseGetResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct [PhaseGetResponseRulesRulesetsScoreRuleActionParameters] -type phaseGetResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type PhaseGetResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [PhaseGetResponseRulesRulesetsServeErrorRule] -type phaseGetResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsServeErrorRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsServeErrorRuleAction string - -const ( - PhaseGetResponseRulesRulesetsServeErrorRuleActionServeError PhaseGetResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r PhaseGetResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON phaseGetResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsServeErrorRuleActionParameters] -type phaseGetResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, PhaseGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [PhaseGetResponseRulesRulesetsSetConfigRule] -type phaseGetResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsSetConfigRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsSetConfigRuleAction string - -const ( - PhaseGetResponseRulesRulesetsSetConfigRuleActionSetConfig PhaseGetResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r PhaseGetResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON phaseGetResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the JSON -// metadata for the struct -// [PhaseGetResponseRulesRulesetsSetConfigRuleActionParameters] -type phaseGetResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON phaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type phaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, PhaseGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type PhaseGetResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseGetResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON metadata -// for the struct [PhaseGetResponseRulesRulesetsSetCacheSettingsRule] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseGetResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsPhaseGetResponseRule() {} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings PhaseGetResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r PhaseGetResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type PhaseGetResponseRulesAction string - -const ( - PhaseGetResponseRulesActionBlock PhaseGetResponseRulesAction = "block" - PhaseGetResponseRulesActionChallenge PhaseGetResponseRulesAction = "challenge" - PhaseGetResponseRulesActionCompressResponse PhaseGetResponseRulesAction = "compress_response" - PhaseGetResponseRulesActionExecute PhaseGetResponseRulesAction = "execute" - PhaseGetResponseRulesActionJsChallenge PhaseGetResponseRulesAction = "js_challenge" - PhaseGetResponseRulesActionLog PhaseGetResponseRulesAction = "log" - PhaseGetResponseRulesActionManagedChallenge PhaseGetResponseRulesAction = "managed_challenge" - PhaseGetResponseRulesActionRedirect PhaseGetResponseRulesAction = "redirect" - PhaseGetResponseRulesActionRewrite PhaseGetResponseRulesAction = "rewrite" - PhaseGetResponseRulesActionRoute PhaseGetResponseRulesAction = "route" - PhaseGetResponseRulesActionScore PhaseGetResponseRulesAction = "score" - PhaseGetResponseRulesActionServeError PhaseGetResponseRulesAction = "serve_error" - PhaseGetResponseRulesActionSetConfig PhaseGetResponseRulesAction = "set_config" - PhaseGetResponseRulesActionSkip PhaseGetResponseRulesAction = "skip" - PhaseGetResponseRulesActionSetCacheSettings PhaseGetResponseRulesAction = "set_cache_settings" -) - -func (r PhaseGetResponseRulesAction) IsKnown() bool { - switch r { - case PhaseGetResponseRulesActionBlock, PhaseGetResponseRulesActionChallenge, PhaseGetResponseRulesActionCompressResponse, PhaseGetResponseRulesActionExecute, PhaseGetResponseRulesActionJsChallenge, PhaseGetResponseRulesActionLog, PhaseGetResponseRulesActionManagedChallenge, PhaseGetResponseRulesActionRedirect, PhaseGetResponseRulesActionRewrite, PhaseGetResponseRulesActionRoute, PhaseGetResponseRulesActionScore, PhaseGetResponseRulesActionServeError, PhaseGetResponseRulesActionSetConfig, PhaseGetResponseRulesActionSkip, PhaseGetResponseRulesActionSetCacheSettings: - return true - } - return false -} - -type PhaseUpdateParams struct { - // The list of rules in the ruleset. - Rules param.Field[[]PhaseUpdateParamsRuleUnion] `json:"rules,required"` - // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - AccountID param.Field[string] `path:"account_id"` - // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - ZoneID param.Field[string] `path:"zone_id"` - // An informative description of the ruleset. - Description param.Field[string] `json:"description"` - // The kind of the ruleset. - Kind param.Field[PhaseUpdateParamsKind] `json:"kind"` - // The human-readable name of the ruleset. - Name param.Field[string] `json:"name"` - // The phase of the ruleset. - Phase param.Field[PhaseUpdateParamsPhase] `json:"phase"` -} - -func (r PhaseUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The phase of the ruleset. -type PhaseUpdateParamsRulesetPhase string - -const ( - PhaseUpdateParamsRulesetPhaseDDoSL4 PhaseUpdateParamsRulesetPhase = "ddos_l4" - PhaseUpdateParamsRulesetPhaseDDoSL7 PhaseUpdateParamsRulesetPhase = "ddos_l7" - PhaseUpdateParamsRulesetPhaseHTTPConfigSettings PhaseUpdateParamsRulesetPhase = "http_config_settings" - PhaseUpdateParamsRulesetPhaseHTTPCustomErrors PhaseUpdateParamsRulesetPhase = "http_custom_errors" - PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields PhaseUpdateParamsRulesetPhase = "http_log_custom_fields" - PhaseUpdateParamsRulesetPhaseHTTPRatelimit PhaseUpdateParamsRulesetPhase = "http_ratelimit" - PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings PhaseUpdateParamsRulesetPhase = "http_request_cache_settings" - PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseUpdateParamsRulesetPhase = "http_request_dynamic_redirect" - PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom PhaseUpdateParamsRulesetPhase = "http_request_firewall_custom" - PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged PhaseUpdateParamsRulesetPhase = "http_request_firewall_managed" - PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform PhaseUpdateParamsRulesetPhase = "http_request_late_transform" - PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin PhaseUpdateParamsRulesetPhase = "http_request_origin" - PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect PhaseUpdateParamsRulesetPhase = "http_request_redirect" - PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize PhaseUpdateParamsRulesetPhase = "http_request_sanitize" - PhaseUpdateParamsRulesetPhaseHTTPRequestSbfm PhaseUpdateParamsRulesetPhase = "http_request_sbfm" - PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseUpdateParamsRulesetPhase = "http_request_select_configuration" - PhaseUpdateParamsRulesetPhaseHTTPRequestTransform PhaseUpdateParamsRulesetPhase = "http_request_transform" - PhaseUpdateParamsRulesetPhaseHTTPResponseCompression PhaseUpdateParamsRulesetPhase = "http_response_compression" - PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged PhaseUpdateParamsRulesetPhase = "http_response_firewall_managed" - PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform PhaseUpdateParamsRulesetPhase = "http_response_headers_transform" - PhaseUpdateParamsRulesetPhaseMagicTransit PhaseUpdateParamsRulesetPhase = "magic_transit" - PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged PhaseUpdateParamsRulesetPhase = "magic_transit_ids_managed" - PhaseUpdateParamsRulesetPhaseMagicTransitManaged PhaseUpdateParamsRulesetPhase = "magic_transit_managed" -) - -func (r PhaseUpdateParamsRulesetPhase) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesetPhaseDDoSL4, PhaseUpdateParamsRulesetPhaseDDoSL7, PhaseUpdateParamsRulesetPhaseHTTPConfigSettings, PhaseUpdateParamsRulesetPhaseHTTPCustomErrors, PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields, PhaseUpdateParamsRulesetPhaseHTTPRatelimit, PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings, PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform, PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin, PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize, PhaseUpdateParamsRulesetPhaseHTTPRequestSbfm, PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseUpdateParamsRulesetPhaseHTTPRequestTransform, PhaseUpdateParamsRulesetPhaseHTTPResponseCompression, PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseUpdateParamsRulesetPhaseMagicTransit, PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged, PhaseUpdateParamsRulesetPhaseMagicTransitManaged: - return true - } - return false -} - -type PhaseUpdateParamsRule struct { - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesAction] `json:"action"` - ActionParameters param.Field[interface{}] `json:"action_parameters,required"` - Categories param.Field[interface{}] `json:"categories,required"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// Satisfied by [rulesets.BlockRuleParam], -// [rulesets.PhaseUpdateParamsRulesRulesetsChallengeRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRuleParam], -// [rulesets.PhaseUpdateParamsRulesRulesetsJsChallengeRule], -// [rulesets.LogRuleParam], -// [rulesets.PhaseUpdateParamsRulesRulesetsManagedChallengeRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsRedirectRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsRouteRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsScoreRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsServeErrorRule], -// [rulesets.PhaseUpdateParamsRulesRulesetsSetConfigRule], -// [rulesets.SkipRuleParam], -// [rulesets.PhaseUpdateParamsRulesRulesetsSetCacheSettingsRule], -// [PhaseUpdateParamsRule]. -type PhaseUpdateParamsRuleUnion interface { - implementsRulesetsPhaseUpdateParamsRuleUnion() -} - -type PhaseUpdateParamsRulesRulesetsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsChallengeRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsChallengeRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsChallengeRuleActionChallenge PhaseUpdateParamsRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r PhaseUpdateParamsRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsCompressResponseRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsCompressResponseRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRule) implementsRulesetsPhaseUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsCompressResponseRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionCompressResponse PhaseUpdateParamsRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms param.Field[[]PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm] `json:"algorithms"` -} - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Compression algorithm to enable. -type PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name param.Field[PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName] `json:"name"` -} - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Name of compression algorithm to enable. -type PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, PhaseUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsJsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsJsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsJsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsJsChallengeRule) implementsRulesetsPhaseUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsJsChallengeRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsJsChallengeRuleActionJsChallenge PhaseUpdateParamsRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r PhaseUpdateParamsRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsManagedChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsManagedChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsManagedChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsManagedChallengeRule) implementsRulesetsPhaseUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsManagedChallengeRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge PhaseUpdateParamsRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r PhaseUpdateParamsRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsRedirectRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsRedirectRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsRedirectRuleActionRedirect PhaseUpdateParamsRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList] `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue] `json:"from_value"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on a bulk list lookup. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key param.Field[string] `json:"key"` - // The name of the list to match against. - Name param.Field[string] `json:"name"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on the request properties. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString param.Field[bool] `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode] `json:"status_code"` - // The URL to redirect the request to. - TargetURL param.Field[PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion] `json:"target_url"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The status code to be used for the redirect. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) implementsRulesetsPhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -// The URL to redirect the request to. -// -// Satisfied by -// [rulesets.PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect], -// [rulesets.PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect], -// [PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL]. -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsPhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() -} - -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsPhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsPhaseUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsRewriteRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsRewriteRuleActionRewrite PhaseUpdateParamsRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers param.Field[map[string]PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion] `json:"headers"` - // URI to rewrite the request to. - URI param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURI] `json:"uri"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Remove the header from the request. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders struct { - Operation param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value"` - // Expression for the header value. - Expression param.Field[string] `json:"expression"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -// Remove the header from the request. -// -// Satisfied by -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader], -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader], -// [PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders]. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() -} - -// Remove the header from the request. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation] `json:"operation,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression param.Field[string] `json:"expression,required"` - Operation param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation] `json:"operation,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion] `json:"path"` - // Query portion rewrite. - Query param.Field[PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion] `json:"query"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURI) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Path portion rewrite. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Path portion rewrite. -// -// Satisfied by -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue], -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue], -// [PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath]. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Query portion rewrite. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -// Query portion rewrite. -// -// Satisfied by -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue], -// [rulesets.PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue], -// [PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery]. -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsPhaseUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type PhaseUpdateParamsRulesRulesetsRouteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsRouteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsRouteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsRouteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsRouteRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsRouteRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsRouteRuleActionRoute PhaseUpdateParamsRulesRulesetsRouteRuleAction = "route" -) - -func (r PhaseUpdateParamsRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader param.Field[string] `json:"host_header"` - // Override the IP/TCP destination. - Origin param.Field[PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin] `json:"origin"` - // Override the Server Name Indication (SNI). - Sni param.Field[PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersSni] `json:"sni"` -} - -func (r PhaseUpdateParamsRulesRulesetsRouteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the IP/TCP destination. -type PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host param.Field[string] `json:"host"` - // Override the destination port. - Port param.Field[float64] `json:"port"` -} - -func (r PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the Server Name Indication (SNI). -type PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value param.Field[string] `json:"value,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsRouteRuleActionParametersSni) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type PhaseUpdateParamsRulesRulesetsScoreRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsScoreRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsScoreRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsScoreRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsScoreRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsScoreRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsScoreRuleActionScore PhaseUpdateParamsRulesRulesetsScoreRuleAction = "score" -) - -func (r PhaseUpdateParamsRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment param.Field[int64] `json:"increment"` -} - -func (r PhaseUpdateParamsRulesRulesetsScoreRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type PhaseUpdateParamsRulesRulesetsServeErrorRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsServeErrorRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsServeErrorRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsServeErrorRule) implementsRulesetsPhaseUpdateParamsRuleUnion() { + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", + }, + ) } // The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsServeErrorRuleAction string +type PhaseGetResponseRulesAction string const ( - PhaseUpdateParamsRulesRulesetsServeErrorRuleActionServeError PhaseUpdateParamsRulesRulesetsServeErrorRuleAction = "serve_error" + PhaseGetResponseRulesActionBlock PhaseGetResponseRulesAction = "block" + PhaseGetResponseRulesActionChallenge PhaseGetResponseRulesAction = "challenge" + PhaseGetResponseRulesActionCompressResponse PhaseGetResponseRulesAction = "compress_response" + PhaseGetResponseRulesActionExecute PhaseGetResponseRulesAction = "execute" + PhaseGetResponseRulesActionJsChallenge PhaseGetResponseRulesAction = "js_challenge" + PhaseGetResponseRulesActionLog PhaseGetResponseRulesAction = "log" + PhaseGetResponseRulesActionManagedChallenge PhaseGetResponseRulesAction = "managed_challenge" + PhaseGetResponseRulesActionRedirect PhaseGetResponseRulesAction = "redirect" + PhaseGetResponseRulesActionRewrite PhaseGetResponseRulesAction = "rewrite" + PhaseGetResponseRulesActionRoute PhaseGetResponseRulesAction = "route" + PhaseGetResponseRulesActionScore PhaseGetResponseRulesAction = "score" + PhaseGetResponseRulesActionServeError PhaseGetResponseRulesAction = "serve_error" + PhaseGetResponseRulesActionSetConfig PhaseGetResponseRulesAction = "set_config" + PhaseGetResponseRulesActionSkip PhaseGetResponseRulesAction = "skip" + PhaseGetResponseRulesActionSetCacheSettings PhaseGetResponseRulesAction = "set_cache_settings" ) -func (r PhaseUpdateParamsRulesRulesetsServeErrorRuleAction) IsKnown() bool { +func (r PhaseGetResponseRulesAction) IsKnown() bool { switch r { - case PhaseUpdateParamsRulesRulesetsServeErrorRuleActionServeError: + case PhaseGetResponseRulesActionBlock, PhaseGetResponseRulesActionChallenge, PhaseGetResponseRulesActionCompressResponse, PhaseGetResponseRulesActionExecute, PhaseGetResponseRulesActionJsChallenge, PhaseGetResponseRulesActionLog, PhaseGetResponseRulesActionManagedChallenge, PhaseGetResponseRulesActionRedirect, PhaseGetResponseRulesActionRewrite, PhaseGetResponseRulesActionRoute, PhaseGetResponseRulesActionScore, PhaseGetResponseRulesActionServeError, PhaseGetResponseRulesActionSetConfig, PhaseGetResponseRulesActionSkip, PhaseGetResponseRulesActionSetCacheSettings: return true } return false } -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content param.Field[string] `json:"content"` - // Content-type header to set with the response. - ContentType param.Field[PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType] `json:"content_type"` - // The status code to use for the error. - StatusCode param.Field[float64] `json:"status_code"` +type PhaseUpdateParams struct { + // The list of rules in the ruleset. + Rules param.Field[[]PhaseUpdateParamsRuleUnion] `json:"rules,required"` + // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + AccountID param.Field[string] `path:"account_id"` + // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + ZoneID param.Field[string] `path:"zone_id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[PhaseUpdateParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[PhaseUpdateParamsPhase] `json:"phase"` } -func (r PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParameters) MarshalJSON() (data []byte, err error) { +func (r PhaseUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Content-type header to set with the response. -type PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType string +// The phase of the ruleset. +type PhaseUpdateParamsRulesetPhase string const ( - PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" + PhaseUpdateParamsRulesetPhaseDDoSL4 PhaseUpdateParamsRulesetPhase = "ddos_l4" + PhaseUpdateParamsRulesetPhaseDDoSL7 PhaseUpdateParamsRulesetPhase = "ddos_l7" + PhaseUpdateParamsRulesetPhaseHTTPConfigSettings PhaseUpdateParamsRulesetPhase = "http_config_settings" + PhaseUpdateParamsRulesetPhaseHTTPCustomErrors PhaseUpdateParamsRulesetPhase = "http_custom_errors" + PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields PhaseUpdateParamsRulesetPhase = "http_log_custom_fields" + PhaseUpdateParamsRulesetPhaseHTTPRatelimit PhaseUpdateParamsRulesetPhase = "http_ratelimit" + PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings PhaseUpdateParamsRulesetPhase = "http_request_cache_settings" + PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseUpdateParamsRulesetPhase = "http_request_dynamic_redirect" + PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom PhaseUpdateParamsRulesetPhase = "http_request_firewall_custom" + PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged PhaseUpdateParamsRulesetPhase = "http_request_firewall_managed" + PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform PhaseUpdateParamsRulesetPhase = "http_request_late_transform" + PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin PhaseUpdateParamsRulesetPhase = "http_request_origin" + PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect PhaseUpdateParamsRulesetPhase = "http_request_redirect" + PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize PhaseUpdateParamsRulesetPhase = "http_request_sanitize" + PhaseUpdateParamsRulesetPhaseHTTPRequestSbfm PhaseUpdateParamsRulesetPhase = "http_request_sbfm" + PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseUpdateParamsRulesetPhase = "http_request_select_configuration" + PhaseUpdateParamsRulesetPhaseHTTPRequestTransform PhaseUpdateParamsRulesetPhase = "http_request_transform" + PhaseUpdateParamsRulesetPhaseHTTPResponseCompression PhaseUpdateParamsRulesetPhase = "http_response_compression" + PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged PhaseUpdateParamsRulesetPhase = "http_response_firewall_managed" + PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform PhaseUpdateParamsRulesetPhase = "http_response_headers_transform" + PhaseUpdateParamsRulesetPhaseMagicTransit PhaseUpdateParamsRulesetPhase = "magic_transit" + PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged PhaseUpdateParamsRulesetPhase = "magic_transit_ids_managed" + PhaseUpdateParamsRulesetPhaseMagicTransitManaged PhaseUpdateParamsRulesetPhase = "magic_transit_managed" ) -func (r PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { +func (r PhaseUpdateParamsRulesetPhase) IsKnown() bool { switch r { - case PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, PhaseUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: + case PhaseUpdateParamsRulesetPhaseDDoSL4, PhaseUpdateParamsRulesetPhaseDDoSL7, PhaseUpdateParamsRulesetPhaseHTTPConfigSettings, PhaseUpdateParamsRulesetPhaseHTTPCustomErrors, PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields, PhaseUpdateParamsRulesetPhaseHTTPRatelimit, PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings, PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform, PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin, PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize, PhaseUpdateParamsRulesetPhaseHTTPRequestSbfm, PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseUpdateParamsRulesetPhaseHTTPRequestTransform, PhaseUpdateParamsRulesetPhaseHTTPResponseCompression, PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseUpdateParamsRulesetPhaseMagicTransit, PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged, PhaseUpdateParamsRulesetPhaseMagicTransitManaged: return true } return false } -type PhaseUpdateParamsRulesRulesetsSetConfigRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` +type PhaseUpdateParamsRule struct { // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParameters] `json:"action_parameters"` + Action param.Field[PhaseUpdateParamsRulesAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters,required"` + Categories param.Field[interface{}] `json:"categories,required"` // An informative description of the rule. Description param.Field[string] `json:"description"` // Whether the rule should be executed. Enabled param.Field[bool] `json:"enabled"` // The expression defining which traffic will match the rule. Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionSetConfig PhaseUpdateParamsRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites param.Field[bool] `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify] `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic param.Field[bool] `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps param.Field[bool] `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz param.Field[bool] `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation param.Field[bool] `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection param.Field[bool] `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage param.Field[bool] `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption param.Field[bool] `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish] `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader param.Field[bool] `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel] `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes param.Field[bool] `json:"server_side_excludes"` - // Configure the SSL level. - SSL param.Field[PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL] `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg param.Field[bool] `json:"sxg"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Select which file extensions to minify automatically. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css param.Field[bool] `json:"css"` - // Minify HTML files. - HTML param.Field[bool] `json:"html"` - // Minify JS files. - Js param.Field[bool] `json:"js"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Configure the Polish level. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishOff PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "off" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishOff, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOff PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "off" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFull PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "full" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOff, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFull, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict, PhaseUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRule struct { // The unique ID of the rule. ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` // An object configuring the rule's logging behavior. Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRule) implementsRulesetsPhaseUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleAction string - -const ( - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts param.Field[[]int64] `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache param.Field[bool] `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl param.Field[bool] `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru param.Field[bool] `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout param.Field[int64] `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags param.Field[bool] `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] `json:"serve_stale"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode] `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Determines which browser ttl mode to use. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType param.Field[bool] `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor param.Field[bool] `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder param.Field[bool] `json:"ignore_query_strings_order"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Customize which components of the request are included or excluded from the -// cache key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] `json:"cookie"` - // The header names and values to include in building the cache key. - Header param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] `json:"user"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The cookies to include in building the cache key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Include these cookies' names and their values. - Include param.Field[[]string] `json:"include"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The header names and values to include in building the cache key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin param.Field[bool] `json:"exclude_origin"` - // Include these headers' names and their values. - Include param.Field[[]string] `json:"include"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether to use the original host or the resolved host in the cache key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved param.Field[bool] `json:"resolved"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] `json:"include"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List param.Field[[]string] `json:"list"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters used to build the cache key. - List param.Field[[]string] `json:"list"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Characteristics of the request user agent used in building the cache key. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType param.Field[bool] `json:"device_type"` - // Use the user agents's country in the cache key. - Geo param.Field[bool] `json:"geo"` - // Use the user agent's language in the cache key. - Lang param.Field[bool] `json:"lang"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible param.Field[bool] `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize param.Field[int64] `json:"min_file_size,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default,required"` - // edge ttl options - Mode param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode] `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL param.Field[[]PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] `json:"status_code_ttl,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// edge ttl options -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value param.Field[int64] `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange param.Field[PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue param.Field[int64] `json:"status_code_value"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The range of status codes used to apply the selected mode. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From param.Field[int64] `json:"from,required"` - // response status code upper bound - To param.Field[int64] `json:"to,required"` -} - -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) MarshalJSON() (data []byte, err error) { +func (r PhaseUpdateParamsRule) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating param.Field[bool] `json:"disable_stale_while_updating,required"` -} +func (r PhaseUpdateParamsRule) implementsRulesetsPhaseUpdateParamsRuleUnion() {} -func (r PhaseUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Satisfied by [rulesets.BlockRuleParam], [rulesets.ChallengeRuleParam], +// [rulesets.CompressResponseRuleParam], [rulesets.ExecuteRuleParam], +// [rulesets.JsChallengeRuleParam], [rulesets.LogRuleParam], +// [rulesets.ManagedChallengeRuleParam], [rulesets.RedirectRuleParam], +// [rulesets.RewriteRuleParam], [rulesets.RouteRuleParam], +// [rulesets.ScoreRuleParam], [rulesets.ServeErrorRuleParam], +// [rulesets.SetConfigRuleParam], [rulesets.SkipRuleParam], +// [rulesets.SetCacheSettingsRuleParam], [PhaseUpdateParamsRule]. +type PhaseUpdateParamsRuleUnion interface { + implementsRulesetsPhaseUpdateParamsRuleUnion() } // The action to perform when the rule matches. diff --git a/rulesets/phaseversion.go b/rulesets/phaseversion.go index 1db5e8ac426..fda7f4b2068 100644 --- a/rulesets/phaseversion.go +++ b/rulesets/phaseversion.go @@ -247,21 +247,12 @@ func (r PhaseVersionGetResponseRule) AsUnion() PhaseVersionGetResponseRulesUnion return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsChallengeRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsManagedChallengeRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsRedirectRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsRouteRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsScoreRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsServeErrorRule], -// [rulesets.PhaseVersionGetResponseRulesRulesetsSetConfigRule], -// [rulesets.SkipRule] or -// [rulesets.PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule]. +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. type PhaseVersionGetResponseRulesUnion interface { implementsRulesetsPhaseVersionGetResponseRule() } @@ -277,12 +268,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsChallengeRule{}), + Type: reflect.TypeOf(ChallengeRule{}), DiscriminatorValue: "challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsCompressResponseRule{}), + Type: reflect.TypeOf(CompressResponseRule{}), DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ @@ -292,7 +283,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsJsChallengeRule{}), + Type: reflect.TypeOf(JsChallengeRule{}), DiscriminatorValue: "js_challenge", }, apijson.UnionVariant{ @@ -302,37 +293,37 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsManagedChallengeRule{}), + Type: reflect.TypeOf(ManagedChallengeRule{}), DiscriminatorValue: "managed_challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRedirectRule{}), + Type: reflect.TypeOf(RedirectRule{}), DiscriminatorValue: "redirect", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRule{}), + Type: reflect.TypeOf(RewriteRule{}), DiscriminatorValue: "rewrite", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRouteRule{}), + Type: reflect.TypeOf(RouteRule{}), DiscriminatorValue: "route", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsScoreRule{}), + Type: reflect.TypeOf(ScoreRule{}), DiscriminatorValue: "score", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsServeErrorRule{}), + Type: reflect.TypeOf(ServeErrorRule{}), DiscriminatorValue: "serve_error", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsSetConfigRule{}), + Type: reflect.TypeOf(SetConfigRule{}), DiscriminatorValue: "set_config", }, apijson.UnionVariant{ @@ -342,2421 +333,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule{}), + Type: reflect.TypeOf(SetCacheSettingsRule{}), DiscriminatorValue: "set_cache_settings", }, ) } -type PhaseVersionGetResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata -// for the struct [PhaseVersionGetResponseRulesRulesetsChallengeRule] -type phaseVersionGetResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsChallengeRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsChallengeRuleActionChallenge PhaseVersionGetResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r PhaseVersionGetResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsCompressResponseRule] -type phaseVersionGetResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsCompressResponseRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsCompressResponseRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse PhaseVersionGetResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r PhaseVersionGetResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, PhaseVersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsJsChallengeRuleJSON contains the JSON -// metadata for the struct [PhaseVersionGetResponseRulesRulesetsJsChallengeRule] -type phaseVersionGetResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsJsChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsJsChallengeRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge PhaseVersionGetResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r PhaseVersionGetResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsManagedChallengeRule] -type phaseVersionGetResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsManagedChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata -// for the struct [PhaseVersionGetResponseRulesRulesetsRedirectRule] -type phaseVersionGetResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionRedirect PhaseVersionGetResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsPhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata -// for the struct [PhaseVersionGetResponseRulesRulesetsRewriteRule] -type phaseVersionGetResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionRewrite PhaseVersionGetResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURI] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsPhaseVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type PhaseVersionGetResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for -// the struct [PhaseVersionGetResponseRulesRulesetsRouteRule] -type phaseVersionGetResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsRouteRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsRouteRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsRouteRuleActionRoute PhaseVersionGetResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r PhaseVersionGetResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRouteRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin] -type phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSni] -type phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type PhaseVersionGetResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for -// the struct [PhaseVersionGetResponseRulesRulesetsScoreRule] -type phaseVersionGetResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsScoreRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsScoreRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsScoreRuleActionScore PhaseVersionGetResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r PhaseVersionGetResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON phaseVersionGetResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsScoreRuleActionParametersJSON contains the -// JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsScoreRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type PhaseVersionGetResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsServeErrorRuleJSON contains the JSON -// metadata for the struct [PhaseVersionGetResponseRulesRulesetsServeErrorRule] -type phaseVersionGetResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsServeErrorRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsServeErrorRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionServeError PhaseVersionGetResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r PhaseVersionGetResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON phaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, PhaseVersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata -// for the struct [PhaseVersionGetResponseRulesRulesetsSetConfigRule] -type phaseVersionGetResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsSetConfigRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionSetConfig PhaseVersionGetResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON contains -// the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, PhaseVersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsPhaseVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PhaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r phaseVersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - // The action to perform when the rule matches. type PhaseVersionGetResponseRulesAction string diff --git a/rulesets/rule.go b/rulesets/rule.go index 765393f11f7..c0c75735e4c 100644 --- a/rulesets/rule.go +++ b/rulesets/rule.go @@ -293,6 +293,326 @@ func (r BlockRuleActionParametersResponseParam) MarshalJSON() (data []byte, err return apijson.MarshalRoot(r) } +type ChallengeRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action ChallengeRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters interface{} `json:"action_parameters"` + // The categories of the rule. + Categories []string `json:"categories"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + JSON challengeRuleJSON `json:"-"` +} + +// challengeRuleJSON contains the JSON metadata for the struct [ChallengeRule] +type challengeRuleJSON struct { + LastUpdated apijson.Field + Version apijson.Field + ID apijson.Field + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Logging apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ChallengeRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r challengeRuleJSON) RawJSON() string { + return r.raw +} + +func (r ChallengeRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r ChallengeRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r ChallengeRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r ChallengeRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r ChallengeRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r ChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r ChallengeRule) implementsRulesetsRuleNewResponseRule() {} + +func (r ChallengeRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r ChallengeRule) implementsRulesetsRuleEditResponseRule() {} + +func (r ChallengeRule) implementsRulesetsVersionGetResponseRule() {} + +func (r ChallengeRule) implementsRulesetsVersionByTagGetResponseRule() {} + +// The action to perform when the rule matches. +type ChallengeRuleAction string + +const ( + ChallengeRuleActionChallenge ChallengeRuleAction = "challenge" +) + +func (r ChallengeRuleAction) IsKnown() bool { + switch r { + case ChallengeRuleActionChallenge: + return true + } + return false +} + +type ChallengeRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[ChallengeRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[interface{}] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r ChallengeRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ChallengeRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r ChallengeRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r ChallengeRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +type CompressResponseRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action CompressResponseRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters CompressResponseRuleActionParameters `json:"action_parameters"` + // The categories of the rule. + Categories []string `json:"categories"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + JSON compressResponseRuleJSON `json:"-"` +} + +// compressResponseRuleJSON contains the JSON metadata for the struct +// [CompressResponseRule] +type compressResponseRuleJSON struct { + LastUpdated apijson.Field + Version apijson.Field + ID apijson.Field + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Logging apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CompressResponseRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r compressResponseRuleJSON) RawJSON() string { + return r.raw +} + +func (r CompressResponseRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsRuleNewResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsRuleEditResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsVersionGetResponseRule() {} + +func (r CompressResponseRule) implementsRulesetsVersionByTagGetResponseRule() {} + +// The action to perform when the rule matches. +type CompressResponseRuleAction string + +const ( + CompressResponseRuleActionCompressResponse CompressResponseRuleAction = "compress_response" +) + +func (r CompressResponseRuleAction) IsKnown() bool { + switch r { + case CompressResponseRuleActionCompressResponse: + return true + } + return false +} + +// The parameters configuring the rule's action. +type CompressResponseRuleActionParameters struct { + // Custom order for compression algorithms. + Algorithms []CompressResponseRuleActionParametersAlgorithm `json:"algorithms"` + JSON compressResponseRuleActionParametersJSON `json:"-"` +} + +// compressResponseRuleActionParametersJSON contains the JSON metadata for the +// struct [CompressResponseRuleActionParameters] +type compressResponseRuleActionParametersJSON struct { + Algorithms apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r compressResponseRuleActionParametersJSON) RawJSON() string { + return r.raw +} + +// Compression algorithm to enable. +type CompressResponseRuleActionParametersAlgorithm struct { + // Name of compression algorithm to enable. + Name CompressResponseRuleActionParametersAlgorithmsName `json:"name"` + JSON compressResponseRuleActionParametersAlgorithmJSON `json:"-"` +} + +// compressResponseRuleActionParametersAlgorithmJSON contains the JSON metadata for +// the struct [CompressResponseRuleActionParametersAlgorithm] +type compressResponseRuleActionParametersAlgorithmJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r compressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { + return r.raw +} + +// Name of compression algorithm to enable. +type CompressResponseRuleActionParametersAlgorithmsName string + +const ( + CompressResponseRuleActionParametersAlgorithmsNameNone CompressResponseRuleActionParametersAlgorithmsName = "none" + CompressResponseRuleActionParametersAlgorithmsNameAuto CompressResponseRuleActionParametersAlgorithmsName = "auto" + CompressResponseRuleActionParametersAlgorithmsNameDefault CompressResponseRuleActionParametersAlgorithmsName = "default" + CompressResponseRuleActionParametersAlgorithmsNameGzip CompressResponseRuleActionParametersAlgorithmsName = "gzip" + CompressResponseRuleActionParametersAlgorithmsNameBrotli CompressResponseRuleActionParametersAlgorithmsName = "brotli" +) + +func (r CompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { + switch r { + case CompressResponseRuleActionParametersAlgorithmsNameNone, CompressResponseRuleActionParametersAlgorithmsNameAuto, CompressResponseRuleActionParametersAlgorithmsNameDefault, CompressResponseRuleActionParametersAlgorithmsNameGzip, CompressResponseRuleActionParametersAlgorithmsNameBrotli: + return true + } + return false +} + +type CompressResponseRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[CompressResponseRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[CompressResponseRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r CompressResponseRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CompressResponseRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r CompressResponseRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r CompressResponseRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type CompressResponseRuleActionParametersParam struct { + // Custom order for compression algorithms. + Algorithms param.Field[[]CompressResponseRuleActionParametersAlgorithmParam] `json:"algorithms"` +} + +func (r CompressResponseRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Compression algorithm to enable. +type CompressResponseRuleActionParametersAlgorithmParam struct { + // Name of compression algorithm to enable. + Name param.Field[CompressResponseRuleActionParametersAlgorithmsName] `json:"name"` +} + +func (r CompressResponseRuleActionParametersAlgorithmParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type ExecuteRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` @@ -703,7 +1023,7 @@ func (r ExecuteRuleActionParametersOverridesRuleParam) MarshalJSON() (data []byt return apijson.MarshalRoot(r) } -type LogRule struct { +type JsChallengeRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -711,7 +1031,7 @@ type LogRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action LogRuleAction `json:"action"` + Action JsChallengeRuleAction `json:"action"` // The parameters configuring the rule's action. ActionParameters interface{} `json:"action_parameters"` // The categories of the rule. @@ -725,12 +1045,12 @@ type LogRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON logRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON jsChallengeRuleJSON `json:"-"` } -// logRuleJSON contains the JSON metadata for the struct [LogRule] -type logRuleJSON struct { +// jsChallengeRuleJSON contains the JSON metadata for the struct [JsChallengeRule] +type jsChallengeRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -746,56 +1066,56 @@ type logRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *LogRule) UnmarshalJSON(data []byte) (err error) { +func (r *JsChallengeRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r logRuleJSON) RawJSON() string { +func (r jsChallengeRuleJSON) RawJSON() string { return r.raw } -func (r LogRule) implementsRulesetsRulesetNewResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRulesetNewResponseRule() {} -func (r LogRule) implementsRulesetsRulesetUpdateResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRulesetUpdateResponseRule() {} -func (r LogRule) implementsRulesetsRulesetGetResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRulesetGetResponseRule() {} -func (r LogRule) implementsRulesetsPhaseUpdateResponseRule() {} +func (r JsChallengeRule) implementsRulesetsPhaseUpdateResponseRule() {} -func (r LogRule) implementsRulesetsPhaseGetResponseRule() {} +func (r JsChallengeRule) implementsRulesetsPhaseGetResponseRule() {} -func (r LogRule) implementsRulesetsPhaseVersionGetResponseRule() {} +func (r JsChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() {} -func (r LogRule) implementsRulesetsRuleNewResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRuleNewResponseRule() {} -func (r LogRule) implementsRulesetsRuleDeleteResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRuleDeleteResponseRule() {} -func (r LogRule) implementsRulesetsRuleEditResponseRule() {} +func (r JsChallengeRule) implementsRulesetsRuleEditResponseRule() {} -func (r LogRule) implementsRulesetsVersionGetResponseRule() {} +func (r JsChallengeRule) implementsRulesetsVersionGetResponseRule() {} -func (r LogRule) implementsRulesetsVersionByTagGetResponseRule() {} +func (r JsChallengeRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type LogRuleAction string +type JsChallengeRuleAction string const ( - LogRuleActionLog LogRuleAction = "log" + JsChallengeRuleActionJsChallenge JsChallengeRuleAction = "js_challenge" ) -func (r LogRuleAction) IsKnown() bool { +func (r JsChallengeRuleAction) IsKnown() bool { switch r { - case LogRuleActionLog: + case JsChallengeRuleActionJsChallenge: return true } return false } -type LogRuleParam struct { +type JsChallengeRuleParam struct { // The unique ID of the rule. ID param.Field[string] `json:"id"` // The action to perform when the rule matches. - Action param.Field[LogRuleAction] `json:"action"` + Action param.Field[JsChallengeRuleAction] `json:"action"` // The parameters configuring the rule's action. ActionParameters param.Field[interface{}] `json:"action_parameters"` // An informative description of the rule. @@ -810,11 +1130,128 @@ type LogRuleParam struct { Ref param.Field[string] `json:"ref"` } -func (r LogRuleParam) MarshalJSON() (data []byte, err error) { +func (r JsChallengeRuleParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r LogRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} +func (r JsChallengeRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r JsChallengeRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r JsChallengeRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +type LogRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action LogRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters interface{} `json:"action_parameters"` + // The categories of the rule. + Categories []string `json:"categories"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + JSON logRuleJSON `json:"-"` +} + +// logRuleJSON contains the JSON metadata for the struct [LogRule] +type logRuleJSON struct { + LastUpdated apijson.Field + Version apijson.Field + ID apijson.Field + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Logging apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *LogRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r logRuleJSON) RawJSON() string { + return r.raw +} + +func (r LogRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r LogRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r LogRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r LogRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r LogRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r LogRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r LogRule) implementsRulesetsRuleNewResponseRule() {} + +func (r LogRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r LogRule) implementsRulesetsRuleEditResponseRule() {} + +func (r LogRule) implementsRulesetsVersionGetResponseRule() {} + +func (r LogRule) implementsRulesetsVersionByTagGetResponseRule() {} + +// The action to perform when the rule matches. +type LogRuleAction string + +const ( + LogRuleActionLog LogRuleAction = "log" +) + +func (r LogRuleAction) IsKnown() bool { + switch r { + case LogRuleActionLog: + return true + } + return false +} + +type LogRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[LogRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[interface{}] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r LogRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r LogRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} func (r LogRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} @@ -852,7 +1289,7 @@ func (r LoggingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SkipRule struct { +type ManagedChallengeRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -860,9 +1297,9 @@ type SkipRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action SkipRuleAction `json:"action"` + Action ManagedChallengeRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters SkipRuleActionParameters `json:"action_parameters"` + ActionParameters interface{} `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -874,12 +1311,13 @@ type SkipRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON skipRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON managedChallengeRuleJSON `json:"-"` } -// skipRuleJSON contains the JSON metadata for the struct [SkipRule] -type skipRuleJSON struct { +// managedChallengeRuleJSON contains the JSON metadata for the struct +// [ManagedChallengeRule] +type managedChallengeRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -895,361 +1333,292 @@ type skipRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *SkipRule) UnmarshalJSON(data []byte) (err error) { +func (r *ManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r skipRuleJSON) RawJSON() string { +func (r managedChallengeRuleJSON) RawJSON() string { return r.raw } -func (r SkipRule) implementsRulesetsRulesetNewResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRulesetNewResponseRule() {} -func (r SkipRule) implementsRulesetsRulesetUpdateResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRulesetUpdateResponseRule() {} -func (r SkipRule) implementsRulesetsRulesetGetResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRulesetGetResponseRule() {} -func (r SkipRule) implementsRulesetsPhaseUpdateResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsPhaseUpdateResponseRule() {} -func (r SkipRule) implementsRulesetsPhaseGetResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsPhaseGetResponseRule() {} -func (r SkipRule) implementsRulesetsPhaseVersionGetResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsPhaseVersionGetResponseRule() {} -func (r SkipRule) implementsRulesetsRuleNewResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRuleNewResponseRule() {} -func (r SkipRule) implementsRulesetsRuleDeleteResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRuleDeleteResponseRule() {} -func (r SkipRule) implementsRulesetsRuleEditResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsRuleEditResponseRule() {} -func (r SkipRule) implementsRulesetsVersionGetResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsVersionGetResponseRule() {} -func (r SkipRule) implementsRulesetsVersionByTagGetResponseRule() {} +func (r ManagedChallengeRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type SkipRuleAction string +type ManagedChallengeRuleAction string const ( - SkipRuleActionSkip SkipRuleAction = "skip" + ManagedChallengeRuleActionManagedChallenge ManagedChallengeRuleAction = "managed_challenge" ) -func (r SkipRuleAction) IsKnown() bool { +func (r ManagedChallengeRuleAction) IsKnown() bool { switch r { - case SkipRuleActionSkip: + case ManagedChallengeRuleActionManagedChallenge: return true } return false } -// The parameters configuring the rule's action. -type SkipRuleActionParameters struct { - // A list of phases to skip the execution of. This option is incompatible with the - // ruleset and rulesets options. - Phases []SkipRuleActionParametersPhase `json:"phases"` - // A list of legacy security products to skip the execution of. - Products []SkipRuleActionParametersProduct `json:"products"` - // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - // execution of. This option is incompatible with the ruleset option. - Rules map[string][]string `json:"rules"` - // A ruleset to skip the execution of. This option is incompatible with the - // rulesets, rules and phases options. - Ruleset SkipRuleActionParametersRuleset `json:"ruleset"` - // A list of ruleset IDs to skip the execution of. This option is incompatible with - // the ruleset and phases options. - Rulesets []string `json:"rulesets"` - JSON skipRuleActionParametersJSON `json:"-"` +type ManagedChallengeRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[ManagedChallengeRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[interface{}] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -// skipRuleActionParametersJSON contains the JSON metadata for the struct -// [SkipRuleActionParameters] -type skipRuleActionParametersJSON struct { - Phases apijson.Field - Products apijson.Field - Rules apijson.Field - Ruleset apijson.Field - Rulesets apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r ManagedChallengeRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *SkipRuleActionParameters) UnmarshalJSON(data []byte) (err error) { +func (r ManagedChallengeRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r ManagedChallengeRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r ManagedChallengeRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +type RedirectRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action RedirectRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters RedirectRuleActionParameters `json:"action_parameters"` + // The categories of the rule. + Categories []string `json:"categories"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + JSON redirectRuleJSON `json:"-"` +} + +// redirectRuleJSON contains the JSON metadata for the struct [RedirectRule] +type redirectRuleJSON struct { + LastUpdated apijson.Field + Version apijson.Field + ID apijson.Field + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Logging apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RedirectRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r skipRuleActionParametersJSON) RawJSON() string { +func (r redirectRuleJSON) RawJSON() string { return r.raw } -// A phase to skip the execution of. -type SkipRuleActionParametersPhase string +func (r RedirectRule) implementsRulesetsRulesetNewResponseRule() {} -const ( - SkipRuleActionParametersPhaseDDoSL4 SkipRuleActionParametersPhase = "ddos_l4" - SkipRuleActionParametersPhaseDDoSL7 SkipRuleActionParametersPhase = "ddos_l7" - SkipRuleActionParametersPhaseHTTPConfigSettings SkipRuleActionParametersPhase = "http_config_settings" - SkipRuleActionParametersPhaseHTTPCustomErrors SkipRuleActionParametersPhase = "http_custom_errors" - SkipRuleActionParametersPhaseHTTPLogCustomFields SkipRuleActionParametersPhase = "http_log_custom_fields" - SkipRuleActionParametersPhaseHTTPRatelimit SkipRuleActionParametersPhase = "http_ratelimit" - SkipRuleActionParametersPhaseHTTPRequestCacheSettings SkipRuleActionParametersPhase = "http_request_cache_settings" - SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect SkipRuleActionParametersPhase = "http_request_dynamic_redirect" - SkipRuleActionParametersPhaseHTTPRequestFirewallCustom SkipRuleActionParametersPhase = "http_request_firewall_custom" - SkipRuleActionParametersPhaseHTTPRequestFirewallManaged SkipRuleActionParametersPhase = "http_request_firewall_managed" - SkipRuleActionParametersPhaseHTTPRequestLateTransform SkipRuleActionParametersPhase = "http_request_late_transform" - SkipRuleActionParametersPhaseHTTPRequestOrigin SkipRuleActionParametersPhase = "http_request_origin" - SkipRuleActionParametersPhaseHTTPRequestRedirect SkipRuleActionParametersPhase = "http_request_redirect" - SkipRuleActionParametersPhaseHTTPRequestSanitize SkipRuleActionParametersPhase = "http_request_sanitize" - SkipRuleActionParametersPhaseHTTPRequestSbfm SkipRuleActionParametersPhase = "http_request_sbfm" - SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration SkipRuleActionParametersPhase = "http_request_select_configuration" - SkipRuleActionParametersPhaseHTTPRequestTransform SkipRuleActionParametersPhase = "http_request_transform" - SkipRuleActionParametersPhaseHTTPResponseCompression SkipRuleActionParametersPhase = "http_response_compression" - SkipRuleActionParametersPhaseHTTPResponseFirewallManaged SkipRuleActionParametersPhase = "http_response_firewall_managed" - SkipRuleActionParametersPhaseHTTPResponseHeadersTransform SkipRuleActionParametersPhase = "http_response_headers_transform" - SkipRuleActionParametersPhaseMagicTransit SkipRuleActionParametersPhase = "magic_transit" - SkipRuleActionParametersPhaseMagicTransitIDsManaged SkipRuleActionParametersPhase = "magic_transit_ids_managed" - SkipRuleActionParametersPhaseMagicTransitManaged SkipRuleActionParametersPhase = "magic_transit_managed" -) +func (r RedirectRule) implementsRulesetsRulesetUpdateResponseRule() {} -func (r SkipRuleActionParametersPhase) IsKnown() bool { - switch r { - case SkipRuleActionParametersPhaseDDoSL4, SkipRuleActionParametersPhaseDDoSL7, SkipRuleActionParametersPhaseHTTPConfigSettings, SkipRuleActionParametersPhaseHTTPCustomErrors, SkipRuleActionParametersPhaseHTTPLogCustomFields, SkipRuleActionParametersPhaseHTTPRatelimit, SkipRuleActionParametersPhaseHTTPRequestCacheSettings, SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, SkipRuleActionParametersPhaseHTTPRequestFirewallCustom, SkipRuleActionParametersPhaseHTTPRequestFirewallManaged, SkipRuleActionParametersPhaseHTTPRequestLateTransform, SkipRuleActionParametersPhaseHTTPRequestOrigin, SkipRuleActionParametersPhaseHTTPRequestRedirect, SkipRuleActionParametersPhaseHTTPRequestSanitize, SkipRuleActionParametersPhaseHTTPRequestSbfm, SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, SkipRuleActionParametersPhaseHTTPRequestTransform, SkipRuleActionParametersPhaseHTTPResponseCompression, SkipRuleActionParametersPhaseHTTPResponseFirewallManaged, SkipRuleActionParametersPhaseHTTPResponseHeadersTransform, SkipRuleActionParametersPhaseMagicTransit, SkipRuleActionParametersPhaseMagicTransitIDsManaged, SkipRuleActionParametersPhaseMagicTransitManaged: - return true - } - return false -} +func (r RedirectRule) implementsRulesetsRulesetGetResponseRule() {} -// The name of a legacy security product to skip the execution of. -type SkipRuleActionParametersProduct string +func (r RedirectRule) implementsRulesetsPhaseUpdateResponseRule() {} -const ( - SkipRuleActionParametersProductBic SkipRuleActionParametersProduct = "bic" - SkipRuleActionParametersProductHot SkipRuleActionParametersProduct = "hot" - SkipRuleActionParametersProductRateLimit SkipRuleActionParametersProduct = "rateLimit" - SkipRuleActionParametersProductSecurityLevel SkipRuleActionParametersProduct = "securityLevel" - SkipRuleActionParametersProductUABlock SkipRuleActionParametersProduct = "uaBlock" - SkipRuleActionParametersProductWAF SkipRuleActionParametersProduct = "waf" - SkipRuleActionParametersProductZoneLockdown SkipRuleActionParametersProduct = "zoneLockdown" -) +func (r RedirectRule) implementsRulesetsPhaseGetResponseRule() {} -func (r SkipRuleActionParametersProduct) IsKnown() bool { - switch r { - case SkipRuleActionParametersProductBic, SkipRuleActionParametersProductHot, SkipRuleActionParametersProductRateLimit, SkipRuleActionParametersProductSecurityLevel, SkipRuleActionParametersProductUABlock, SkipRuleActionParametersProductWAF, SkipRuleActionParametersProductZoneLockdown: - return true - } - return false -} +func (r RedirectRule) implementsRulesetsPhaseVersionGetResponseRule() {} -// A ruleset to skip the execution of. This option is incompatible with the -// rulesets, rules and phases options. -type SkipRuleActionParametersRuleset string +func (r RedirectRule) implementsRulesetsRuleNewResponseRule() {} + +func (r RedirectRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r RedirectRule) implementsRulesetsRuleEditResponseRule() {} + +func (r RedirectRule) implementsRulesetsVersionGetResponseRule() {} + +func (r RedirectRule) implementsRulesetsVersionByTagGetResponseRule() {} + +// The action to perform when the rule matches. +type RedirectRuleAction string const ( - SkipRuleActionParametersRulesetCurrent SkipRuleActionParametersRuleset = "current" + RedirectRuleActionRedirect RedirectRuleAction = "redirect" ) -func (r SkipRuleActionParametersRuleset) IsKnown() bool { +func (r RedirectRuleAction) IsKnown() bool { switch r { - case SkipRuleActionParametersRulesetCurrent: + case RedirectRuleActionRedirect: return true } return false } -type SkipRuleParam struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[SkipRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[SkipRuleActionParametersParam] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` +// The parameters configuring the rule's action. +type RedirectRuleActionParameters struct { + // Serve a redirect based on a bulk list lookup. + FromList RedirectRuleActionParametersFromList `json:"from_list"` + // Serve a redirect based on the request properties. + FromValue RedirectRuleActionParametersFromValue `json:"from_value"` + JSON redirectRuleActionParametersJSON `json:"-"` } -func (r SkipRuleParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// redirectRuleActionParametersJSON contains the JSON metadata for the struct +// [RedirectRuleActionParameters] +type redirectRuleActionParametersJSON struct { + FromList apijson.Field + FromValue apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r SkipRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} - -func (r SkipRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} - -func (r SkipRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} - -// The parameters configuring the rule's action. -type SkipRuleActionParametersParam struct { - // A list of phases to skip the execution of. This option is incompatible with the - // ruleset and rulesets options. - Phases param.Field[[]SkipRuleActionParametersPhase] `json:"phases"` - // A list of legacy security products to skip the execution of. - Products param.Field[[]SkipRuleActionParametersProduct] `json:"products"` - // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the - // execution of. This option is incompatible with the ruleset option. - Rules param.Field[map[string][]string] `json:"rules"` - // A ruleset to skip the execution of. This option is incompatible with the - // rulesets, rules and phases options. - Ruleset param.Field[SkipRuleActionParametersRuleset] `json:"ruleset"` - // A list of ruleset IDs to skip the execution of. This option is incompatible with - // the ruleset and phases options. - Rulesets param.Field[[]string] `json:"rulesets"` +func (r *RedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r SkipRuleActionParametersParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r redirectRuleActionParametersJSON) RawJSON() string { + return r.raw } -// A ruleset object. -type RuleNewResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind RuleNewResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase RuleNewResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []RuleNewResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON ruleNewResponseJSON `json:"-"` +// Serve a redirect based on a bulk list lookup. +type RedirectRuleActionParametersFromList struct { + // Expression that evaluates to the list lookup key. + Key string `json:"key"` + // The name of the list to match against. + Name string `json:"name"` + JSON redirectRuleActionParametersFromListJSON `json:"-"` } -// ruleNewResponseJSON contains the JSON metadata for the struct [RuleNewResponse] -type ruleNewResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field +// redirectRuleActionParametersFromListJSON contains the JSON metadata for the +// struct [RedirectRuleActionParametersFromList] +type redirectRuleActionParametersFromListJSON struct { + Key apijson.Field Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponse) UnmarshalJSON(data []byte) (err error) { +func (r *RedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseJSON) RawJSON() string { +func (r redirectRuleActionParametersFromListJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RuleNewResponseKind string +// Serve a redirect based on the request properties. +type RedirectRuleActionParametersFromValue struct { + // Keep the query string of the original request. + PreserveQueryString bool `json:"preserve_query_string"` + // The status code to be used for the redirect. + StatusCode RedirectRuleActionParametersFromValueStatusCode `json:"status_code"` + // The URL to redirect the request to. + TargetURL RedirectRuleActionParametersFromValueTargetURL `json:"target_url"` + JSON redirectRuleActionParametersFromValueJSON `json:"-"` +} -const ( - RuleNewResponseKindManaged RuleNewResponseKind = "managed" - RuleNewResponseKindCustom RuleNewResponseKind = "custom" - RuleNewResponseKindRoot RuleNewResponseKind = "root" - RuleNewResponseKindZone RuleNewResponseKind = "zone" -) +// redirectRuleActionParametersFromValueJSON contains the JSON metadata for the +// struct [RedirectRuleActionParametersFromValue] +type redirectRuleActionParametersFromValueJSON struct { + PreserveQueryString apijson.Field + StatusCode apijson.Field + TargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r RuleNewResponseKind) IsKnown() bool { - switch r { - case RuleNewResponseKindManaged, RuleNewResponseKindCustom, RuleNewResponseKindRoot, RuleNewResponseKindZone: - return true - } - return false +func (r *RedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -// The phase of the ruleset. -type RuleNewResponsePhase string +func (r redirectRuleActionParametersFromValueJSON) RawJSON() string { + return r.raw +} + +// The status code to be used for the redirect. +type RedirectRuleActionParametersFromValueStatusCode float64 const ( - RuleNewResponsePhaseDDoSL4 RuleNewResponsePhase = "ddos_l4" - RuleNewResponsePhaseDDoSL7 RuleNewResponsePhase = "ddos_l7" - RuleNewResponsePhaseHTTPConfigSettings RuleNewResponsePhase = "http_config_settings" - RuleNewResponsePhaseHTTPCustomErrors RuleNewResponsePhase = "http_custom_errors" - RuleNewResponsePhaseHTTPLogCustomFields RuleNewResponsePhase = "http_log_custom_fields" - RuleNewResponsePhaseHTTPRatelimit RuleNewResponsePhase = "http_ratelimit" - RuleNewResponsePhaseHTTPRequestCacheSettings RuleNewResponsePhase = "http_request_cache_settings" - RuleNewResponsePhaseHTTPRequestDynamicRedirect RuleNewResponsePhase = "http_request_dynamic_redirect" - RuleNewResponsePhaseHTTPRequestFirewallCustom RuleNewResponsePhase = "http_request_firewall_custom" - RuleNewResponsePhaseHTTPRequestFirewallManaged RuleNewResponsePhase = "http_request_firewall_managed" - RuleNewResponsePhaseHTTPRequestLateTransform RuleNewResponsePhase = "http_request_late_transform" - RuleNewResponsePhaseHTTPRequestOrigin RuleNewResponsePhase = "http_request_origin" - RuleNewResponsePhaseHTTPRequestRedirect RuleNewResponsePhase = "http_request_redirect" - RuleNewResponsePhaseHTTPRequestSanitize RuleNewResponsePhase = "http_request_sanitize" - RuleNewResponsePhaseHTTPRequestSbfm RuleNewResponsePhase = "http_request_sbfm" - RuleNewResponsePhaseHTTPRequestSelectConfiguration RuleNewResponsePhase = "http_request_select_configuration" - RuleNewResponsePhaseHTTPRequestTransform RuleNewResponsePhase = "http_request_transform" - RuleNewResponsePhaseHTTPResponseCompression RuleNewResponsePhase = "http_response_compression" - RuleNewResponsePhaseHTTPResponseFirewallManaged RuleNewResponsePhase = "http_response_firewall_managed" - RuleNewResponsePhaseHTTPResponseHeadersTransform RuleNewResponsePhase = "http_response_headers_transform" - RuleNewResponsePhaseMagicTransit RuleNewResponsePhase = "magic_transit" - RuleNewResponsePhaseMagicTransitIDsManaged RuleNewResponsePhase = "magic_transit_ids_managed" - RuleNewResponsePhaseMagicTransitManaged RuleNewResponsePhase = "magic_transit_managed" + RedirectRuleActionParametersFromValueStatusCode301 RedirectRuleActionParametersFromValueStatusCode = 301 + RedirectRuleActionParametersFromValueStatusCode302 RedirectRuleActionParametersFromValueStatusCode = 302 + RedirectRuleActionParametersFromValueStatusCode303 RedirectRuleActionParametersFromValueStatusCode = 303 + RedirectRuleActionParametersFromValueStatusCode307 RedirectRuleActionParametersFromValueStatusCode = 307 + RedirectRuleActionParametersFromValueStatusCode308 RedirectRuleActionParametersFromValueStatusCode = 308 ) -func (r RuleNewResponsePhase) IsKnown() bool { +func (r RedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { switch r { - case RuleNewResponsePhaseDDoSL4, RuleNewResponsePhaseDDoSL7, RuleNewResponsePhaseHTTPConfigSettings, RuleNewResponsePhaseHTTPCustomErrors, RuleNewResponsePhaseHTTPLogCustomFields, RuleNewResponsePhaseHTTPRatelimit, RuleNewResponsePhaseHTTPRequestCacheSettings, RuleNewResponsePhaseHTTPRequestDynamicRedirect, RuleNewResponsePhaseHTTPRequestFirewallCustom, RuleNewResponsePhaseHTTPRequestFirewallManaged, RuleNewResponsePhaseHTTPRequestLateTransform, RuleNewResponsePhaseHTTPRequestOrigin, RuleNewResponsePhaseHTTPRequestRedirect, RuleNewResponsePhaseHTTPRequestSanitize, RuleNewResponsePhaseHTTPRequestSbfm, RuleNewResponsePhaseHTTPRequestSelectConfiguration, RuleNewResponsePhaseHTTPRequestTransform, RuleNewResponsePhaseHTTPResponseCompression, RuleNewResponsePhaseHTTPResponseFirewallManaged, RuleNewResponsePhaseHTTPResponseHeadersTransform, RuleNewResponsePhaseMagicTransit, RuleNewResponsePhaseMagicTransitIDsManaged, RuleNewResponsePhaseMagicTransitManaged: + case RedirectRuleActionParametersFromValueStatusCode301, RedirectRuleActionParametersFromValueStatusCode302, RedirectRuleActionParametersFromValueStatusCode303, RedirectRuleActionParametersFromValueStatusCode307, RedirectRuleActionParametersFromValueStatusCode308: return true } return false } -type RuleNewResponseRule struct { - // The action to perform when the rule matches. - Action RuleNewResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON ruleNewResponseRuleJSON `json:"-"` - union RuleNewResponseRulesUnion +// The URL to redirect the request to. +type RedirectRuleActionParametersFromValueTargetURL struct { + // The URL to redirect the request to. + Value string `json:"value"` + // An expression to evaluate to get the URL to redirect the request to. + Expression string `json:"expression"` + JSON redirectRuleActionParametersFromValueTargetURLJSON `json:"-"` + union RedirectRuleActionParametersFromValueTargetURLUnion } -// ruleNewResponseRuleJSON contains the JSON metadata for the struct -// [RuleNewResponseRule] -type ruleNewResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field +// redirectRuleActionParametersFromValueTargetURLJSON contains the JSON metadata +// for the struct [RedirectRuleActionParametersFromValueTargetURL] +type redirectRuleActionParametersFromValueTargetURLJSON struct { + Value apijson.Field + Expression apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r ruleNewResponseRuleJSON) RawJSON() string { +func (r redirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { return r.raw } -func (r *RuleNewResponseRule) UnmarshalJSON(data []byte) (err error) { +func (r *RedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { err = apijson.UnmarshalRoot(data, &r.union) if err != nil { return err @@ -1257,314 +1626,203 @@ func (r *RuleNewResponseRule) UnmarshalJSON(data []byte) (err error) { return apijson.Port(r.union, &r) } -func (r RuleNewResponseRule) AsUnion() RuleNewResponseRulesUnion { +func (r RedirectRuleActionParametersFromValueTargetURL) AsUnion() RedirectRuleActionParametersFromValueTargetURLUnion { return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RuleNewResponseRulesRulesetsChallengeRule], -// [rulesets.RuleNewResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], [rulesets.RuleNewResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], [rulesets.RuleNewResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RuleNewResponseRulesRulesetsRedirectRule], -// [rulesets.RuleNewResponseRulesRulesetsRewriteRule], -// [rulesets.RuleNewResponseRulesRulesetsRouteRule], -// [rulesets.RuleNewResponseRulesRulesetsScoreRule], -// [rulesets.RuleNewResponseRulesRulesetsServeErrorRule], -// [rulesets.RuleNewResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.RuleNewResponseRulesRulesetsSetCacheSettingsRule]. -type RuleNewResponseRulesUnion interface { - implementsRulesetsRuleNewResponseRule() +// The URL to redirect the request to. +// +// Union satisfied by +// [rulesets.RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] or +// [rulesets.RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. +type RedirectRuleActionParametersFromValueTargetURLUnion interface { + implementsRulesetsRedirectRuleActionParametersFromValueTargetURL() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*RuleNewResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, + reflect.TypeOf((*RedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), + "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), }, ) } -type RuleNewResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsChallengeRuleJSON `json:"-"` +type RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { + // The URL to redirect the request to. + Value string `json:"value"` + JSON redirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` } -// ruleNewResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsChallengeRule] -type ruleNewResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// redirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON contains the +// JSON metadata for the struct +// [RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] +type redirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { +func (r *RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { +func (r redirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsChallengeRule) implementsRulesetsRuleNewResponseRule() {} +func (r RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRedirectRuleActionParametersFromValueTargetURL() { +} -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsChallengeRuleAction string +type RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { + // An expression to evaluate to get the URL to redirect the request to. + Expression string `json:"expression"` + JSON redirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` +} -const ( - RuleNewResponseRulesRulesetsChallengeRuleActionChallenge RuleNewResponseRulesRulesetsChallengeRuleAction = "challenge" -) +// redirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON contains +// the JSON metadata for the struct +// [RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] +type redirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { + Expression apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r RuleNewResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false +func (r *RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -type RuleNewResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` +func (r redirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { + return r.raw +} + +func (r RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRedirectRuleActionParametersFromValueTargetURL() { +} + +type RedirectRuleParam struct { // The unique ID of the rule. - ID string `json:"id"` + ID param.Field[string] `json:"id"` // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsCompressResponseRuleAction `json:"action"` + Action param.Field[RedirectRuleAction] `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + ActionParameters param.Field[RedirectRuleActionParametersParam] `json:"action_parameters"` // An informative description of the rule. - Description string `json:"description"` + Description param.Field[string] `json:"description"` // Whether the rule should be executed. - Enabled bool `json:"enabled"` + Enabled param.Field[bool] `json:"enabled"` // The expression defining which traffic will match the rule. - Expression string `json:"expression"` + Expression param.Field[string] `json:"expression"` // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` + Ref param.Field[string] `json:"ref"` } -// ruleNewResponseRulesRulesetsCompressResponseRuleJSON contains the JSON metadata -// for the struct [RuleNewResponseRulesRulesetsCompressResponseRule] -type ruleNewResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r RedirectRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *RuleNewResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r RedirectRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} -func (r ruleNewResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw +func (r RedirectRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r RedirectRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type RedirectRuleActionParametersParam struct { + // Serve a redirect based on a bulk list lookup. + FromList param.Field[RedirectRuleActionParametersFromListParam] `json:"from_list"` + // Serve a redirect based on the request properties. + FromValue param.Field[RedirectRuleActionParametersFromValueParam] `json:"from_value"` } -func (r RuleNewResponseRulesRulesetsCompressResponseRule) implementsRulesetsRuleNewResponseRule() {} +func (r RedirectRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsCompressResponseRuleAction string +// Serve a redirect based on a bulk list lookup. +type RedirectRuleActionParametersFromListParam struct { + // Expression that evaluates to the list lookup key. + Key param.Field[string] `json:"key"` + // The name of the list to match against. + Name param.Field[string] `json:"name"` +} -const ( - RuleNewResponseRulesRulesetsCompressResponseRuleActionCompressResponse RuleNewResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) +func (r RedirectRuleActionParametersFromListParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r RuleNewResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false +// Serve a redirect based on the request properties. +type RedirectRuleActionParametersFromValueParam struct { + // Keep the query string of the original request. + PreserveQueryString param.Field[bool] `json:"preserve_query_string"` + // The status code to be used for the redirect. + StatusCode param.Field[RedirectRuleActionParametersFromValueStatusCode] `json:"status_code"` + // The URL to redirect the request to. + TargetURL param.Field[RedirectRuleActionParametersFromValueTargetURLUnionParam] `json:"target_url"` } -// The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` +func (r RedirectRuleActionParametersFromValueParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsCompressResponseRuleActionParameters] -type ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field +// The URL to redirect the request to. +type RedirectRuleActionParametersFromValueTargetURLParam struct { + // The URL to redirect the request to. + Value param.Field[string] `json:"value"` + // An expression to evaluate to get the URL to redirect the request to. + Expression param.Field[string] `json:"expression"` } -func (r *RuleNewResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RedirectRuleActionParametersFromValueTargetURLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw +func (r RedirectRuleActionParametersFromValueTargetURLParam) implementsRulesetsRedirectRuleActionParametersFromValueTargetURLUnionParam() { } -// Compression algorithm to enable. -type RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` +// The URL to redirect the request to. +// +// Satisfied by +// [rulesets.RedirectRuleActionParametersFromValueTargetURLStaticURLRedirectParam], +// [rulesets.RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectParam], +// [RedirectRuleActionParametersFromValueTargetURLParam]. +type RedirectRuleActionParametersFromValueTargetURLUnionParam interface { + implementsRulesetsRedirectRuleActionParametersFromValueTargetURLUnionParam() } -// ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field +type RedirectRuleActionParametersFromValueTargetURLStaticURLRedirectParam struct { + // The URL to redirect the request to. + Value param.Field[string] `json:"value"` } -func (r *RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RedirectRuleActionParametersFromValueTargetURLStaticURLRedirectParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw +func (r RedirectRuleActionParametersFromValueTargetURLStaticURLRedirectParam) implementsRulesetsRedirectRuleActionParametersFromValueTargetURLUnionParam() { } -// Name of compression algorithm to enable. -type RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string +type RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectParam struct { + // An expression to evaluate to get the URL to redirect the request to. + Expression param.Field[string] `json:"expression"` +} -const ( - RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) +func (r RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RuleNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false +func (r RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectParam) implementsRulesetsRedirectRuleActionParametersFromValueTargetURLUnionParam() { } -type RuleNewResponseRulesRulesetsJsChallengeRule struct { +type RewriteRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -1572,9 +1830,9 @@ type RuleNewResponseRulesRulesetsJsChallengeRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsJsChallengeRuleAction `json:"action"` + Action RewriteRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` + ActionParameters RewriteRuleActionParameters `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -1586,13 +1844,12 @@ type RuleNewResponseRulesRulesetsJsChallengeRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON rewriteRuleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata for -// the struct [RuleNewResponseRulesRulesetsJsChallengeRule] -type ruleNewResponseRulesRulesetsJsChallengeRuleJSON struct { +// rewriteRuleJSON contains the JSON metadata for the struct [RewriteRule] +type rewriteRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -1608,297 +1865,447 @@ type ruleNewResponseRulesRulesetsJsChallengeRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { +func (r rewriteRuleJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsJsChallengeRule) implementsRulesetsRuleNewResponseRule() {} +func (r RewriteRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r RewriteRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r RewriteRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r RewriteRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r RewriteRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r RewriteRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r RewriteRule) implementsRulesetsRuleNewResponseRule() {} + +func (r RewriteRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r RewriteRule) implementsRulesetsRuleEditResponseRule() {} + +func (r RewriteRule) implementsRulesetsVersionGetResponseRule() {} + +func (r RewriteRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsJsChallengeRuleAction string +type RewriteRuleAction string const ( - RuleNewResponseRulesRulesetsJsChallengeRuleActionJsChallenge RuleNewResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" + RewriteRuleActionRewrite RewriteRuleAction = "rewrite" ) -func (r RuleNewResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { +func (r RewriteRuleAction) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsJsChallengeRuleActionJsChallenge: + case RewriteRuleActionRewrite: return true } return false } -type RuleNewResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` +// The parameters configuring the rule's action. +type RewriteRuleActionParameters struct { + // Map of request headers to modify. + Headers map[string]RewriteRuleActionParametersHeader `json:"headers"` + // URI to rewrite the request to. + URI RewriteRuleActionParametersURI `json:"uri"` + JSON rewriteRuleActionParametersJSON `json:"-"` } -// ruleNewResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON metadata -// for the struct [RuleNewResponseRulesRulesetsManagedChallengeRule] -type ruleNewResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// rewriteRuleActionParametersJSON contains the JSON metadata for the struct +// [RewriteRuleActionParameters] +type rewriteRuleActionParametersJSON struct { + Headers apijson.Field + URI apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { +func (r rewriteRuleActionParametersJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRuleNewResponseRule() {} - -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsManagedChallengeRuleAction string +// Remove the header from the request. +type RewriteRuleActionParametersHeader struct { + Operation RewriteRuleActionParametersHeadersOperation `json:"operation,required"` + // Static value for the header. + Value string `json:"value"` + // Expression for the header value. + Expression string `json:"expression"` + JSON rewriteRuleActionParametersHeaderJSON `json:"-"` + union RewriteRuleActionParametersHeadersUnion +} + +// rewriteRuleActionParametersHeaderJSON contains the JSON metadata for the struct +// [RewriteRuleActionParametersHeader] +type rewriteRuleActionParametersHeaderJSON struct { + Operation apijson.Field + Value apijson.Field + Expression apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r rewriteRuleActionParametersHeaderJSON) RawJSON() string { + return r.raw +} + +func (r *RewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) +} + +func (r RewriteRuleActionParametersHeader) AsUnion() RewriteRuleActionParametersHeadersUnion { + return r.union +} + +// Remove the header from the request. +// +// Union satisfied by [rulesets.RewriteRuleActionParametersHeadersRemoveHeader], +// [rulesets.RewriteRuleActionParametersHeadersStaticHeader] or +// [rulesets.RewriteRuleActionParametersHeadersDynamicHeader]. +type RewriteRuleActionParametersHeadersUnion interface { + implementsRulesetsRewriteRuleActionParametersHeader() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RewriteRuleActionParametersHeadersUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRuleActionParametersHeadersRemoveHeader{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRuleActionParametersHeadersStaticHeader{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRuleActionParametersHeadersDynamicHeader{}), + }, + ) +} + +// Remove the header from the request. +type RewriteRuleActionParametersHeadersRemoveHeader struct { + Operation RewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` + JSON rewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` +} + +// rewriteRuleActionParametersHeadersRemoveHeaderJSON contains the JSON metadata +// for the struct [RewriteRuleActionParametersHeadersRemoveHeader] +type rewriteRuleActionParametersHeadersRemoveHeaderJSON struct { + Operation apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r rewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { + return r.raw +} + +func (r RewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRewriteRuleActionParametersHeader() { +} + +type RewriteRuleActionParametersHeadersRemoveHeaderOperation string const ( - RuleNewResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RuleNewResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" + RewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" ) -func (r RuleNewResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { +func (r RewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: + case RewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: return true } return false } -type RuleNewResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsRedirectRuleJSON `json:"-"` +// Set a request header with a static value. +type RewriteRuleActionParametersHeadersStaticHeader struct { + Operation RewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` + // Static value for the header. + Value string `json:"value,required"` + JSON rewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsRedirectRule] -type ruleNewResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// rewriteRuleActionParametersHeadersStaticHeaderJSON contains the JSON metadata +// for the struct [RewriteRuleActionParametersHeadersStaticHeader] +type rewriteRuleActionParametersHeadersStaticHeaderJSON struct { + Operation apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { +func (r rewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRedirectRule) implementsRulesetsRuleNewResponseRule() {} +func (r RewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRewriteRuleActionParametersHeader() { +} -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsRedirectRuleAction string +type RewriteRuleActionParametersHeadersStaticHeaderOperation string const ( - RuleNewResponseRulesRulesetsRedirectRuleActionRedirect RuleNewResponseRulesRulesetsRedirectRuleAction = "redirect" + RewriteRuleActionParametersHeadersStaticHeaderOperationSet RewriteRuleActionParametersHeadersStaticHeaderOperation = "set" ) -func (r RuleNewResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { +func (r RewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsRedirectRuleActionRedirect: + case RewriteRuleActionParametersHeadersStaticHeaderOperationSet: return true } return false } -// The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` +// Set a request header with a dynamic value. +type RewriteRuleActionParametersHeadersDynamicHeader struct { + // Expression for the header value. + Expression string `json:"expression,required"` + Operation RewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` + JSON rewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParameters] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field +// rewriteRuleActionParametersHeadersDynamicHeaderJSON contains the JSON metadata +// for the struct [RewriteRuleActionParametersHeadersDynamicHeader] +type rewriteRuleActionParametersHeadersDynamicHeaderJSON struct { + Expression apijson.Field + Operation apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { +func (r rewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { return r.raw } -// Serve a redirect based on a bulk list lookup. -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` +func (r RewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRewriteRuleActionParametersHeader() { } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromList] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field +type RewriteRuleActionParametersHeadersDynamicHeaderOperation string + +const ( + RewriteRuleActionParametersHeadersDynamicHeaderOperationSet RewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" +) + +func (r RewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { + switch r { + case RewriteRuleActionParametersHeadersDynamicHeaderOperationSet: + return true + } + return false +} + +type RewriteRuleActionParametersHeadersOperation string + +const ( + RewriteRuleActionParametersHeadersOperationRemove RewriteRuleActionParametersHeadersOperation = "remove" + RewriteRuleActionParametersHeadersOperationSet RewriteRuleActionParametersHeadersOperation = "set" +) + +func (r RewriteRuleActionParametersHeadersOperation) IsKnown() bool { + switch r { + case RewriteRuleActionParametersHeadersOperationRemove, RewriteRuleActionParametersHeadersOperationSet: + return true + } + return false +} + +// URI to rewrite the request to. +type RewriteRuleActionParametersURI struct { + // Path portion rewrite. + Path RewriteURIPart `json:"path"` + // Query portion rewrite. + Query RewriteURIPart `json:"query"` + JSON rewriteRuleActionParametersURIJSON `json:"-"` +} + +// rewriteRuleActionParametersURIJSON contains the JSON metadata for the struct +// [RewriteRuleActionParametersURI] +type rewriteRuleActionParametersURIJSON struct { + Path apijson.Field + Query apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { +func (r rewriteRuleActionParametersURIJSON) RawJSON() string { return r.raw } -// Serve a redirect based on the request properties. -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` +type RewriteRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RewriteRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RewriteRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON contains -// the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r RewriteRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RewriteRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r RewriteRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r RewriteRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type RewriteRuleActionParametersParam struct { + // Map of request headers to modify. + Headers param.Field[map[string]RewriteRuleActionParametersHeadersUnionParam] `json:"headers"` + // URI to rewrite the request to. + URI param.Field[RewriteRuleActionParametersURIParam] `json:"uri"` } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw +func (r RewriteRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The status code to be used for the redirect. -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 +// Remove the header from the request. +type RewriteRuleActionParametersHeaderParam struct { + Operation param.Field[RewriteRuleActionParametersHeadersOperation] `json:"operation,required"` + // Static value for the header. + Value param.Field[string] `json:"value"` + // Expression for the header value. + Expression param.Field[string] `json:"expression"` +} -const ( - RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) +func (r RewriteRuleActionParametersHeaderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false +func (r RewriteRuleActionParametersHeaderParam) implementsRulesetsRewriteRuleActionParametersHeadersUnionParam() { } -// The URL to redirect the request to. -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. +// Remove the header from the request. +// +// Satisfied by [rulesets.RewriteRuleActionParametersHeadersRemoveHeaderParam], +// [rulesets.RewriteRuleActionParametersHeadersStaticHeaderParam], +// [rulesets.RewriteRuleActionParametersHeadersDynamicHeaderParam], +// [RewriteRuleActionParametersHeaderParam]. +type RewriteRuleActionParametersHeadersUnionParam interface { + implementsRulesetsRewriteRuleActionParametersHeadersUnionParam() +} + +// Remove the header from the request. +type RewriteRuleActionParametersHeadersRemoveHeaderParam struct { + Operation param.Field[RewriteRuleActionParametersHeadersRemoveHeaderOperation] `json:"operation,required"` +} + +func (r RewriteRuleActionParametersHeadersRemoveHeaderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteRuleActionParametersHeadersRemoveHeaderParam) implementsRulesetsRewriteRuleActionParametersHeadersUnionParam() { +} + +// Set a request header with a static value. +type RewriteRuleActionParametersHeadersStaticHeaderParam struct { + Operation param.Field[RewriteRuleActionParametersHeadersStaticHeaderOperation] `json:"operation,required"` + // Static value for the header. + Value param.Field[string] `json:"value,required"` +} + +func (r RewriteRuleActionParametersHeadersStaticHeaderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteRuleActionParametersHeadersStaticHeaderParam) implementsRulesetsRewriteRuleActionParametersHeadersUnionParam() { +} + +// Set a request header with a dynamic value. +type RewriteRuleActionParametersHeadersDynamicHeaderParam struct { + // Expression for the header value. + Expression param.Field[string] `json:"expression,required"` + Operation param.Field[RewriteRuleActionParametersHeadersDynamicHeaderOperation] `json:"operation,required"` +} + +func (r RewriteRuleActionParametersHeadersDynamicHeaderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteRuleActionParametersHeadersDynamicHeaderParam) implementsRulesetsRewriteRuleActionParametersHeadersUnionParam() { +} + +// URI to rewrite the request to. +type RewriteRuleActionParametersURIParam struct { + // Path portion rewrite. + Path param.Field[RewriteURIPartUnionParam] `json:"path"` + // Query portion rewrite. + Query param.Field[RewriteURIPartUnionParam] `json:"query"` +} + +func (r RewriteRuleActionParametersURIParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RewriteURIPart struct { + // Predefined replacement value. Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion + // Expression to evaluate for the replacement value. + Expression string `json:"expression"` + JSON rewriteURIPartJSON `json:"-"` + union RewriteURIPartUnion } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { +// rewriteURIPartJSON contains the JSON metadata for the struct [RewriteURIPart] +type rewriteURIPartJSON struct { Value apijson.Field Expression apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { +func (r rewriteURIPartJSON) RawJSON() string { return r.raw } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteURIPart) UnmarshalJSON(data []byte) (err error) { err = apijson.UnmarshalRoot(data, &r.union) if err != nil { return err @@ -1906,99 +2313,132 @@ func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTarget return apijson.Port(r.union, &r) } -func (r RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { +func (r RewriteURIPart) AsUnion() RewriteURIPartUnion { return r.union } -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() +// Union satisfied by [rulesets.RewriteURIPartStaticValue] or +// [rulesets.RewriteURIPartDynamicValue]. +type RewriteURIPartUnion interface { + implementsRulesetsRewriteURIPart() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), + reflect.TypeOf((*RewriteURIPartUnion)(nil)).Elem(), "", apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), + Type: reflect.TypeOf(RewriteURIPartStaticValue{}), }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), + Type: reflect.TypeOf(RewriteURIPartDynamicValue{}), }, ) } -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` +type RewriteURIPartStaticValue struct { + // Predefined replacement value. + Value string `json:"value,required"` + JSON rewriteURIPartStaticValueJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { +// rewriteURIPartStaticValueJSON contains the JSON metadata for the struct +// [RewriteURIPartStaticValue] +type rewriteURIPartStaticValueJSON struct { Value apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteURIPartStaticValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { +func (r rewriteURIPartStaticValueJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} +func (r RewriteURIPartStaticValue) implementsRulesetsRewriteURIPart() {} -type RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` +type RewriteURIPartDynamicValue struct { + // Expression to evaluate for the replacement value. + Expression string `json:"expression,required"` + JSON rewriteURIPartDynamicValueJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { +// rewriteURIPartDynamicValueJSON contains the JSON metadata for the struct +// [RewriteURIPartDynamicValue] +type rewriteURIPartDynamicValueJSON struct { Expression apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { +func (r *RewriteURIPartDynamicValue) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { +func (r rewriteURIPartDynamicValueJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRuleNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { +func (r RewriteURIPartDynamicValue) implementsRulesetsRewriteURIPart() {} + +type RewriteURIPartParam struct { + // Predefined replacement value. + Value param.Field[string] `json:"value"` + // Expression to evaluate for the replacement value. + Expression param.Field[string] `json:"expression"` } -type RuleNewResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. +func (r RewriteURIPartParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteURIPartParam) implementsRulesetsRewriteURIPartUnionParam() {} + +// Satisfied by [rulesets.RewriteURIPartStaticValueParam], +// [rulesets.RewriteURIPartDynamicValueParam], [RewriteURIPartParam]. +type RewriteURIPartUnionParam interface { + implementsRulesetsRewriteURIPartUnionParam() +} + +type RewriteURIPartStaticValueParam struct { + // Predefined replacement value. + Value param.Field[string] `json:"value,required"` +} + +func (r RewriteURIPartStaticValueParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteURIPartStaticValueParam) implementsRulesetsRewriteURIPartUnionParam() {} + +type RewriteURIPartDynamicValueParam struct { + // Expression to evaluate for the replacement value. + Expression param.Field[string] `json:"expression,required"` +} + +func (r RewriteURIPartDynamicValueParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RewriteURIPartDynamicValueParam) implementsRulesetsRewriteURIPartUnionParam() {} + +type RouteRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action RouteRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters RouteRuleActionParameters `json:"action_parameters"` + // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. Description string `json:"description"` @@ -2009,13 +2449,12 @@ type RuleNewResponseRulesRulesetsRewriteRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsRewriteRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON routeRuleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsRewriteRule] -type ruleNewResponseRulesRulesetsRewriteRuleJSON struct { +// routeRuleJSON contains the JSON metadata for the struct [RouteRule] +type routeRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -2031,521 +2470,347 @@ type ruleNewResponseRulesRulesetsRewriteRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { +func (r *RouteRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { +func (r routeRuleJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRewriteRule) implementsRulesetsRuleNewResponseRule() {} +func (r RouteRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r RouteRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r RouteRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r RouteRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r RouteRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r RouteRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r RouteRule) implementsRulesetsRuleNewResponseRule() {} + +func (r RouteRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r RouteRule) implementsRulesetsRuleEditResponseRule() {} + +func (r RouteRule) implementsRulesetsVersionGetResponseRule() {} + +func (r RouteRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsRewriteRuleAction string +type RouteRuleAction string const ( - RuleNewResponseRulesRulesetsRewriteRuleActionRewrite RuleNewResponseRulesRulesetsRewriteRuleAction = "rewrite" + RouteRuleActionRoute RouteRuleAction = "route" ) -func (r RuleNewResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { +func (r RouteRuleAction) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsRewriteRuleActionRewrite: + case RouteRuleActionRoute: return true } return false } // The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RuleNewResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` +type RouteRuleActionParameters struct { + // Rewrite the HTTP Host header. + HostHeader string `json:"host_header"` + // Override the IP/TCP destination. + Origin RouteRuleActionParametersOrigin `json:"origin"` + // Override the Server Name Indication (SNI). + Sni RouteRuleActionParametersSni `json:"sni"` + JSON routeRuleActionParametersJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParameters] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field +// routeRuleActionParametersJSON contains the JSON metadata for the struct +// [RouteRuleActionParameters] +type routeRuleActionParametersJSON struct { + HostHeader apijson.Field + Origin apijson.Field + Sni apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { +func (r *RouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { +func (r routeRuleActionParametersJSON) RawJSON() string { return r.raw } -// Remove the header from the request. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion +// Override the IP/TCP destination. +type RouteRuleActionParametersOrigin struct { + // Override the resolved hostname. + Host string `json:"host"` + // Override the destination port. + Port float64 `json:"port"` + JSON routeRuleActionParametersOriginJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains the -// JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field +// routeRuleActionParametersOriginJSON contains the JSON metadata for the struct +// [RouteRuleActionParametersOrigin] +type routeRuleActionParametersOriginJSON struct { + Host apijson.Field + Port apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader() +func (r *RouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) +func (r routeRuleActionParametersOriginJSON) RawJSON() string { + return r.raw } -// Remove the header from the request. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` +// Override the Server Name Indication (SNI). +type RouteRuleActionParametersSni struct { + // The SNI override. + Value string `json:"value,required"` + JSON routeRuleActionParametersSniJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field +// routeRuleActionParametersSniJSON contains the JSON metadata for the struct +// [RouteRuleActionParametersSni] +type routeRuleActionParametersSniJSON struct { + Value apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { +func (r *RouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { +func (r routeRuleActionParametersSniJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { +type RouteRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RouteRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RouteRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string +func (r RouteRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -const ( - RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) +func (r RouteRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} +func (r RouteRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} -// Set a request header with a static value. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} +func (r RouteRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field +// The parameters configuring the rule's action. +type RouteRuleActionParametersParam struct { + // Rewrite the HTTP Host header. + HostHeader param.Field[string] `json:"host_header"` + // Override the IP/TCP destination. + Origin param.Field[RouteRuleActionParametersOriginParam] `json:"origin"` + // Override the Server Name Indication (SNI). + Sni param.Field[RouteRuleActionParametersSniParam] `json:"sni"` } -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RouteRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw +// Override the IP/TCP destination. +type RouteRuleActionParametersOriginParam struct { + // Override the resolved hostname. + Host param.Field[string] `json:"host"` + // Override the destination port. + Port param.Field[float64] `json:"port"` } -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { +func (r RouteRuleActionParametersOriginParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) +// Override the Server Name Indication (SNI). +type RouteRuleActionParametersSniParam struct { + // The SNI override. + Value param.Field[string] `json:"value,required"` +} -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false +func (r RouteRuleActionParametersSniParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Set a request header with a dynamic value. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` +type ScoreRule struct { + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The version of the rule. + Version string `json:"version,required"` + // The unique ID of the rule. + ID string `json:"id"` + // The action to perform when the rule matches. + Action ScoreRuleAction `json:"action"` + // The parameters configuring the rule's action. + ActionParameters ScoreRuleActionParameters `json:"action_parameters"` + // The categories of the rule. + Categories []string `json:"categories"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + JSON scoreRuleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field +// scoreRuleJSON contains the JSON metadata for the struct [ScoreRule] +type scoreRuleJSON struct { + LastUpdated apijson.Field + Version apijson.Field + ID apijson.Field + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + Logging apijson.Field + Ref apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { +func (r *ScoreRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { +func (r scoreRuleJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} +func (r ScoreRule) implementsRulesetsRulesetNewResponseRule() {} -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string +func (r ScoreRule) implementsRulesetsRulesetUpdateResponseRule() {} -const ( - RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) +func (r ScoreRule) implementsRulesetsRulesetGetResponseRule() {} -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} +func (r ScoreRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r ScoreRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r ScoreRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r ScoreRule) implementsRulesetsRuleNewResponseRule() {} + +func (r ScoreRule) implementsRulesetsRuleDeleteResponseRule() {} -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string +func (r ScoreRule) implementsRulesetsRuleEditResponseRule() {} + +func (r ScoreRule) implementsRulesetsVersionGetResponseRule() {} + +func (r ScoreRule) implementsRulesetsVersionByTagGetResponseRule() {} + +// The action to perform when the rule matches. +type ScoreRuleAction string const ( - RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" + ScoreRuleActionScore ScoreRuleAction = "score" ) -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { +func (r ScoreRuleAction) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RuleNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: + case ScoreRuleActionScore: return true } return false } -// URI to rewrite the request to. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` +// The parameters configuring the rule's action. +type ScoreRuleActionParameters struct { + // Increment contains the delta to change the score and can be either positive or + // negative. + Increment int64 `json:"increment"` + JSON scoreRuleActionParametersJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURI] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field +// scoreRuleActionParametersJSON contains the JSON metadata for the struct +// [ScoreRuleActionParameters] +type scoreRuleActionParametersJSON struct { + Increment apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { +func (r *ScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { +func (r scoreRuleActionParametersJSON) RawJSON() string { return r.raw } -// Path portion rewrite. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion +type ScoreRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[ScoreRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[ScoreRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains the -// JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r ScoreRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} +func (r ScoreRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} +func (r ScoreRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} +func (r ScoreRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains the -// JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw +// The parameters configuring the rule's action. +type ScoreRuleActionParametersParam struct { + // Increment contains the delta to change the score and can be either positive or + // negative. + Increment param.Field[int64] `json:"increment"` } -func (r RuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRuleNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { +func (r ScoreRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleNewResponseRulesRulesetsRouteRule struct { +type ServeErrorRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -2553,9 +2818,9 @@ type RuleNewResponseRulesRulesetsRouteRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsRouteRuleAction `json:"action"` + Action ServeErrorRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` + ActionParameters ServeErrorRuleActionParameters `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -2567,13 +2832,12 @@ type RuleNewResponseRulesRulesetsRouteRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsRouteRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON serveErrorRuleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsRouteRule] -type ruleNewResponseRulesRulesetsRouteRuleJSON struct { +// serveErrorRuleJSON contains the JSON metadata for the struct [ServeErrorRule] +type serveErrorRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -2589,205 +2853,142 @@ type ruleNewResponseRulesRulesetsRouteRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { +func (r *ServeErrorRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRouteRuleJSON) RawJSON() string { +func (r serveErrorRuleJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsRouteRule) implementsRulesetsRuleNewResponseRule() {} +func (r ServeErrorRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsRuleNewResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsRuleEditResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsVersionGetResponseRule() {} + +func (r ServeErrorRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsRouteRuleAction string +type ServeErrorRuleAction string const ( - RuleNewResponseRulesRulesetsRouteRuleActionRoute RuleNewResponseRulesRulesetsRouteRuleAction = "route" + ServeErrorRuleActionServeError ServeErrorRuleAction = "serve_error" ) -func (r RuleNewResponseRulesRulesetsRouteRuleAction) IsKnown() bool { +func (r ServeErrorRuleAction) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsRouteRuleActionRoute: + case ServeErrorRuleActionServeError: return true } return false } // The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RuleNewResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RuleNewResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON ruleNewResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct [RuleNewResponseRulesRulesetsRouteRuleActionParameters] -type ruleNewResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RuleNewResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON ruleNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` +type ServeErrorRuleActionParameters struct { + // Error response content. + Content string `json:"content"` + // Content-type header to set with the response. + ContentType ServeErrorRuleActionParametersContentType `json:"content_type"` + // The status code to use for the error. + StatusCode float64 `json:"status_code"` + JSON serveErrorRuleActionParametersJSON `json:"-"` } -// ruleNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [RuleNewResponseRulesRulesetsRouteRuleActionParametersOrigin] -type ruleNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field +// serveErrorRuleActionParametersJSON contains the JSON metadata for the struct +// [ServeErrorRuleActionParameters] +type serveErrorRuleActionParametersJSON struct { + Content apijson.Field + ContentType apijson.Field + StatusCode apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { +func (r *ServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { +func (r serveErrorRuleActionParametersJSON) RawJSON() string { return r.raw } -// Override the Server Name Indication (SNI). -type RuleNewResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON ruleNewResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsRouteRuleActionParametersSni] -type ruleNewResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// Content-type header to set with the response. +type ServeErrorRuleActionParametersContentType string -func (r *RuleNewResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + ServeErrorRuleActionParametersContentTypeApplicationJson ServeErrorRuleActionParametersContentType = "application/json" + ServeErrorRuleActionParametersContentTypeTextXml ServeErrorRuleActionParametersContentType = "text/xml" + ServeErrorRuleActionParametersContentTypeTextPlain ServeErrorRuleActionParametersContentType = "text/plain" + ServeErrorRuleActionParametersContentTypeTextHTML ServeErrorRuleActionParametersContentType = "text/html" +) -func (r ruleNewResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw +func (r ServeErrorRuleActionParametersContentType) IsKnown() bool { + switch r { + case ServeErrorRuleActionParametersContentTypeApplicationJson, ServeErrorRuleActionParametersContentTypeTextXml, ServeErrorRuleActionParametersContentTypeTextPlain, ServeErrorRuleActionParametersContentTypeTextHTML: + return true + } + return false } -type RuleNewResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` +type ServeErrorRuleParam struct { // The unique ID of the rule. - ID string `json:"id"` + ID param.Field[string] `json:"id"` // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsScoreRuleAction `json:"action"` + Action param.Field[ServeErrorRuleAction] `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + ActionParameters param.Field[ServeErrorRuleActionParametersParam] `json:"action_parameters"` // An informative description of the rule. - Description string `json:"description"` + Description param.Field[string] `json:"description"` // Whether the rule should be executed. - Enabled bool `json:"enabled"` + Enabled param.Field[bool] `json:"enabled"` // The expression defining which traffic will match the rule. - Expression string `json:"expression"` + Expression param.Field[string] `json:"expression"` // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsScoreRule] -type ruleNewResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + Ref param.Field[string] `json:"ref"` } -func (r ruleNewResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw +func (r ServeErrorRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r RuleNewResponseRulesRulesetsScoreRule) implementsRulesetsRuleNewResponseRule() {} - -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsScoreRuleAction string +func (r ServeErrorRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} -const ( - RuleNewResponseRulesRulesetsScoreRuleActionScore RuleNewResponseRulesRulesetsScoreRuleAction = "score" -) +func (r ServeErrorRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} -func (r RuleNewResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} +func (r ServeErrorRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} // The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON ruleNewResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct [RuleNewResponseRulesRulesetsScoreRuleActionParameters] -type ruleNewResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type ServeErrorRuleActionParametersParam struct { + // Error response content. + Content param.Field[string] `json:"content"` + // Content-type header to set with the response. + ContentType param.Field[ServeErrorRuleActionParametersContentType] `json:"content_type"` + // The status code to use for the error. + StatusCode param.Field[float64] `json:"status_code"` } -func (r ruleNewResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw +func (r ServeErrorRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleNewResponseRulesRulesetsServeErrorRule struct { +type SetCacheSettingsRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -2795,9 +2996,9 @@ type RuleNewResponseRulesRulesetsServeErrorRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsServeErrorRuleAction `json:"action"` + Action SetCacheSettingsRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` + ActionParameters SetCacheSettingsRuleActionParameters `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -2809,13 +3010,13 @@ type RuleNewResponseRulesRulesetsServeErrorRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsServeErrorRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON setCacheSettingsRuleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [RuleNewResponseRulesRulesetsServeErrorRule] -type ruleNewResponseRulesRulesetsServeErrorRuleJSON struct { +// setCacheSettingsRuleJSON contains the JSON metadata for the struct +// [SetCacheSettingsRule] +type setCacheSettingsRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -2831,390 +3032,72 @@ type ruleNewResponseRulesRulesetsServeErrorRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { +func (r setCacheSettingsRuleJSON) RawJSON() string { return r.raw } -func (r RuleNewResponseRulesRulesetsServeErrorRule) implementsRulesetsRuleNewResponseRule() {} +func (r SetCacheSettingsRule) implementsRulesetsRulesetNewResponseRule() {} -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsServeErrorRuleAction string +func (r SetCacheSettingsRule) implementsRulesetsRulesetUpdateResponseRule() {} -const ( - RuleNewResponseRulesRulesetsServeErrorRuleActionServeError RuleNewResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) +func (r SetCacheSettingsRule) implementsRulesetsRulesetGetResponseRule() {} -func (r RuleNewResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} +func (r SetCacheSettingsRule) implementsRulesetsPhaseUpdateResponseRule() {} -// The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON ruleNewResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsServeErrorRuleActionParameters] -type ruleNewResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RuleNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RuleNewResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for the -// struct [RuleNewResponseRulesRulesetsSetConfigRule] -type ruleNewResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleNewResponseRulesRulesetsSetConfigRule) implementsRulesetsRuleNewResponseRule() {} - -// The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsSetConfigRuleAction string - -const ( - RuleNewResponseRulesRulesetsSetConfigRuleActionSetConfig RuleNewResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RuleNewResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RuleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON ruleNewResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleNewResponseRulesRulesetsSetConfigRuleActionParameters] -type ruleNewResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RuleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON ruleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// ruleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON contains -// the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type ruleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} +func (r SetCacheSettingsRule) implementsRulesetsPhaseGetResponseRule() {} -// Configure the Polish level. -type RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RuleNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} +func (r SetCacheSettingsRule) implementsRulesetsPhaseVersionGetResponseRule() {} -type RuleNewResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleNewResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} +func (r SetCacheSettingsRule) implementsRulesetsRuleNewResponseRule() {} -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON metadata -// for the struct [RuleNewResponseRulesRulesetsSetCacheSettingsRule] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +func (r SetCacheSettingsRule) implementsRulesetsRuleDeleteResponseRule() {} -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r SetCacheSettingsRule) implementsRulesetsRuleEditResponseRule() {} -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} +func (r SetCacheSettingsRule) implementsRulesetsVersionGetResponseRule() {} -func (r RuleNewResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRuleNewResponseRule() {} +func (r SetCacheSettingsRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleAction string +type SetCacheSettingsRuleAction string const ( - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RuleNewResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" + SetCacheSettingsRuleActionSetCacheSettings SetCacheSettingsRuleAction = "set_cache_settings" ) -func (r RuleNewResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { +func (r SetCacheSettingsRuleAction) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: + case SetCacheSettingsRuleActionSetCacheSettings: return true } return false } // The parameters configuring the rule's action. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { +type SetCacheSettingsRuleActionParameters struct { // List of additional ports that caching can be enabled on. AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` // Specify how long client browsers should cache the response. Cloudflare cache // purge will not purge content cached on client browsers, so high browser TTLs may // lead to stale content. - BrowserTTL RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` + BrowserTTL SetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` // Mark whether the request’s response from origin is eligible for caching. Caching // itself will still depend on the cache-control header and your other caching // configurations. Cache bool `json:"cache"` // Define which components of the request are included or excluded from the cache // key Cloudflare uses to store the response in cache. - CacheKey RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` + CacheKey SetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` // Mark whether the request's response from origin is eligible for Cache Reserve // (requires a Cache Reserve add-on plan). - CacheReserve RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` + CacheReserve SetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` // TTL (Time to Live) specifies the maximum time to cache a resource in the // Cloudflare edge network. - EdgeTTL RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` + EdgeTTL SetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. OriginCacheControl bool `json:"origin_cache_control"` // Generate Cloudflare error pages from issues sent from the origin server. When @@ -3232,14 +3115,13 @@ type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { // Define if Cloudflare should serve stale content while getting the latest content // from the origin. If on, Cloudflare will not serve stale content while getting // the latest content from the origin. - ServeStale RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` + ServeStale SetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` + JSON setCacheSettingsRuleActionParametersJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { +// setCacheSettingsRuleActionParametersJSON contains the JSON metadata for the +// struct [SetCacheSettingsRuleActionParameters] +type setCacheSettingsRuleActionParametersJSON struct { AdditionalCacheablePorts apijson.Field BrowserTTL apijson.Field Cache apijson.Field @@ -3255,55 +3137,54 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersJSON) RawJSON() string { return r.raw } // Specify how long client browsers should cache the response. Cloudflare cache // purge will not purge content cached on client browsers, so high browser TTLs may // lead to stale content. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { +type SetCacheSettingsRuleActionParametersBrowserTTL struct { // Determines which browser ttl mode to use. - Mode RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` + Mode SetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` + Default int64 `json:"default"` + JSON setCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { +// setCacheSettingsRuleActionParametersBrowserTTLJSON contains the JSON metadata +// for the struct [SetCacheSettingsRuleActionParametersBrowserTTL] +type setCacheSettingsRuleActionParametersBrowserTTLJSON struct { Mode apijson.Field Default apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { return r.raw } // Determines which browser ttl mode to use. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string +type SetCacheSettingsRuleActionParametersBrowserTTLMode string const ( - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" + SetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin SetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" + SetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault SetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" + SetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin SetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" ) -func (r RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { +func (r SetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: + case SetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, SetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, SetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: return true } return false @@ -3311,7 +3192,7 @@ func (r RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserT // Define which components of the request are included or excluded from the cache // key Cloudflare uses to store the response in cache. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { +type SetCacheSettingsRuleActionParametersCacheKey struct { // Separate cached content based on the visitor’s device type CacheByDeviceType bool `json:"cache_by_device_type"` // Protect from web cache deception attacks while allowing static assets to be @@ -3319,17 +3200,16 @@ type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey st CacheDeceptionArmor bool `json:"cache_deception_armor"` // Customize which components of the request are included or excluded from the // cache key. - CustomKey RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` + CustomKey SetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` // Treat requests with the same query parameters the same, regardless of the order // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` + IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` + JSON setCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyJSON contains the JSON metadata for +// the struct [SetCacheSettingsRuleActionParametersCacheKey] +type setCacheSettingsRuleActionParametersCacheKeyJSON struct { CacheByDeviceType apijson.Field CacheDeceptionArmor apijson.Field CustomKey apijson.Field @@ -3338,35 +3218,34 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSO ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { return r.raw } // Customize which components of the request are included or excluded from the // cache key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { // The cookies to include in building the cache key. - Cookie RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` + Cookie SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` // The header names and values to include in building the cache key. - Header RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` + Header SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` // Whether to use the original host or the resolved host in the cache key. - Host RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` + Host SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` // Use the presence or absence of parameters in the query string to build the cache // key. - QueryString RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` + QueryString SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` // Characteristics of the request user agent used in building the cache key. - User RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` + User SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON contains the JSON +// metadata for the struct [SetCacheSettingsRuleActionParametersCacheKeyCustomKey] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { Cookie apijson.Field Header apijson.Field Host apijson.Field @@ -3376,44 +3255,44 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCus ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { return r.raw } // The cookies to include in building the cache key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { // Checks for the presence of these cookie names. The presence of these cookies is // used in building the cache key. CheckPresence []string `json:"check_presence"` // Include these cookies' names and their values. - Include []string `json:"include"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` + Include []string `json:"include"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON contains the +// JSON metadata for the struct +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { CheckPresence apijson.Field Include apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { return r.raw } // The header names and values to include in building the cache key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { // Checks for the presence of these header names. The presence of these headers is // used in building the cache key. CheckPresence []string `json:"check_presence"` @@ -3421,14 +3300,14 @@ type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCus // origin header in the cache key. ExcludeOrigin bool `json:"exclude_origin"` // Include these headers' names and their values. - Include []string `json:"include"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` + Include []string `json:"include"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON contains the +// JSON metadata for the struct +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { CheckPresence apijson.Field ExcludeOrigin apijson.Field Include apijson.Field @@ -3436,142 +3315,142 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCus ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { return r.raw } // Whether to use the original host or the resolved host in the cache key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { // Use the resolved host in the cache key. A value of true will use the resolved // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` + Resolved bool `json:"resolved"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON contains the JSON +// metadata for the struct +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { Resolved apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { return r.raw } // Use the presence or absence of parameters in the query string to build the cache // key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { // build the cache key using all query string parameters EXCECPT these excluded // parameters - Exclude RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` + Exclude SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` // build the cache key using a list of query string parameters that ARE in the // request. - Include RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` + Include SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON contains +// the JSON metadata for the struct +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { Exclude apijson.Field Include apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { return r.raw } // build the cache key using all query string parameters EXCECPT these excluded // parameters -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { // Exclude all query string parameters from use in building the cache key. All bool `json:"all"` // A list of query string parameters NOT used to build the cache key. All // parameters present in the request but missing in this list will be used to build // the cache key. - List []string `json:"list"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` + List []string `json:"list"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON // contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { All apijson.Field List apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { return r.raw } // build the cache key using a list of query string parameters that ARE in the // request. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { // Use all query string parameters in the cache key. All bool `json:"all"` // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` + List []string `json:"list"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON // contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { All apijson.Field List apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { return r.raw } // Characteristics of the request user agent used in building the cache key. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { // Use the user agent's device type in the cache key. DeviceType bool `json:"device_type"` // Use the user agents's country in the cache key. Geo bool `json:"geo"` // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` + Lang bool `json:"lang"` + JSON setCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { +// setCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON contains the JSON +// metadata for the struct +// [SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] +type setCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { DeviceType apijson.Field Geo apijson.Field Lang apijson.Field @@ -3579,59 +3458,57 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCus ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { return r.raw } // Mark whether the request's response from origin is eligible for Cache Reserve // (requires a Cache Reserve add-on plan). -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { +type SetCacheSettingsRuleActionParametersCacheReserve struct { // Determines whether cache reserve is enabled. If this is true and a request meets // eligibility criteria, Cloudflare will write the resource to cache reserve. Eligible bool `json:"eligible,required"` // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` + MinFileSize int64 `json:"min_file_size,required"` + JSON setCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { +// setCacheSettingsRuleActionParametersCacheReserveJSON contains the JSON metadata +// for the struct [SetCacheSettingsRuleActionParametersCacheReserve] +type setCacheSettingsRuleActionParametersCacheReserveJSON struct { Eligible apijson.Field MinFileSize apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { return r.raw } // TTL (Time to Live) specifies the maximum time to cache a resource in the // Cloudflare edge network. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { +type SetCacheSettingsRuleActionParametersEdgeTTL struct { // The TTL (in seconds) if you choose override_origin mode. Default int64 `json:"default,required"` // edge ttl options - Mode RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` + Mode SetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` + StatusCodeTTL []SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` + JSON setCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { +// setCacheSettingsRuleActionParametersEdgeTTLJSON contains the JSON metadata for +// the struct [SetCacheSettingsRuleActionParametersEdgeTTL] +type setCacheSettingsRuleActionParametersEdgeTTLJSON struct { Default apijson.Field Mode apijson.Field StatusCodeTTL apijson.Field @@ -3639,26 +3516,26 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { return r.raw } // edge ttl options -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string +type SetCacheSettingsRuleActionParametersEdgeTTLMode string const ( - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" + SetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin SetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" + SetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault SetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" + SetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin SetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" ) -func (r RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { +func (r SetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { switch r { - case RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: + case SetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, SetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, SetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: return true } return false @@ -3666,22 +3543,22 @@ func (r RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLM // Specify how long Cloudflare should cache the response based on the status code // from the origin. Can be a single status code or a range or status codes -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { +type SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { // Time to cache a response (in seconds). A value of 0 is equivalent to setting the // Cache-Control header with the value "no-cache". A value of -1 is equivalent to // setting Cache-Control header with the value of "no-store". Value int64 `json:"value,required"` // The range of status codes used to apply the selected mode. - StatusCodeRange RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` + StatusCodeRange SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` + StatusCodeValue int64 `json:"status_code_value"` + JSON setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { +// setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON contains the JSON +// metadata for the struct +// [SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] +type setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { Value apijson.Field StatusCodeRange apijson.Field StatusCodeValue apijson.Field @@ -3689,425 +3566,366 @@ type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStat ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { return r.raw } // The range of status codes used to apply the selected mode. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { +type SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { // response status code lower bound From int64 `json:"from,required"` // response status code upper bound - To int64 `json:"to,required"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` + To int64 `json:"to,required"` + JSON setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON +// setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON // contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { +// [SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] +type setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { From apijson.Field To apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { return r.raw } // Define if Cloudflare should serve stale content while getting the latest content // from the origin. If on, Cloudflare will not serve stale content while getting // the latest content from the origin. -type RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { +type SetCacheSettingsRuleActionParametersServeStale struct { // Defines whether Cloudflare should serve stale content while updating. If true, // Cloudflare will not serve stale content while getting the latest content from // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` + DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` + JSON setCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` } -// ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { +// setCacheSettingsRuleActionParametersServeStaleJSON contains the JSON metadata +// for the struct [SetCacheSettingsRuleActionParametersServeStale] +type setCacheSettingsRuleActionParametersServeStaleJSON struct { DisableStaleWhileUpdating apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { +func (r *SetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { +func (r setCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { return r.raw } -// The action to perform when the rule matches. -type RuleNewResponseRulesAction string - -const ( - RuleNewResponseRulesActionBlock RuleNewResponseRulesAction = "block" - RuleNewResponseRulesActionChallenge RuleNewResponseRulesAction = "challenge" - RuleNewResponseRulesActionCompressResponse RuleNewResponseRulesAction = "compress_response" - RuleNewResponseRulesActionExecute RuleNewResponseRulesAction = "execute" - RuleNewResponseRulesActionJsChallenge RuleNewResponseRulesAction = "js_challenge" - RuleNewResponseRulesActionLog RuleNewResponseRulesAction = "log" - RuleNewResponseRulesActionManagedChallenge RuleNewResponseRulesAction = "managed_challenge" - RuleNewResponseRulesActionRedirect RuleNewResponseRulesAction = "redirect" - RuleNewResponseRulesActionRewrite RuleNewResponseRulesAction = "rewrite" - RuleNewResponseRulesActionRoute RuleNewResponseRulesAction = "route" - RuleNewResponseRulesActionScore RuleNewResponseRulesAction = "score" - RuleNewResponseRulesActionServeError RuleNewResponseRulesAction = "serve_error" - RuleNewResponseRulesActionSetConfig RuleNewResponseRulesAction = "set_config" - RuleNewResponseRulesActionSkip RuleNewResponseRulesAction = "skip" - RuleNewResponseRulesActionSetCacheSettings RuleNewResponseRulesAction = "set_cache_settings" -) +type SetCacheSettingsRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[SetCacheSettingsRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[SetCacheSettingsRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} -func (r RuleNewResponseRulesAction) IsKnown() bool { - switch r { - case RuleNewResponseRulesActionBlock, RuleNewResponseRulesActionChallenge, RuleNewResponseRulesActionCompressResponse, RuleNewResponseRulesActionExecute, RuleNewResponseRulesActionJsChallenge, RuleNewResponseRulesActionLog, RuleNewResponseRulesActionManagedChallenge, RuleNewResponseRulesActionRedirect, RuleNewResponseRulesActionRewrite, RuleNewResponseRulesActionRoute, RuleNewResponseRulesActionScore, RuleNewResponseRulesActionServeError, RuleNewResponseRulesActionSetConfig, RuleNewResponseRulesActionSkip, RuleNewResponseRulesActionSetCacheSettings: - return true - } - return false +func (r SetCacheSettingsRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// A ruleset object. -type RuleDeleteResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind RuleDeleteResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase RuleDeleteResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []RuleDeleteResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON ruleDeleteResponseJSON `json:"-"` +func (r SetCacheSettingsRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r SetCacheSettingsRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r SetCacheSettingsRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type SetCacheSettingsRuleActionParametersParam struct { + // List of additional ports that caching can be enabled on. + AdditionalCacheablePorts param.Field[[]int64] `json:"additional_cacheable_ports"` + // Specify how long client browsers should cache the response. Cloudflare cache + // purge will not purge content cached on client browsers, so high browser TTLs may + // lead to stale content. + BrowserTTL param.Field[SetCacheSettingsRuleActionParametersBrowserTTLParam] `json:"browser_ttl"` + // Mark whether the request’s response from origin is eligible for caching. Caching + // itself will still depend on the cache-control header and your other caching + // configurations. + Cache param.Field[bool] `json:"cache"` + // Define which components of the request are included or excluded from the cache + // key Cloudflare uses to store the response in cache. + CacheKey param.Field[SetCacheSettingsRuleActionParametersCacheKeyParam] `json:"cache_key"` + // Mark whether the request's response from origin is eligible for Cache Reserve + // (requires a Cache Reserve add-on plan). + CacheReserve param.Field[SetCacheSettingsRuleActionParametersCacheReserveParam] `json:"cache_reserve"` + // TTL (Time to Live) specifies the maximum time to cache a resource in the + // Cloudflare edge network. + EdgeTTL param.Field[SetCacheSettingsRuleActionParametersEdgeTTLParam] `json:"edge_ttl"` + // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. + OriginCacheControl param.Field[bool] `json:"origin_cache_control"` + // Generate Cloudflare error pages from issues sent from the origin server. When + // on, error pages will trigger for issues from the origin + OriginErrorPagePassthru param.Field[bool] `json:"origin_error_page_passthru"` + // Define a timeout value between two successive read operations to your origin + // server. Historically, the timeout value between two read options from Cloudflare + // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 + // errors because of timeouts from an origin server, try increasing this timeout + // value. + ReadTimeout param.Field[int64] `json:"read_timeout"` + // Specify whether or not Cloudflare should respect strong ETag (entity tag) + // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. + RespectStrongEtags param.Field[bool] `json:"respect_strong_etags"` + // Define if Cloudflare should serve stale content while getting the latest content + // from the origin. If on, Cloudflare will not serve stale content while getting + // the latest content from the origin. + ServeStale param.Field[SetCacheSettingsRuleActionParametersServeStaleParam] `json:"serve_stale"` } -// ruleDeleteResponseJSON contains the JSON metadata for the struct -// [RuleDeleteResponse] -type ruleDeleteResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field - Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r SetCacheSettingsRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *RuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// Specify how long client browsers should cache the response. Cloudflare cache +// purge will not purge content cached on client browsers, so high browser TTLs may +// lead to stale content. +type SetCacheSettingsRuleActionParametersBrowserTTLParam struct { + // Determines which browser ttl mode to use. + Mode param.Field[SetCacheSettingsRuleActionParametersBrowserTTLMode] `json:"mode,required"` + // The TTL (in seconds) if you choose override_origin mode. + Default param.Field[int64] `json:"default"` } -func (r ruleDeleteResponseJSON) RawJSON() string { - return r.raw +func (r SetCacheSettingsRuleActionParametersBrowserTTLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The kind of the ruleset. -type RuleDeleteResponseKind string +// Define which components of the request are included or excluded from the cache +// key Cloudflare uses to store the response in cache. +type SetCacheSettingsRuleActionParametersCacheKeyParam struct { + // Separate cached content based on the visitor’s device type + CacheByDeviceType param.Field[bool] `json:"cache_by_device_type"` + // Protect from web cache deception attacks while allowing static assets to be + // cached + CacheDeceptionArmor param.Field[bool] `json:"cache_deception_armor"` + // Customize which components of the request are included or excluded from the + // cache key. + CustomKey param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyParam] `json:"custom_key"` + // Treat requests with the same query parameters the same, regardless of the order + // those query parameters are in. A value of true ignores the query strings' order. + IgnoreQueryStringsOrder param.Field[bool] `json:"ignore_query_strings_order"` +} -const ( - RuleDeleteResponseKindManaged RuleDeleteResponseKind = "managed" - RuleDeleteResponseKindCustom RuleDeleteResponseKind = "custom" - RuleDeleteResponseKindRoot RuleDeleteResponseKind = "root" - RuleDeleteResponseKindZone RuleDeleteResponseKind = "zone" -) +func (r SetCacheSettingsRuleActionParametersCacheKeyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r RuleDeleteResponseKind) IsKnown() bool { - switch r { - case RuleDeleteResponseKindManaged, RuleDeleteResponseKindCustom, RuleDeleteResponseKindRoot, RuleDeleteResponseKindZone: - return true - } - return false +// Customize which components of the request are included or excluded from the +// cache key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyParam struct { + // The cookies to include in building the cache key. + Cookie param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieParam] `json:"cookie"` + // The header names and values to include in building the cache key. + Header param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderParam] `json:"header"` + // Whether to use the original host or the resolved host in the cache key. + Host param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostParam] `json:"host"` + // Use the presence or absence of parameters in the query string to build the cache + // key. + QueryString param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringParam] `json:"query_string"` + // Characteristics of the request user agent used in building the cache key. + User param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserParam] `json:"user"` } -// The phase of the ruleset. -type RuleDeleteResponsePhase string +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -const ( - RuleDeleteResponsePhaseDDoSL4 RuleDeleteResponsePhase = "ddos_l4" - RuleDeleteResponsePhaseDDoSL7 RuleDeleteResponsePhase = "ddos_l7" - RuleDeleteResponsePhaseHTTPConfigSettings RuleDeleteResponsePhase = "http_config_settings" - RuleDeleteResponsePhaseHTTPCustomErrors RuleDeleteResponsePhase = "http_custom_errors" - RuleDeleteResponsePhaseHTTPLogCustomFields RuleDeleteResponsePhase = "http_log_custom_fields" - RuleDeleteResponsePhaseHTTPRatelimit RuleDeleteResponsePhase = "http_ratelimit" - RuleDeleteResponsePhaseHTTPRequestCacheSettings RuleDeleteResponsePhase = "http_request_cache_settings" - RuleDeleteResponsePhaseHTTPRequestDynamicRedirect RuleDeleteResponsePhase = "http_request_dynamic_redirect" - RuleDeleteResponsePhaseHTTPRequestFirewallCustom RuleDeleteResponsePhase = "http_request_firewall_custom" - RuleDeleteResponsePhaseHTTPRequestFirewallManaged RuleDeleteResponsePhase = "http_request_firewall_managed" - RuleDeleteResponsePhaseHTTPRequestLateTransform RuleDeleteResponsePhase = "http_request_late_transform" - RuleDeleteResponsePhaseHTTPRequestOrigin RuleDeleteResponsePhase = "http_request_origin" - RuleDeleteResponsePhaseHTTPRequestRedirect RuleDeleteResponsePhase = "http_request_redirect" - RuleDeleteResponsePhaseHTTPRequestSanitize RuleDeleteResponsePhase = "http_request_sanitize" - RuleDeleteResponsePhaseHTTPRequestSbfm RuleDeleteResponsePhase = "http_request_sbfm" - RuleDeleteResponsePhaseHTTPRequestSelectConfiguration RuleDeleteResponsePhase = "http_request_select_configuration" - RuleDeleteResponsePhaseHTTPRequestTransform RuleDeleteResponsePhase = "http_request_transform" - RuleDeleteResponsePhaseHTTPResponseCompression RuleDeleteResponsePhase = "http_response_compression" - RuleDeleteResponsePhaseHTTPResponseFirewallManaged RuleDeleteResponsePhase = "http_response_firewall_managed" - RuleDeleteResponsePhaseHTTPResponseHeadersTransform RuleDeleteResponsePhase = "http_response_headers_transform" - RuleDeleteResponsePhaseMagicTransit RuleDeleteResponsePhase = "magic_transit" - RuleDeleteResponsePhaseMagicTransitIDsManaged RuleDeleteResponsePhase = "magic_transit_ids_managed" - RuleDeleteResponsePhaseMagicTransitManaged RuleDeleteResponsePhase = "magic_transit_managed" -) +// The cookies to include in building the cache key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieParam struct { + // Checks for the presence of these cookie names. The presence of these cookies is + // used in building the cache key. + CheckPresence param.Field[[]string] `json:"check_presence"` + // Include these cookies' names and their values. + Include param.Field[[]string] `json:"include"` +} -func (r RuleDeleteResponsePhase) IsKnown() bool { - switch r { - case RuleDeleteResponsePhaseDDoSL4, RuleDeleteResponsePhaseDDoSL7, RuleDeleteResponsePhaseHTTPConfigSettings, RuleDeleteResponsePhaseHTTPCustomErrors, RuleDeleteResponsePhaseHTTPLogCustomFields, RuleDeleteResponsePhaseHTTPRatelimit, RuleDeleteResponsePhaseHTTPRequestCacheSettings, RuleDeleteResponsePhaseHTTPRequestDynamicRedirect, RuleDeleteResponsePhaseHTTPRequestFirewallCustom, RuleDeleteResponsePhaseHTTPRequestFirewallManaged, RuleDeleteResponsePhaseHTTPRequestLateTransform, RuleDeleteResponsePhaseHTTPRequestOrigin, RuleDeleteResponsePhaseHTTPRequestRedirect, RuleDeleteResponsePhaseHTTPRequestSanitize, RuleDeleteResponsePhaseHTTPRequestSbfm, RuleDeleteResponsePhaseHTTPRequestSelectConfiguration, RuleDeleteResponsePhaseHTTPRequestTransform, RuleDeleteResponsePhaseHTTPResponseCompression, RuleDeleteResponsePhaseHTTPResponseFirewallManaged, RuleDeleteResponsePhaseHTTPResponseHeadersTransform, RuleDeleteResponsePhaseMagicTransit, RuleDeleteResponsePhaseMagicTransitIDsManaged, RuleDeleteResponsePhaseMagicTransitManaged: - return true - } - return false +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleDeleteResponseRule struct { - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON ruleDeleteResponseRuleJSON `json:"-"` - union RuleDeleteResponseRulesUnion +// The header names and values to include in building the cache key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderParam struct { + // Checks for the presence of these header names. The presence of these headers is + // used in building the cache key. + CheckPresence param.Field[[]string] `json:"check_presence"` + // Whether or not to include the origin header. A value of true will exclude the + // origin header in the cache key. + ExcludeOrigin param.Field[bool] `json:"exclude_origin"` + // Include these headers' names and their values. + Include param.Field[[]string] `json:"include"` } -// ruleDeleteResponseRuleJSON contains the JSON metadata for the struct -// [RuleDeleteResponseRule] -type ruleDeleteResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleDeleteResponseRuleJSON) RawJSON() string { - return r.raw +// Whether to use the original host or the resolved host in the cache key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostParam struct { + // Use the resolved host in the cache key. A value of true will use the resolved + // host, while a value or false will use the original host. + Resolved param.Field[bool] `json:"resolved"` } -func (r *RuleDeleteResponseRule) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r RuleDeleteResponseRule) AsUnion() RuleDeleteResponseRulesUnion { - return r.union +// Use the presence or absence of parameters in the query string to build the cache +// key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringParam struct { + // build the cache key using all query string parameters EXCECPT these excluded + // parameters + Exclude param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeParam] `json:"exclude"` + // build the cache key using a list of query string parameters that ARE in the + // request. + Include param.Field[SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeParam] `json:"include"` } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RuleDeleteResponseRulesRulesetsChallengeRule], -// [rulesets.RuleDeleteResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.RuleDeleteResponseRulesRulesetsJsChallengeRule], [rulesets.LogRule], -// [rulesets.RuleDeleteResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RuleDeleteResponseRulesRulesetsRedirectRule], -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRule], -// [rulesets.RuleDeleteResponseRulesRulesetsRouteRule], -// [rulesets.RuleDeleteResponseRulesRulesetsScoreRule], -// [rulesets.RuleDeleteResponseRulesRulesetsServeErrorRule], -// [rulesets.RuleDeleteResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.RuleDeleteResponseRulesRulesetsSetCacheSettingsRule]. -type RuleDeleteResponseRulesUnion interface { - implementsRulesetsRuleDeleteResponseRule() +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleDeleteResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", - }, - ) +// build the cache key using all query string parameters EXCECPT these excluded +// parameters +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeParam struct { + // Exclude all query string parameters from use in building the cache key. + All param.Field[bool] `json:"all"` + // A list of query string parameters NOT used to build the cache key. All + // parameters present in the request but missing in this list will be used to build + // the cache key. + List param.Field[[]string] `json:"list"` } -type RuleDeleteResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsChallengeRuleJSON `json:"-"` +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// ruleDeleteResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [RuleDeleteResponseRulesRulesetsChallengeRule] -type ruleDeleteResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// build the cache key using a list of query string parameters that ARE in the +// request. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeParam struct { + // Use all query string parameters in the cache key. + All param.Field[bool] `json:"all"` + // A list of query string parameters used to build the cache key. + List param.Field[[]string] `json:"list"` } -func (r *RuleDeleteResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleDeleteResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw +// Characteristics of the request user agent used in building the cache key. +type SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserParam struct { + // Use the user agent's device type in the cache key. + DeviceType param.Field[bool] `json:"device_type"` + // Use the user agents's country in the cache key. + Geo param.Field[bool] `json:"geo"` + // Use the user agent's language in the cache key. + Lang param.Field[bool] `json:"lang"` } -func (r RuleDeleteResponseRulesRulesetsChallengeRule) implementsRulesetsRuleDeleteResponseRule() {} +func (r SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsChallengeRuleAction string +// Mark whether the request's response from origin is eligible for Cache Reserve +// (requires a Cache Reserve add-on plan). +type SetCacheSettingsRuleActionParametersCacheReserveParam struct { + // Determines whether cache reserve is enabled. If this is true and a request meets + // eligibility criteria, Cloudflare will write the resource to cache reserve. + Eligible param.Field[bool] `json:"eligible,required"` + // The minimum file size eligible for store in cache reserve. + MinFileSize param.Field[int64] `json:"min_file_size,required"` +} -const ( - RuleDeleteResponseRulesRulesetsChallengeRuleActionChallenge RuleDeleteResponseRulesRulesetsChallengeRuleAction = "challenge" -) +func (r SetCacheSettingsRuleActionParametersCacheReserveParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r RuleDeleteResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false +// TTL (Time to Live) specifies the maximum time to cache a resource in the +// Cloudflare edge network. +type SetCacheSettingsRuleActionParametersEdgeTTLParam struct { + // The TTL (in seconds) if you choose override_origin mode. + Default param.Field[int64] `json:"default,required"` + // edge ttl options + Mode param.Field[SetCacheSettingsRuleActionParametersEdgeTTLMode] `json:"mode,required"` + // List of single status codes, or status code ranges to apply the selected mode + StatusCodeTTL param.Field[[]SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLParam] `json:"status_code_ttl,required"` +} + +func (r SetCacheSettingsRuleActionParametersEdgeTTLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Specify how long Cloudflare should cache the response based on the status code +// from the origin. Can be a single status code or a range or status codes +type SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLParam struct { + // Time to cache a response (in seconds). A value of 0 is equivalent to setting the + // Cache-Control header with the value "no-cache". A value of -1 is equivalent to + // setting Cache-Control header with the value of "no-store". + Value param.Field[int64] `json:"value,required"` + // The range of status codes used to apply the selected mode. + StatusCodeRange param.Field[SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeParam] `json:"status_code_range"` + // Set the ttl for responses with this specific status code + StatusCodeValue param.Field[int64] `json:"status_code_value"` +} + +func (r SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The range of status codes used to apply the selected mode. +type SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeParam struct { + // response status code lower bound + From param.Field[int64] `json:"from,required"` + // response status code upper bound + To param.Field[int64] `json:"to,required"` +} + +func (r SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Define if Cloudflare should serve stale content while getting the latest content +// from the origin. If on, Cloudflare will not serve stale content while getting +// the latest content from the origin. +type SetCacheSettingsRuleActionParametersServeStaleParam struct { + // Defines whether Cloudflare should serve stale content while updating. If true, + // Cloudflare will not serve stale content while getting the latest content from + // the origin. + DisableStaleWhileUpdating param.Field[bool] `json:"disable_stale_while_updating,required"` +} + +func (r SetCacheSettingsRuleActionParametersServeStaleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleDeleteResponseRulesRulesetsCompressResponseRule struct { +type SetConfigRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -4115,9 +3933,9 @@ type RuleDeleteResponseRulesRulesetsCompressResponseRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsCompressResponseRuleAction `json:"action"` + Action SetConfigRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` + ActionParameters SetConfigRuleActionParameters `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -4129,13 +3947,12 @@ type RuleDeleteResponseRulesRulesetsCompressResponseRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON setConfigRuleJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [RuleDeleteResponseRulesRulesetsCompressResponseRule] -type ruleDeleteResponseRulesRulesetsCompressResponseRuleJSON struct { +// setConfigRuleJSON contains the JSON metadata for the struct [SetConfigRule] +type setConfigRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -4151,239 +3968,283 @@ type ruleDeleteResponseRulesRulesetsCompressResponseRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { +func (r *SetConfigRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { +func (r setConfigRuleJSON) RawJSON() string { return r.raw } -func (r RuleDeleteResponseRulesRulesetsCompressResponseRule) implementsRulesetsRuleDeleteResponseRule() { -} +func (r SetConfigRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r SetConfigRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r SetConfigRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r SetConfigRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r SetConfigRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r SetConfigRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r SetConfigRule) implementsRulesetsRuleNewResponseRule() {} + +func (r SetConfigRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r SetConfigRule) implementsRulesetsRuleEditResponseRule() {} + +func (r SetConfigRule) implementsRulesetsVersionGetResponseRule() {} + +func (r SetConfigRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsCompressResponseRuleAction string +type SetConfigRuleAction string const ( - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionCompressResponse RuleDeleteResponseRulesRulesetsCompressResponseRuleAction = "compress_response" + SetConfigRuleActionSetConfig SetConfigRuleAction = "set_config" ) -func (r RuleDeleteResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { +func (r SetConfigRuleAction) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsCompressResponseRuleActionCompressResponse: + case SetConfigRuleActionSetConfig: return true } return false } // The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` +type SetConfigRuleActionParameters struct { + // Turn on or off Automatic HTTPS Rewrites. + AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` + // Select which file extensions to minify automatically. + Autominify SetConfigRuleActionParametersAutominify `json:"autominify"` + // Turn on or off Browser Integrity Check. + Bic bool `json:"bic"` + // Turn off all active Cloudflare Apps. + DisableApps bool `json:"disable_apps"` + // Turn off Zaraz. + DisableZaraz bool `json:"disable_zaraz"` + // Turn on or off Email Obfuscation. + EmailObfuscation bool `json:"email_obfuscation"` + // Turn on or off the Hotlink Protection. + HotlinkProtection bool `json:"hotlink_protection"` + // Turn on or off Mirage. + Mirage bool `json:"mirage"` + // Turn on or off Opportunistic Encryption. + OpportunisticEncryption bool `json:"opportunistic_encryption"` + // Configure the Polish level. + Polish SetConfigRuleActionParametersPolish `json:"polish"` + // Turn on or off Rocket Loader + RocketLoader bool `json:"rocket_loader"` + // Configure the Security Level. + SecurityLevel SetConfigRuleActionParametersSecurityLevel `json:"security_level"` + // Turn on or off Server Side Excludes. + ServerSideExcludes bool `json:"server_side_excludes"` + // Configure the SSL level. + SSL SetConfigRuleActionParametersSSL `json:"ssl"` + // Turn on or off Signed Exchanges (SXG). + Sxg bool `json:"sxg"` + JSON setConfigRuleActionParametersJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParameters] -type ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field +// setConfigRuleActionParametersJSON contains the JSON metadata for the struct +// [SetConfigRuleActionParameters] +type setConfigRuleActionParametersJSON struct { + AutomaticHTTPSRewrites apijson.Field + Autominify apijson.Field + Bic apijson.Field + DisableApps apijson.Field + DisableZaraz apijson.Field + EmailObfuscation apijson.Field + HotlinkProtection apijson.Field + Mirage apijson.Field + OpportunisticEncryption apijson.Field + Polish apijson.Field + RocketLoader apijson.Field + SecurityLevel apijson.Field + ServerSideExcludes apijson.Field + SSL apijson.Field + Sxg apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { +func (r *SetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { +func (r setConfigRuleActionParametersJSON) RawJSON() string { return r.raw } -// Compression algorithm to enable. -type RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` +// Select which file extensions to minify automatically. +type SetConfigRuleActionParametersAutominify struct { + // Minify CSS files. + Css bool `json:"css"` + // Minify HTML files. + HTML bool `json:"html"` + // Minify JS files. + Js bool `json:"js"` + JSON setConfigRuleActionParametersAutominifyJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field +// setConfigRuleActionParametersAutominifyJSON contains the JSON metadata for the +// struct [SetConfigRuleActionParametersAutominify] +type setConfigRuleActionParametersAutominifyJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { +func (r *SetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { +func (r setConfigRuleActionParametersAutominifyJSON) RawJSON() string { return r.raw } -// Name of compression algorithm to enable. -type RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string +// Configure the Polish level. +type SetConfigRuleActionParametersPolish string const ( - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" + SetConfigRuleActionParametersPolishOff SetConfigRuleActionParametersPolish = "off" + SetConfigRuleActionParametersPolishLossless SetConfigRuleActionParametersPolish = "lossless" + SetConfigRuleActionParametersPolishLossy SetConfigRuleActionParametersPolish = "lossy" ) -func (r RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { +func (r SetConfigRuleActionParametersPolish) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RuleDeleteResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: + case SetConfigRuleActionParametersPolishOff, SetConfigRuleActionParametersPolishLossless, SetConfigRuleActionParametersPolishLossy: return true } return false } -type RuleDeleteResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [RuleDeleteResponseRulesRulesetsJsChallengeRule] -type ruleDeleteResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// Configure the Security Level. +type SetConfigRuleActionParametersSecurityLevel string -func (r *RuleDeleteResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + SetConfigRuleActionParametersSecurityLevelOff SetConfigRuleActionParametersSecurityLevel = "off" + SetConfigRuleActionParametersSecurityLevelEssentiallyOff SetConfigRuleActionParametersSecurityLevel = "essentially_off" + SetConfigRuleActionParametersSecurityLevelLow SetConfigRuleActionParametersSecurityLevel = "low" + SetConfigRuleActionParametersSecurityLevelMedium SetConfigRuleActionParametersSecurityLevel = "medium" + SetConfigRuleActionParametersSecurityLevelHigh SetConfigRuleActionParametersSecurityLevel = "high" + SetConfigRuleActionParametersSecurityLevelUnderAttack SetConfigRuleActionParametersSecurityLevel = "under_attack" +) -func (r ruleDeleteResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw +func (r SetConfigRuleActionParametersSecurityLevel) IsKnown() bool { + switch r { + case SetConfigRuleActionParametersSecurityLevelOff, SetConfigRuleActionParametersSecurityLevelEssentiallyOff, SetConfigRuleActionParametersSecurityLevelLow, SetConfigRuleActionParametersSecurityLevelMedium, SetConfigRuleActionParametersSecurityLevelHigh, SetConfigRuleActionParametersSecurityLevelUnderAttack: + return true + } + return false } -func (r RuleDeleteResponseRulesRulesetsJsChallengeRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsJsChallengeRuleAction string +// Configure the SSL level. +type SetConfigRuleActionParametersSSL string const ( - RuleDeleteResponseRulesRulesetsJsChallengeRuleActionJsChallenge RuleDeleteResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" + SetConfigRuleActionParametersSSLOff SetConfigRuleActionParametersSSL = "off" + SetConfigRuleActionParametersSSLFlexible SetConfigRuleActionParametersSSL = "flexible" + SetConfigRuleActionParametersSSLFull SetConfigRuleActionParametersSSL = "full" + SetConfigRuleActionParametersSSLStrict SetConfigRuleActionParametersSSL = "strict" + SetConfigRuleActionParametersSSLOriginPull SetConfigRuleActionParametersSSL = "origin_pull" ) -func (r RuleDeleteResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { +func (r SetConfigRuleActionParametersSSL) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsJsChallengeRuleActionJsChallenge: + case SetConfigRuleActionParametersSSLOff, SetConfigRuleActionParametersSSLFlexible, SetConfigRuleActionParametersSSLFull, SetConfigRuleActionParametersSSLStrict, SetConfigRuleActionParametersSSLOriginPull: return true } return false } -type RuleDeleteResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` +type SetConfigRuleParam struct { // The unique ID of the rule. - ID string `json:"id"` + ID param.Field[string] `json:"id"` // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` + Action param.Field[SetConfigRuleAction] `json:"action"` // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + ActionParameters param.Field[SetConfigRuleActionParametersParam] `json:"action_parameters"` // An informative description of the rule. - Description string `json:"description"` + Description param.Field[string] `json:"description"` // Whether the rule should be executed. - Enabled bool `json:"enabled"` + Enabled param.Field[bool] `json:"enabled"` // The expression defining which traffic will match the rule. - Expression string `json:"expression"` + Expression param.Field[string] `json:"expression"` // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` + Ref param.Field[string] `json:"ref"` } -// ruleDeleteResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [RuleDeleteResponseRulesRulesetsManagedChallengeRule] -type ruleDeleteResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r SetConfigRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *RuleDeleteResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r SetConfigRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} -func (r ruleDeleteResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} +func (r SetConfigRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} -func (r RuleDeleteResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRuleDeleteResponseRule() { +func (r SetConfigRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type SetConfigRuleActionParametersParam struct { + // Turn on or off Automatic HTTPS Rewrites. + AutomaticHTTPSRewrites param.Field[bool] `json:"automatic_https_rewrites"` + // Select which file extensions to minify automatically. + Autominify param.Field[SetConfigRuleActionParametersAutominifyParam] `json:"autominify"` + // Turn on or off Browser Integrity Check. + Bic param.Field[bool] `json:"bic"` + // Turn off all active Cloudflare Apps. + DisableApps param.Field[bool] `json:"disable_apps"` + // Turn off Zaraz. + DisableZaraz param.Field[bool] `json:"disable_zaraz"` + // Turn on or off Email Obfuscation. + EmailObfuscation param.Field[bool] `json:"email_obfuscation"` + // Turn on or off the Hotlink Protection. + HotlinkProtection param.Field[bool] `json:"hotlink_protection"` + // Turn on or off Mirage. + Mirage param.Field[bool] `json:"mirage"` + // Turn on or off Opportunistic Encryption. + OpportunisticEncryption param.Field[bool] `json:"opportunistic_encryption"` + // Configure the Polish level. + Polish param.Field[SetConfigRuleActionParametersPolish] `json:"polish"` + // Turn on or off Rocket Loader + RocketLoader param.Field[bool] `json:"rocket_loader"` + // Configure the Security Level. + SecurityLevel param.Field[SetConfigRuleActionParametersSecurityLevel] `json:"security_level"` + // Turn on or off Server Side Excludes. + ServerSideExcludes param.Field[bool] `json:"server_side_excludes"` + // Configure the SSL level. + SSL param.Field[SetConfigRuleActionParametersSSL] `json:"ssl"` + // Turn on or off Signed Exchanges (SXG). + Sxg param.Field[bool] `json:"sxg"` } -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsManagedChallengeRuleAction string +func (r SetConfigRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -const ( - RuleDeleteResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RuleDeleteResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) +// Select which file extensions to minify automatically. +type SetConfigRuleActionParametersAutominifyParam struct { + // Minify CSS files. + Css param.Field[bool] `json:"css"` + // Minify HTML files. + HTML param.Field[bool] `json:"html"` + // Minify JS files. + Js param.Field[bool] `json:"js"` +} -func (r RuleDeleteResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false +func (r SetConfigRuleActionParametersAutominifyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleDeleteResponseRulesRulesetsRedirectRule struct { +type SkipRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The version of the rule. @@ -4391,9 +4252,9 @@ type RuleDeleteResponseRulesRulesetsRedirectRule struct { // The unique ID of the rule. ID string `json:"id"` // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsRedirectRuleAction `json:"action"` + Action SkipRuleAction `json:"action"` // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` + ActionParameters SkipRuleActionParameters `json:"action_parameters"` // The categories of the rule. Categories []string `json:"categories"` // An informative description of the rule. @@ -4405,13 +4266,12 @@ type RuleDeleteResponseRulesRulesetsRedirectRule struct { // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleJSON `json:"-"` + Ref string `json:"ref"` + JSON skipRuleJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for -// the struct [RuleDeleteResponseRulesRulesetsRedirectRule] -type ruleDeleteResponseRulesRulesetsRedirectRuleJSON struct { +// skipRuleJSON contains the JSON metadata for the struct [SkipRule] +type skipRuleJSON struct { LastUpdated apijson.Field Version apijson.Field ID apijson.Field @@ -4427,4692 +4287,1020 @@ type ruleDeleteResponseRulesRulesetsRedirectRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { +func (r *SkipRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { +func (r skipRuleJSON) RawJSON() string { return r.raw } -func (r RuleDeleteResponseRulesRulesetsRedirectRule) implementsRulesetsRuleDeleteResponseRule() {} +func (r SkipRule) implementsRulesetsRulesetNewResponseRule() {} + +func (r SkipRule) implementsRulesetsRulesetUpdateResponseRule() {} + +func (r SkipRule) implementsRulesetsRulesetGetResponseRule() {} + +func (r SkipRule) implementsRulesetsPhaseUpdateResponseRule() {} + +func (r SkipRule) implementsRulesetsPhaseGetResponseRule() {} + +func (r SkipRule) implementsRulesetsPhaseVersionGetResponseRule() {} + +func (r SkipRule) implementsRulesetsRuleNewResponseRule() {} + +func (r SkipRule) implementsRulesetsRuleDeleteResponseRule() {} + +func (r SkipRule) implementsRulesetsRuleEditResponseRule() {} + +func (r SkipRule) implementsRulesetsVersionGetResponseRule() {} + +func (r SkipRule) implementsRulesetsVersionByTagGetResponseRule() {} // The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsRedirectRuleAction string +type SkipRuleAction string const ( - RuleDeleteResponseRulesRulesetsRedirectRuleActionRedirect RuleDeleteResponseRulesRulesetsRedirectRuleAction = "redirect" + SkipRuleActionSkip SkipRuleAction = "skip" ) -func (r RuleDeleteResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { +func (r SkipRuleAction) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsRedirectRuleActionRedirect: + case SkipRuleActionSkip: return true } return false } // The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParameters] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` +type SkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases []SkipRuleActionParametersPhase `json:"phases"` + // A list of legacy security products to skip the execution of. + Products []SkipRuleActionParametersProduct `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules map[string][]string `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset SkipRuleActionParametersRuleset `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets []string `json:"rulesets"` + JSON skipRuleActionParametersJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromList] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field +// skipRuleActionParametersJSON contains the JSON metadata for the struct +// [SkipRuleActionParameters] +type skipRuleActionParametersJSON struct { + Phases apijson.Field + Products apijson.Field + Rules apijson.Field + Ruleset apijson.Field + Rulesets apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { +func (r *SkipRuleActionParameters) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { +func (r skipRuleActionParametersJSON) RawJSON() string { return r.raw } -// Serve a redirect based on the request properties. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// A phase to skip the execution of. +type SkipRuleActionParametersPhase string -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + SkipRuleActionParametersPhaseDDoSL4 SkipRuleActionParametersPhase = "ddos_l4" + SkipRuleActionParametersPhaseDDoSL7 SkipRuleActionParametersPhase = "ddos_l7" + SkipRuleActionParametersPhaseHTTPConfigSettings SkipRuleActionParametersPhase = "http_config_settings" + SkipRuleActionParametersPhaseHTTPCustomErrors SkipRuleActionParametersPhase = "http_custom_errors" + SkipRuleActionParametersPhaseHTTPLogCustomFields SkipRuleActionParametersPhase = "http_log_custom_fields" + SkipRuleActionParametersPhaseHTTPRatelimit SkipRuleActionParametersPhase = "http_ratelimit" + SkipRuleActionParametersPhaseHTTPRequestCacheSettings SkipRuleActionParametersPhase = "http_request_cache_settings" + SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect SkipRuleActionParametersPhase = "http_request_dynamic_redirect" + SkipRuleActionParametersPhaseHTTPRequestFirewallCustom SkipRuleActionParametersPhase = "http_request_firewall_custom" + SkipRuleActionParametersPhaseHTTPRequestFirewallManaged SkipRuleActionParametersPhase = "http_request_firewall_managed" + SkipRuleActionParametersPhaseHTTPRequestLateTransform SkipRuleActionParametersPhase = "http_request_late_transform" + SkipRuleActionParametersPhaseHTTPRequestOrigin SkipRuleActionParametersPhase = "http_request_origin" + SkipRuleActionParametersPhaseHTTPRequestRedirect SkipRuleActionParametersPhase = "http_request_redirect" + SkipRuleActionParametersPhaseHTTPRequestSanitize SkipRuleActionParametersPhase = "http_request_sanitize" + SkipRuleActionParametersPhaseHTTPRequestSbfm SkipRuleActionParametersPhase = "http_request_sbfm" + SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration SkipRuleActionParametersPhase = "http_request_select_configuration" + SkipRuleActionParametersPhaseHTTPRequestTransform SkipRuleActionParametersPhase = "http_request_transform" + SkipRuleActionParametersPhaseHTTPResponseCompression SkipRuleActionParametersPhase = "http_response_compression" + SkipRuleActionParametersPhaseHTTPResponseFirewallManaged SkipRuleActionParametersPhase = "http_response_firewall_managed" + SkipRuleActionParametersPhaseHTTPResponseHeadersTransform SkipRuleActionParametersPhase = "http_response_headers_transform" + SkipRuleActionParametersPhaseMagicTransit SkipRuleActionParametersPhase = "magic_transit" + SkipRuleActionParametersPhaseMagicTransitIDsManaged SkipRuleActionParametersPhase = "magic_transit_ids_managed" + SkipRuleActionParametersPhaseMagicTransitManaged SkipRuleActionParametersPhase = "magic_transit_managed" +) -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw +func (r SkipRuleActionParametersPhase) IsKnown() bool { + switch r { + case SkipRuleActionParametersPhaseDDoSL4, SkipRuleActionParametersPhaseDDoSL7, SkipRuleActionParametersPhaseHTTPConfigSettings, SkipRuleActionParametersPhaseHTTPCustomErrors, SkipRuleActionParametersPhaseHTTPLogCustomFields, SkipRuleActionParametersPhaseHTTPRatelimit, SkipRuleActionParametersPhaseHTTPRequestCacheSettings, SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, SkipRuleActionParametersPhaseHTTPRequestFirewallCustom, SkipRuleActionParametersPhaseHTTPRequestFirewallManaged, SkipRuleActionParametersPhaseHTTPRequestLateTransform, SkipRuleActionParametersPhaseHTTPRequestOrigin, SkipRuleActionParametersPhaseHTTPRequestRedirect, SkipRuleActionParametersPhaseHTTPRequestSanitize, SkipRuleActionParametersPhaseHTTPRequestSbfm, SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, SkipRuleActionParametersPhaseHTTPRequestTransform, SkipRuleActionParametersPhaseHTTPResponseCompression, SkipRuleActionParametersPhaseHTTPResponseFirewallManaged, SkipRuleActionParametersPhaseHTTPResponseHeadersTransform, SkipRuleActionParametersPhaseMagicTransit, SkipRuleActionParametersPhaseMagicTransitIDsManaged, SkipRuleActionParametersPhaseMagicTransitManaged: + return true + } + return false } -// The status code to be used for the redirect. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 +// The name of a legacy security product to skip the execution of. +type SkipRuleActionParametersProduct string const ( - RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 + SkipRuleActionParametersProductBic SkipRuleActionParametersProduct = "bic" + SkipRuleActionParametersProductHot SkipRuleActionParametersProduct = "hot" + SkipRuleActionParametersProductRateLimit SkipRuleActionParametersProduct = "rateLimit" + SkipRuleActionParametersProductSecurityLevel SkipRuleActionParametersProduct = "securityLevel" + SkipRuleActionParametersProductUABlock SkipRuleActionParametersProduct = "uaBlock" + SkipRuleActionParametersProductWAF SkipRuleActionParametersProduct = "waf" + SkipRuleActionParametersProductZoneLockdown SkipRuleActionParametersProduct = "zoneLockdown" ) -func (r RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { +func (r SkipRuleActionParametersProduct) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: + case SkipRuleActionParametersProductBic, SkipRuleActionParametersProductHot, SkipRuleActionParametersProductRateLimit, SkipRuleActionParametersProductSecurityLevel, SkipRuleActionParametersProductUABlock, SkipRuleActionParametersProductWAF, SkipRuleActionParametersProductZoneLockdown: return true } return false } -// The URL to redirect the request to. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type SkipRuleActionParametersRuleset string -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +const ( + SkipRuleActionParametersRulesetCurrent SkipRuleActionParametersRuleset = "current" +) -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw +func (r SkipRuleActionParametersRuleset) IsKnown() bool { + switch r { + case SkipRuleActionParametersRulesetCurrent: + return true + } + return false } -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +type SkipRuleParam struct { + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[SkipRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[SkipRuleActionParametersParam] `json:"action_parameters"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -func (r RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union +func (r SkipRuleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() +func (r SkipRuleParam) implementsRulesetsRulesetNewParamsRuleUnion() {} + +func (r SkipRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} + +func (r SkipRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} + +// The parameters configuring the rule's action. +type SkipRuleActionParametersParam struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]SkipRuleActionParametersPhase] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]SkipRuleActionParametersProduct] `json:"products"` + // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the + // execution of. This option is incompatible with the ruleset option. + Rules param.Field[map[string][]string] `json:"rules"` + // A ruleset to skip the execution of. This option is incompatible with the + // rulesets, rules and phases options. + Ruleset param.Field[SkipRuleActionParametersRuleset] `json:"ruleset"` + // A list of ruleset IDs to skip the execution of. This option is incompatible with + // the ruleset and phases options. + Rulesets param.Field[[]string] `json:"rulesets"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) +func (r SkipRuleActionParametersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` +// A ruleset object. +type RuleNewResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind RuleNewResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase RuleNewResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []RuleNewResponseRule `json:"rules,required"` + // The version of the ruleset. + Version string `json:"version,required"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON ruleNewResponseJSON `json:"-"` } -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field +// ruleNewResponseJSON contains the JSON metadata for the struct [RuleNewResponse] +type ruleNewResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { +func (r *RuleNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { +func (r ruleNewResponseJSON) RawJSON() string { return r.raw } -func (r RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} +// The kind of the ruleset. +type RuleNewResponseKind string -type RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} +const ( + RuleNewResponseKindManaged RuleNewResponseKind = "managed" + RuleNewResponseKindCustom RuleNewResponseKind = "custom" + RuleNewResponseKindRoot RuleNewResponseKind = "root" + RuleNewResponseKindZone RuleNewResponseKind = "zone" +) -// ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r RuleNewResponseKind) IsKnown() bool { + switch r { + case RuleNewResponseKindManaged, RuleNewResponseKindCustom, RuleNewResponseKindRoot, RuleNewResponseKindZone: + return true + } + return false } -func (r *RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +// The phase of the ruleset. +type RuleNewResponsePhase string -func (r ruleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} +const ( + RuleNewResponsePhaseDDoSL4 RuleNewResponsePhase = "ddos_l4" + RuleNewResponsePhaseDDoSL7 RuleNewResponsePhase = "ddos_l7" + RuleNewResponsePhaseHTTPConfigSettings RuleNewResponsePhase = "http_config_settings" + RuleNewResponsePhaseHTTPCustomErrors RuleNewResponsePhase = "http_custom_errors" + RuleNewResponsePhaseHTTPLogCustomFields RuleNewResponsePhase = "http_log_custom_fields" + RuleNewResponsePhaseHTTPRatelimit RuleNewResponsePhase = "http_ratelimit" + RuleNewResponsePhaseHTTPRequestCacheSettings RuleNewResponsePhase = "http_request_cache_settings" + RuleNewResponsePhaseHTTPRequestDynamicRedirect RuleNewResponsePhase = "http_request_dynamic_redirect" + RuleNewResponsePhaseHTTPRequestFirewallCustom RuleNewResponsePhase = "http_request_firewall_custom" + RuleNewResponsePhaseHTTPRequestFirewallManaged RuleNewResponsePhase = "http_request_firewall_managed" + RuleNewResponsePhaseHTTPRequestLateTransform RuleNewResponsePhase = "http_request_late_transform" + RuleNewResponsePhaseHTTPRequestOrigin RuleNewResponsePhase = "http_request_origin" + RuleNewResponsePhaseHTTPRequestRedirect RuleNewResponsePhase = "http_request_redirect" + RuleNewResponsePhaseHTTPRequestSanitize RuleNewResponsePhase = "http_request_sanitize" + RuleNewResponsePhaseHTTPRequestSbfm RuleNewResponsePhase = "http_request_sbfm" + RuleNewResponsePhaseHTTPRequestSelectConfiguration RuleNewResponsePhase = "http_request_select_configuration" + RuleNewResponsePhaseHTTPRequestTransform RuleNewResponsePhase = "http_request_transform" + RuleNewResponsePhaseHTTPResponseCompression RuleNewResponsePhase = "http_response_compression" + RuleNewResponsePhaseHTTPResponseFirewallManaged RuleNewResponsePhase = "http_response_firewall_managed" + RuleNewResponsePhaseHTTPResponseHeadersTransform RuleNewResponsePhase = "http_response_headers_transform" + RuleNewResponsePhaseMagicTransit RuleNewResponsePhase = "magic_transit" + RuleNewResponsePhaseMagicTransitIDsManaged RuleNewResponsePhase = "magic_transit_ids_managed" + RuleNewResponsePhaseMagicTransitManaged RuleNewResponsePhase = "magic_transit_managed" +) -func (r RuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRuleDeleteResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { +func (r RuleNewResponsePhase) IsKnown() bool { + switch r { + case RuleNewResponsePhaseDDoSL4, RuleNewResponsePhaseDDoSL7, RuleNewResponsePhaseHTTPConfigSettings, RuleNewResponsePhaseHTTPCustomErrors, RuleNewResponsePhaseHTTPLogCustomFields, RuleNewResponsePhaseHTTPRatelimit, RuleNewResponsePhaseHTTPRequestCacheSettings, RuleNewResponsePhaseHTTPRequestDynamicRedirect, RuleNewResponsePhaseHTTPRequestFirewallCustom, RuleNewResponsePhaseHTTPRequestFirewallManaged, RuleNewResponsePhaseHTTPRequestLateTransform, RuleNewResponsePhaseHTTPRequestOrigin, RuleNewResponsePhaseHTTPRequestRedirect, RuleNewResponsePhaseHTTPRequestSanitize, RuleNewResponsePhaseHTTPRequestSbfm, RuleNewResponsePhaseHTTPRequestSelectConfiguration, RuleNewResponsePhaseHTTPRequestTransform, RuleNewResponsePhaseHTTPResponseCompression, RuleNewResponsePhaseHTTPResponseFirewallManaged, RuleNewResponsePhaseHTTPResponseHeadersTransform, RuleNewResponsePhaseMagicTransit, RuleNewResponsePhaseMagicTransitIDsManaged, RuleNewResponsePhaseMagicTransitManaged: + return true + } + return false } -type RuleDeleteResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` +type RuleNewResponseRule struct { // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + Action RuleNewResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` // An informative description of the rule. Description string `json:"description"` // Whether the rule should be executed. Enabled bool `json:"enabled"` // The expression defining which traffic will match the rule. Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleJSON `json:"-"` + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON ruleNewResponseRuleJSON `json:"-"` + union RuleNewResponseRulesUnion } -// ruleDeleteResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [RuleDeleteResponseRulesRulesetsRewriteRule] -type ruleDeleteResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field +// ruleNewResponseRuleJSON contains the JSON metadata for the struct +// [RuleNewResponseRule] +type ruleNewResponseRuleJSON struct { Action apijson.Field ActionParameters apijson.Field Categories apijson.Field Description apijson.Field Enabled apijson.Field Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field Logging apijson.Field Ref apijson.Field + Version apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleDeleteResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { +func (r ruleNewResponseRuleJSON) RawJSON() string { return r.raw } -func (r RuleDeleteResponseRulesRulesetsRewriteRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsRewriteRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsRewriteRuleActionRewrite RuleDeleteResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsRewriteRuleActionRewrite: - return true +func (r *RuleNewResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParameters] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw + return apijson.Port(r.union, &r) } -// Remove the header from the request. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion +func (r RuleNewResponseRule) AsUnion() RuleNewResponseRulesUnion { + return r.union } -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader() +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type RuleNewResponseRulesUnion interface { + implementsRulesetsRuleNewResponseRule() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", + reflect.TypeOf((*RuleNewResponseRulesUnion)(nil)).Elem(), + "action", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", }, ) } -// Remove the header from the request. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string +// The action to perform when the rule matches. +type RuleNewResponseRulesAction string const ( - RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" + RuleNewResponseRulesActionBlock RuleNewResponseRulesAction = "block" + RuleNewResponseRulesActionChallenge RuleNewResponseRulesAction = "challenge" + RuleNewResponseRulesActionCompressResponse RuleNewResponseRulesAction = "compress_response" + RuleNewResponseRulesActionExecute RuleNewResponseRulesAction = "execute" + RuleNewResponseRulesActionJsChallenge RuleNewResponseRulesAction = "js_challenge" + RuleNewResponseRulesActionLog RuleNewResponseRulesAction = "log" + RuleNewResponseRulesActionManagedChallenge RuleNewResponseRulesAction = "managed_challenge" + RuleNewResponseRulesActionRedirect RuleNewResponseRulesAction = "redirect" + RuleNewResponseRulesActionRewrite RuleNewResponseRulesAction = "rewrite" + RuleNewResponseRulesActionRoute RuleNewResponseRulesAction = "route" + RuleNewResponseRulesActionScore RuleNewResponseRulesAction = "score" + RuleNewResponseRulesActionServeError RuleNewResponseRulesAction = "serve_error" + RuleNewResponseRulesActionSetConfig RuleNewResponseRulesAction = "set_config" + RuleNewResponseRulesActionSkip RuleNewResponseRulesAction = "skip" + RuleNewResponseRulesActionSetCacheSettings RuleNewResponseRulesAction = "set_cache_settings" ) -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { +func (r RuleNewResponseRulesAction) IsKnown() bool { switch r { - case RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: + case RuleNewResponseRulesActionBlock, RuleNewResponseRulesActionChallenge, RuleNewResponseRulesActionCompressResponse, RuleNewResponseRulesActionExecute, RuleNewResponseRulesActionJsChallenge, RuleNewResponseRulesActionLog, RuleNewResponseRulesActionManagedChallenge, RuleNewResponseRulesActionRedirect, RuleNewResponseRulesActionRewrite, RuleNewResponseRulesActionRoute, RuleNewResponseRulesActionScore, RuleNewResponseRulesActionServeError, RuleNewResponseRulesActionSetConfig, RuleNewResponseRulesActionSkip, RuleNewResponseRulesActionSetCacheSettings: return true } return false } -// URI to rewrite the request to. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURI] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath() +// A ruleset object. +type RuleDeleteResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind RuleDeleteResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase RuleDeleteResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []RuleDeleteResponseRule `json:"rules,required"` + // The version of the ruleset. + Version string `json:"version,required"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON ruleDeleteResponseJSON `json:"-"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRuleDeleteResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RuleDeleteResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [RuleDeleteResponseRulesRulesetsRouteRule] -type ruleDeleteResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsRouteRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsRouteRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsRouteRuleActionRoute RuleDeleteResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r RuleDeleteResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RuleDeleteResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RuleDeleteResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON ruleDeleteResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleDeleteResponseRulesRulesetsRouteRuleActionParameters] -type ruleDeleteResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RuleDeleteResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON ruleDeleteResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRouteRuleActionParametersOrigin] -type ruleDeleteResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type RuleDeleteResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON ruleDeleteResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsRouteRuleActionParametersSni] -type ruleDeleteResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type RuleDeleteResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [RuleDeleteResponseRulesRulesetsScoreRule] -type ruleDeleteResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsScoreRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsScoreRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsScoreRuleActionScore RuleDeleteResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r RuleDeleteResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON ruleDeleteResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleDeleteResponseRulesRulesetsScoreRuleActionParameters] -type ruleDeleteResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type RuleDeleteResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [RuleDeleteResponseRulesRulesetsServeErrorRule] -type ruleDeleteResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsServeErrorRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsServeErrorRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsServeErrorRuleActionServeError RuleDeleteResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RuleDeleteResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON ruleDeleteResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsServeErrorRuleActionParameters] -type ruleDeleteResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RuleDeleteResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RuleDeleteResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [RuleDeleteResponseRulesRulesetsSetConfigRule] -type ruleDeleteResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsSetConfigRule) implementsRulesetsRuleDeleteResponseRule() {} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsSetConfigRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsSetConfigRuleActionSetConfig RuleDeleteResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RuleDeleteResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetConfigRuleActionParameters] -type ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RuleDeleteResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [RuleDeleteResponseRulesRulesetsSetCacheSettingsRule] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleDeleteResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRuleDeleteResponseRule() { -} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type RuleDeleteResponseRulesAction string - -const ( - RuleDeleteResponseRulesActionBlock RuleDeleteResponseRulesAction = "block" - RuleDeleteResponseRulesActionChallenge RuleDeleteResponseRulesAction = "challenge" - RuleDeleteResponseRulesActionCompressResponse RuleDeleteResponseRulesAction = "compress_response" - RuleDeleteResponseRulesActionExecute RuleDeleteResponseRulesAction = "execute" - RuleDeleteResponseRulesActionJsChallenge RuleDeleteResponseRulesAction = "js_challenge" - RuleDeleteResponseRulesActionLog RuleDeleteResponseRulesAction = "log" - RuleDeleteResponseRulesActionManagedChallenge RuleDeleteResponseRulesAction = "managed_challenge" - RuleDeleteResponseRulesActionRedirect RuleDeleteResponseRulesAction = "redirect" - RuleDeleteResponseRulesActionRewrite RuleDeleteResponseRulesAction = "rewrite" - RuleDeleteResponseRulesActionRoute RuleDeleteResponseRulesAction = "route" - RuleDeleteResponseRulesActionScore RuleDeleteResponseRulesAction = "score" - RuleDeleteResponseRulesActionServeError RuleDeleteResponseRulesAction = "serve_error" - RuleDeleteResponseRulesActionSetConfig RuleDeleteResponseRulesAction = "set_config" - RuleDeleteResponseRulesActionSkip RuleDeleteResponseRulesAction = "skip" - RuleDeleteResponseRulesActionSetCacheSettings RuleDeleteResponseRulesAction = "set_cache_settings" -) - -func (r RuleDeleteResponseRulesAction) IsKnown() bool { - switch r { - case RuleDeleteResponseRulesActionBlock, RuleDeleteResponseRulesActionChallenge, RuleDeleteResponseRulesActionCompressResponse, RuleDeleteResponseRulesActionExecute, RuleDeleteResponseRulesActionJsChallenge, RuleDeleteResponseRulesActionLog, RuleDeleteResponseRulesActionManagedChallenge, RuleDeleteResponseRulesActionRedirect, RuleDeleteResponseRulesActionRewrite, RuleDeleteResponseRulesActionRoute, RuleDeleteResponseRulesActionScore, RuleDeleteResponseRulesActionServeError, RuleDeleteResponseRulesActionSetConfig, RuleDeleteResponseRulesActionSkip, RuleDeleteResponseRulesActionSetCacheSettings: - return true - } - return false -} - -// A ruleset object. -type RuleEditResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind RuleEditResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase RuleEditResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []RuleEditResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON ruleEditResponseJSON `json:"-"` -} - -// ruleEditResponseJSON contains the JSON metadata for the struct -// [RuleEditResponse] -type ruleEditResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field - Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseJSON) RawJSON() string { - return r.raw -} - -// The kind of the ruleset. -type RuleEditResponseKind string - -const ( - RuleEditResponseKindManaged RuleEditResponseKind = "managed" - RuleEditResponseKindCustom RuleEditResponseKind = "custom" - RuleEditResponseKindRoot RuleEditResponseKind = "root" - RuleEditResponseKindZone RuleEditResponseKind = "zone" -) - -func (r RuleEditResponseKind) IsKnown() bool { - switch r { - case RuleEditResponseKindManaged, RuleEditResponseKindCustom, RuleEditResponseKindRoot, RuleEditResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RuleEditResponsePhase string - -const ( - RuleEditResponsePhaseDDoSL4 RuleEditResponsePhase = "ddos_l4" - RuleEditResponsePhaseDDoSL7 RuleEditResponsePhase = "ddos_l7" - RuleEditResponsePhaseHTTPConfigSettings RuleEditResponsePhase = "http_config_settings" - RuleEditResponsePhaseHTTPCustomErrors RuleEditResponsePhase = "http_custom_errors" - RuleEditResponsePhaseHTTPLogCustomFields RuleEditResponsePhase = "http_log_custom_fields" - RuleEditResponsePhaseHTTPRatelimit RuleEditResponsePhase = "http_ratelimit" - RuleEditResponsePhaseHTTPRequestCacheSettings RuleEditResponsePhase = "http_request_cache_settings" - RuleEditResponsePhaseHTTPRequestDynamicRedirect RuleEditResponsePhase = "http_request_dynamic_redirect" - RuleEditResponsePhaseHTTPRequestFirewallCustom RuleEditResponsePhase = "http_request_firewall_custom" - RuleEditResponsePhaseHTTPRequestFirewallManaged RuleEditResponsePhase = "http_request_firewall_managed" - RuleEditResponsePhaseHTTPRequestLateTransform RuleEditResponsePhase = "http_request_late_transform" - RuleEditResponsePhaseHTTPRequestOrigin RuleEditResponsePhase = "http_request_origin" - RuleEditResponsePhaseHTTPRequestRedirect RuleEditResponsePhase = "http_request_redirect" - RuleEditResponsePhaseHTTPRequestSanitize RuleEditResponsePhase = "http_request_sanitize" - RuleEditResponsePhaseHTTPRequestSbfm RuleEditResponsePhase = "http_request_sbfm" - RuleEditResponsePhaseHTTPRequestSelectConfiguration RuleEditResponsePhase = "http_request_select_configuration" - RuleEditResponsePhaseHTTPRequestTransform RuleEditResponsePhase = "http_request_transform" - RuleEditResponsePhaseHTTPResponseCompression RuleEditResponsePhase = "http_response_compression" - RuleEditResponsePhaseHTTPResponseFirewallManaged RuleEditResponsePhase = "http_response_firewall_managed" - RuleEditResponsePhaseHTTPResponseHeadersTransform RuleEditResponsePhase = "http_response_headers_transform" - RuleEditResponsePhaseMagicTransit RuleEditResponsePhase = "magic_transit" - RuleEditResponsePhaseMagicTransitIDsManaged RuleEditResponsePhase = "magic_transit_ids_managed" - RuleEditResponsePhaseMagicTransitManaged RuleEditResponsePhase = "magic_transit_managed" -) - -func (r RuleEditResponsePhase) IsKnown() bool { - switch r { - case RuleEditResponsePhaseDDoSL4, RuleEditResponsePhaseDDoSL7, RuleEditResponsePhaseHTTPConfigSettings, RuleEditResponsePhaseHTTPCustomErrors, RuleEditResponsePhaseHTTPLogCustomFields, RuleEditResponsePhaseHTTPRatelimit, RuleEditResponsePhaseHTTPRequestCacheSettings, RuleEditResponsePhaseHTTPRequestDynamicRedirect, RuleEditResponsePhaseHTTPRequestFirewallCustom, RuleEditResponsePhaseHTTPRequestFirewallManaged, RuleEditResponsePhaseHTTPRequestLateTransform, RuleEditResponsePhaseHTTPRequestOrigin, RuleEditResponsePhaseHTTPRequestRedirect, RuleEditResponsePhaseHTTPRequestSanitize, RuleEditResponsePhaseHTTPRequestSbfm, RuleEditResponsePhaseHTTPRequestSelectConfiguration, RuleEditResponsePhaseHTTPRequestTransform, RuleEditResponsePhaseHTTPResponseCompression, RuleEditResponsePhaseHTTPResponseFirewallManaged, RuleEditResponsePhaseHTTPResponseHeadersTransform, RuleEditResponsePhaseMagicTransit, RuleEditResponsePhaseMagicTransitIDsManaged, RuleEditResponsePhaseMagicTransitManaged: - return true - } - return false -} - -type RuleEditResponseRule struct { - // The action to perform when the rule matches. - Action RuleEditResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON ruleEditResponseRuleJSON `json:"-"` - union RuleEditResponseRulesUnion -} - -// ruleEditResponseRuleJSON contains the JSON metadata for the struct -// [RuleEditResponseRule] -type ruleEditResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleEditResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r *RuleEditResponseRule) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleEditResponseRule) AsUnion() RuleEditResponseRulesUnion { - return r.union -} - -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RuleEditResponseRulesRulesetsChallengeRule], -// [rulesets.RuleEditResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], [rulesets.RuleEditResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], -// [rulesets.RuleEditResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RuleEditResponseRulesRulesetsRedirectRule], -// [rulesets.RuleEditResponseRulesRulesetsRewriteRule], -// [rulesets.RuleEditResponseRulesRulesetsRouteRule], -// [rulesets.RuleEditResponseRulesRulesetsScoreRule], -// [rulesets.RuleEditResponseRulesRulesetsServeErrorRule], -// [rulesets.RuleEditResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.RuleEditResponseRulesRulesetsSetCacheSettingsRule]. -type RuleEditResponseRulesUnion interface { - implementsRulesetsRuleEditResponseRule() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleEditResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", - }, - ) -} - -type RuleEditResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [RuleEditResponseRulesRulesetsChallengeRule] -type ruleEditResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsChallengeRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsChallengeRuleAction string - -const ( - RuleEditResponseRulesRulesetsChallengeRuleActionChallenge RuleEditResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r RuleEditResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsCompressResponseRuleJSON contains the JSON metadata -// for the struct [RuleEditResponseRulesRulesetsCompressResponseRule] -type ruleEditResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsCompressResponseRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsCompressResponseRuleAction string - -const ( - RuleEditResponseRulesRulesetsCompressResponseRuleActionCompressResponse RuleEditResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r RuleEditResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsCompressResponseRuleActionParameters] -type ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RuleEditResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata for -// the struct [RuleEditResponseRulesRulesetsJsChallengeRule] -type ruleEditResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsJsChallengeRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsJsChallengeRuleAction string - -const ( - RuleEditResponseRulesRulesetsJsChallengeRuleActionJsChallenge RuleEditResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RuleEditResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON metadata -// for the struct [RuleEditResponseRulesRulesetsManagedChallengeRule] -type ruleEditResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - RuleEditResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RuleEditResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RuleEditResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for the -// struct [RuleEditResponseRulesRulesetsRedirectRule] -type ruleEditResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRedirectRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsRedirectRuleAction string - -const ( - RuleEditResponseRulesRulesetsRedirectRuleActionRedirect RuleEditResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RuleEditResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParameters] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromList] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON contains -// the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRuleEditResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RuleEditResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for the -// struct [RuleEditResponseRulesRulesetsRewriteRule] -type ruleEditResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsRewriteRuleAction string - -const ( - RuleEditResponseRulesRulesetsRewriteRuleActionRewrite RuleEditResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RuleEditResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RuleEditResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParameters] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains the -// JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RuleEditResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURI] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains the -// JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRuleEditResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RuleEditResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [RuleEditResponseRulesRulesetsRouteRule] -type ruleEditResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsRouteRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsRouteRuleAction string - -const ( - RuleEditResponseRulesRulesetsRouteRuleActionRoute RuleEditResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r RuleEditResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RuleEditResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RuleEditResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON ruleEditResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct [RuleEditResponseRulesRulesetsRouteRuleActionParameters] -type ruleEditResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RuleEditResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON ruleEditResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [RuleEditResponseRulesRulesetsRouteRuleActionParametersOrigin] -type ruleEditResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type RuleEditResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON ruleEditResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the JSON -// metadata for the struct -// [RuleEditResponseRulesRulesetsRouteRuleActionParametersSni] -type ruleEditResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type RuleEditResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [RuleEditResponseRulesRulesetsScoreRule] -type ruleEditResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsScoreRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsScoreRuleAction string - -const ( - RuleEditResponseRulesRulesetsScoreRuleActionScore RuleEditResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r RuleEditResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON ruleEditResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct [RuleEditResponseRulesRulesetsScoreRuleActionParameters] -type ruleEditResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type RuleEditResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [RuleEditResponseRulesRulesetsServeErrorRule] -type ruleEditResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsServeErrorRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsServeErrorRuleAction string - -const ( - RuleEditResponseRulesRulesetsServeErrorRuleActionServeError RuleEditResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RuleEditResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON ruleEditResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RuleEditResponseRulesRulesetsServeErrorRuleActionParameters] -type ruleEditResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RuleEditResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [RuleEditResponseRulesRulesetsSetConfigRule] -type ruleEditResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsSetConfigRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsSetConfigRuleAction string - -const ( - RuleEditResponseRulesRulesetsSetConfigRuleActionSetConfig RuleEditResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RuleEditResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RuleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON ruleEditResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RuleEditResponseRulesRulesetsSetConfigRuleActionParameters] -type ruleEditResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RuleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON ruleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type ruleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RuleEditResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RuleEditResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RuleEditResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON metadata -// for the struct [RuleEditResponseRulesRulesetsSetCacheSettingsRule] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r RuleEditResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRuleEditResponseRule() {} - -// The action to perform when the rule matches. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RuleEditResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RuleEditResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field +// ruleDeleteResponseJSON contains the JSON metadata for the struct +// [RuleDeleteResponse] +type ruleDeleteResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { +func (r ruleDeleteResponseJSON) RawJSON() string { return r.raw } -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} +// The kind of the ruleset. +type RuleDeleteResponseKind string -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +const ( + RuleDeleteResponseKindManaged RuleDeleteResponseKind = "managed" + RuleDeleteResponseKindCustom RuleDeleteResponseKind = "custom" + RuleDeleteResponseKindRoot RuleDeleteResponseKind = "root" + RuleDeleteResponseKindZone RuleDeleteResponseKind = "zone" +) -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RuleDeleteResponseKind) IsKnown() bool { + switch r { + case RuleDeleteResponseKindManaged, RuleDeleteResponseKindCustom, RuleDeleteResponseKindRoot, RuleDeleteResponseKindZone: + return true + } + return false } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} +// The phase of the ruleset. +type RuleDeleteResponsePhase string -// build the cache key using a list of query string parameters that ARE in the -// request. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} +const ( + RuleDeleteResponsePhaseDDoSL4 RuleDeleteResponsePhase = "ddos_l4" + RuleDeleteResponsePhaseDDoSL7 RuleDeleteResponsePhase = "ddos_l7" + RuleDeleteResponsePhaseHTTPConfigSettings RuleDeleteResponsePhase = "http_config_settings" + RuleDeleteResponsePhaseHTTPCustomErrors RuleDeleteResponsePhase = "http_custom_errors" + RuleDeleteResponsePhaseHTTPLogCustomFields RuleDeleteResponsePhase = "http_log_custom_fields" + RuleDeleteResponsePhaseHTTPRatelimit RuleDeleteResponsePhase = "http_ratelimit" + RuleDeleteResponsePhaseHTTPRequestCacheSettings RuleDeleteResponsePhase = "http_request_cache_settings" + RuleDeleteResponsePhaseHTTPRequestDynamicRedirect RuleDeleteResponsePhase = "http_request_dynamic_redirect" + RuleDeleteResponsePhaseHTTPRequestFirewallCustom RuleDeleteResponsePhase = "http_request_firewall_custom" + RuleDeleteResponsePhaseHTTPRequestFirewallManaged RuleDeleteResponsePhase = "http_request_firewall_managed" + RuleDeleteResponsePhaseHTTPRequestLateTransform RuleDeleteResponsePhase = "http_request_late_transform" + RuleDeleteResponsePhaseHTTPRequestOrigin RuleDeleteResponsePhase = "http_request_origin" + RuleDeleteResponsePhaseHTTPRequestRedirect RuleDeleteResponsePhase = "http_request_redirect" + RuleDeleteResponsePhaseHTTPRequestSanitize RuleDeleteResponsePhase = "http_request_sanitize" + RuleDeleteResponsePhaseHTTPRequestSbfm RuleDeleteResponsePhase = "http_request_sbfm" + RuleDeleteResponsePhaseHTTPRequestSelectConfiguration RuleDeleteResponsePhase = "http_request_select_configuration" + RuleDeleteResponsePhaseHTTPRequestTransform RuleDeleteResponsePhase = "http_request_transform" + RuleDeleteResponsePhaseHTTPResponseCompression RuleDeleteResponsePhase = "http_response_compression" + RuleDeleteResponsePhaseHTTPResponseFirewallManaged RuleDeleteResponsePhase = "http_response_firewall_managed" + RuleDeleteResponsePhaseHTTPResponseHeadersTransform RuleDeleteResponsePhase = "http_response_headers_transform" + RuleDeleteResponsePhaseMagicTransit RuleDeleteResponsePhase = "magic_transit" + RuleDeleteResponsePhaseMagicTransitIDsManaged RuleDeleteResponsePhase = "magic_transit_ids_managed" + RuleDeleteResponsePhaseMagicTransitManaged RuleDeleteResponsePhase = "magic_transit_managed" +) -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r RuleDeleteResponsePhase) IsKnown() bool { + switch r { + case RuleDeleteResponsePhaseDDoSL4, RuleDeleteResponsePhaseDDoSL7, RuleDeleteResponsePhaseHTTPConfigSettings, RuleDeleteResponsePhaseHTTPCustomErrors, RuleDeleteResponsePhaseHTTPLogCustomFields, RuleDeleteResponsePhaseHTTPRatelimit, RuleDeleteResponsePhaseHTTPRequestCacheSettings, RuleDeleteResponsePhaseHTTPRequestDynamicRedirect, RuleDeleteResponsePhaseHTTPRequestFirewallCustom, RuleDeleteResponsePhaseHTTPRequestFirewallManaged, RuleDeleteResponsePhaseHTTPRequestLateTransform, RuleDeleteResponsePhaseHTTPRequestOrigin, RuleDeleteResponsePhaseHTTPRequestRedirect, RuleDeleteResponsePhaseHTTPRequestSanitize, RuleDeleteResponsePhaseHTTPRequestSbfm, RuleDeleteResponsePhaseHTTPRequestSelectConfiguration, RuleDeleteResponsePhaseHTTPRequestTransform, RuleDeleteResponsePhaseHTTPResponseCompression, RuleDeleteResponsePhaseHTTPResponseFirewallManaged, RuleDeleteResponsePhaseHTTPResponseHeadersTransform, RuleDeleteResponsePhaseMagicTransit, RuleDeleteResponsePhaseMagicTransitIDsManaged, RuleDeleteResponsePhaseMagicTransitManaged: + return true + } + return false } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type RuleDeleteResponseRule struct { + // The action to perform when the rule matches. + Action RuleDeleteResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON ruleDeleteResponseRuleJSON `json:"-"` + union RuleDeleteResponseRulesUnion } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw +// ruleDeleteResponseRuleJSON contains the JSON metadata for the struct +// [RuleDeleteResponseRule] +type ruleDeleteResponseRuleJSON struct { + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field + Logging apijson.Field + Ref apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// Characteristics of the request user agent used in building the cache key. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` +func (r ruleDeleteResponseRuleJSON) RawJSON() string { + return r.raw } -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r *RuleDeleteResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RuleDeleteResponseRule) AsUnion() RuleDeleteResponseRulesUnion { + return r.union } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type RuleDeleteResponseRulesUnion interface { + implementsRulesetsRuleDeleteResponseRule() } -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RuleDeleteResponseRulesUnion)(nil)).Elem(), + "action", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", + }, + ) } -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// The action to perform when the rule matches. +type RuleDeleteResponseRulesAction string -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + RuleDeleteResponseRulesActionBlock RuleDeleteResponseRulesAction = "block" + RuleDeleteResponseRulesActionChallenge RuleDeleteResponseRulesAction = "challenge" + RuleDeleteResponseRulesActionCompressResponse RuleDeleteResponseRulesAction = "compress_response" + RuleDeleteResponseRulesActionExecute RuleDeleteResponseRulesAction = "execute" + RuleDeleteResponseRulesActionJsChallenge RuleDeleteResponseRulesAction = "js_challenge" + RuleDeleteResponseRulesActionLog RuleDeleteResponseRulesAction = "log" + RuleDeleteResponseRulesActionManagedChallenge RuleDeleteResponseRulesAction = "managed_challenge" + RuleDeleteResponseRulesActionRedirect RuleDeleteResponseRulesAction = "redirect" + RuleDeleteResponseRulesActionRewrite RuleDeleteResponseRulesAction = "rewrite" + RuleDeleteResponseRulesActionRoute RuleDeleteResponseRulesAction = "route" + RuleDeleteResponseRulesActionScore RuleDeleteResponseRulesAction = "score" + RuleDeleteResponseRulesActionServeError RuleDeleteResponseRulesAction = "serve_error" + RuleDeleteResponseRulesActionSetConfig RuleDeleteResponseRulesAction = "set_config" + RuleDeleteResponseRulesActionSkip RuleDeleteResponseRulesAction = "skip" + RuleDeleteResponseRulesActionSetCacheSettings RuleDeleteResponseRulesAction = "set_cache_settings" +) -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw +func (r RuleDeleteResponseRulesAction) IsKnown() bool { + switch r { + case RuleDeleteResponseRulesActionBlock, RuleDeleteResponseRulesActionChallenge, RuleDeleteResponseRulesActionCompressResponse, RuleDeleteResponseRulesActionExecute, RuleDeleteResponseRulesActionJsChallenge, RuleDeleteResponseRulesActionLog, RuleDeleteResponseRulesActionManagedChallenge, RuleDeleteResponseRulesActionRedirect, RuleDeleteResponseRulesActionRewrite, RuleDeleteResponseRulesActionRoute, RuleDeleteResponseRulesActionScore, RuleDeleteResponseRulesActionServeError, RuleDeleteResponseRulesActionSetConfig, RuleDeleteResponseRulesActionSkip, RuleDeleteResponseRulesActionSetCacheSettings: + return true + } + return false } -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` +// A ruleset object. +type RuleEditResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind RuleEditResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase RuleEditResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []RuleEditResponseRule `json:"rules,required"` + // The version of the ruleset. + Version string `json:"version,required"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON ruleEditResponseJSON `json:"-"` } -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field +// ruleEditResponseJSON contains the JSON metadata for the struct +// [RuleEditResponse] +type ruleEditResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { +func (r *RuleEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { +func (r ruleEditResponseJSON) RawJSON() string { return r.raw } -// edge ttl options -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string +// The kind of the ruleset. +type RuleEditResponseKind string const ( - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" + RuleEditResponseKindManaged RuleEditResponseKind = "managed" + RuleEditResponseKindCustom RuleEditResponseKind = "custom" + RuleEditResponseKindRoot RuleEditResponseKind = "root" + RuleEditResponseKindZone RuleEditResponseKind = "zone" ) -func (r RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { +func (r RuleEditResponseKind) IsKnown() bool { switch r { - case RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: + case RuleEditResponseKindManaged, RuleEditResponseKindCustom, RuleEditResponseKindRoot, RuleEditResponseKindZone: return true } return false } -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +// The phase of the ruleset. +type RuleEditResponsePhase string -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} +const ( + RuleEditResponsePhaseDDoSL4 RuleEditResponsePhase = "ddos_l4" + RuleEditResponsePhaseDDoSL7 RuleEditResponsePhase = "ddos_l7" + RuleEditResponsePhaseHTTPConfigSettings RuleEditResponsePhase = "http_config_settings" + RuleEditResponsePhaseHTTPCustomErrors RuleEditResponsePhase = "http_custom_errors" + RuleEditResponsePhaseHTTPLogCustomFields RuleEditResponsePhase = "http_log_custom_fields" + RuleEditResponsePhaseHTTPRatelimit RuleEditResponsePhase = "http_ratelimit" + RuleEditResponsePhaseHTTPRequestCacheSettings RuleEditResponsePhase = "http_request_cache_settings" + RuleEditResponsePhaseHTTPRequestDynamicRedirect RuleEditResponsePhase = "http_request_dynamic_redirect" + RuleEditResponsePhaseHTTPRequestFirewallCustom RuleEditResponsePhase = "http_request_firewall_custom" + RuleEditResponsePhaseHTTPRequestFirewallManaged RuleEditResponsePhase = "http_request_firewall_managed" + RuleEditResponsePhaseHTTPRequestLateTransform RuleEditResponsePhase = "http_request_late_transform" + RuleEditResponsePhaseHTTPRequestOrigin RuleEditResponsePhase = "http_request_origin" + RuleEditResponsePhaseHTTPRequestRedirect RuleEditResponsePhase = "http_request_redirect" + RuleEditResponsePhaseHTTPRequestSanitize RuleEditResponsePhase = "http_request_sanitize" + RuleEditResponsePhaseHTTPRequestSbfm RuleEditResponsePhase = "http_request_sbfm" + RuleEditResponsePhaseHTTPRequestSelectConfiguration RuleEditResponsePhase = "http_request_select_configuration" + RuleEditResponsePhaseHTTPRequestTransform RuleEditResponsePhase = "http_request_transform" + RuleEditResponsePhaseHTTPResponseCompression RuleEditResponsePhase = "http_response_compression" + RuleEditResponsePhaseHTTPResponseFirewallManaged RuleEditResponsePhase = "http_response_firewall_managed" + RuleEditResponsePhaseHTTPResponseHeadersTransform RuleEditResponsePhase = "http_response_headers_transform" + RuleEditResponsePhaseMagicTransit RuleEditResponsePhase = "magic_transit" + RuleEditResponsePhaseMagicTransitIDsManaged RuleEditResponsePhase = "magic_transit_ids_managed" + RuleEditResponsePhaseMagicTransitManaged RuleEditResponsePhase = "magic_transit_managed" +) -// The range of status codes used to apply the selected mode. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` +func (r RuleEditResponsePhase) IsKnown() bool { + switch r { + case RuleEditResponsePhaseDDoSL4, RuleEditResponsePhaseDDoSL7, RuleEditResponsePhaseHTTPConfigSettings, RuleEditResponsePhaseHTTPCustomErrors, RuleEditResponsePhaseHTTPLogCustomFields, RuleEditResponsePhaseHTTPRatelimit, RuleEditResponsePhaseHTTPRequestCacheSettings, RuleEditResponsePhaseHTTPRequestDynamicRedirect, RuleEditResponsePhaseHTTPRequestFirewallCustom, RuleEditResponsePhaseHTTPRequestFirewallManaged, RuleEditResponsePhaseHTTPRequestLateTransform, RuleEditResponsePhaseHTTPRequestOrigin, RuleEditResponsePhaseHTTPRequestRedirect, RuleEditResponsePhaseHTTPRequestSanitize, RuleEditResponsePhaseHTTPRequestSbfm, RuleEditResponsePhaseHTTPRequestSelectConfiguration, RuleEditResponsePhaseHTTPRequestTransform, RuleEditResponsePhaseHTTPResponseCompression, RuleEditResponsePhaseHTTPResponseFirewallManaged, RuleEditResponsePhaseHTTPResponseHeadersTransform, RuleEditResponsePhaseMagicTransit, RuleEditResponsePhaseMagicTransitIDsManaged, RuleEditResponsePhaseMagicTransitManaged: + return true + } + return false } -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field +type RuleEditResponseRule struct { + // The action to perform when the rule matches. + Action RuleEditResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` + // An informative description of the rule. + Description string `json:"description"` + // Whether the rule should be executed. + Enabled bool `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // An object configuring the rule's logging behavior. + Logging Logging `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON ruleEditResponseRuleJSON `json:"-"` + union RuleEditResponseRulesUnion } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// ruleEditResponseRuleJSON contains the JSON metadata for the struct +// [RuleEditResponseRule] +type ruleEditResponseRuleJSON struct { + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field + Logging apijson.Field + Ref apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { +func (r ruleEditResponseRuleJSON) RawJSON() string { return r.raw } -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` +func (r *RuleEditResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -// ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r RuleEditResponseRule) AsUnion() RuleEditResponseRulesUnion { + return r.union } -func (r *RuleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type RuleEditResponseRulesUnion interface { + implementsRulesetsRuleEditResponseRule() } -func (r ruleEditResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RuleEditResponseRulesUnion)(nil)).Elem(), + "action", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", + }, + ) } // The action to perform when the rule matches. diff --git a/rulesets/ruleset.go b/rulesets/ruleset.go index 2db1a5e4894..a7aaac51ce8 100644 --- a/rulesets/ruleset.go +++ b/rulesets/ruleset.go @@ -409,19 +409,12 @@ func (r RulesetNewResponseRule) AsUnion() RulesetNewResponseRulesUnion { return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RulesetNewResponseRulesRulesetsChallengeRule], -// [rulesets.RulesetNewResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.RulesetNewResponseRulesRulesetsJsChallengeRule], [rulesets.LogRule], -// [rulesets.RulesetNewResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RulesetNewResponseRulesRulesetsRedirectRule], -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRule], -// [rulesets.RulesetNewResponseRulesRulesetsRouteRule], -// [rulesets.RulesetNewResponseRulesRulesetsScoreRule], -// [rulesets.RulesetNewResponseRulesRulesetsServeErrorRule], -// [rulesets.RulesetNewResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.RulesetNewResponseRulesRulesetsSetCacheSettingsRule]. +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. type RulesetNewResponseRulesUnion interface { implementsRulesetsRulesetNewResponseRule() } @@ -437,12 +430,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsChallengeRule{}), + Type: reflect.TypeOf(ChallengeRule{}), DiscriminatorValue: "challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsCompressResponseRule{}), + Type: reflect.TypeOf(CompressResponseRule{}), DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ @@ -452,7 +445,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsJsChallengeRule{}), + Type: reflect.TypeOf(JsChallengeRule{}), DiscriminatorValue: "js_challenge", }, apijson.UnionVariant{ @@ -462,37 +455,37 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsManagedChallengeRule{}), + Type: reflect.TypeOf(ManagedChallengeRule{}), DiscriminatorValue: "managed_challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRedirectRule{}), + Type: reflect.TypeOf(RedirectRule{}), DiscriminatorValue: "redirect", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRule{}), + Type: reflect.TypeOf(RewriteRule{}), DiscriminatorValue: "rewrite", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRouteRule{}), + Type: reflect.TypeOf(RouteRule{}), DiscriminatorValue: "route", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsScoreRule{}), + Type: reflect.TypeOf(ScoreRule{}), DiscriminatorValue: "score", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsServeErrorRule{}), + Type: reflect.TypeOf(ServeErrorRule{}), DiscriminatorValue: "serve_error", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsSetConfigRule{}), + Type: reflect.TypeOf(SetConfigRule{}), DiscriminatorValue: "set_config", }, apijson.UnionVariant{ @@ -502,10830 +495,948 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsSetCacheSettingsRule{}), + Type: reflect.TypeOf(SetCacheSettingsRule{}), DiscriminatorValue: "set_cache_settings", }, ) } -type RulesetNewResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [RulesetNewResponseRulesRulesetsChallengeRule] -type rulesetNewResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsChallengeRule) implementsRulesetsRulesetNewResponseRule() {} - // The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsChallengeRuleAction string +type RulesetNewResponseRulesAction string const ( - RulesetNewResponseRulesRulesetsChallengeRuleActionChallenge RulesetNewResponseRulesRulesetsChallengeRuleAction = "challenge" + RulesetNewResponseRulesActionBlock RulesetNewResponseRulesAction = "block" + RulesetNewResponseRulesActionChallenge RulesetNewResponseRulesAction = "challenge" + RulesetNewResponseRulesActionCompressResponse RulesetNewResponseRulesAction = "compress_response" + RulesetNewResponseRulesActionExecute RulesetNewResponseRulesAction = "execute" + RulesetNewResponseRulesActionJsChallenge RulesetNewResponseRulesAction = "js_challenge" + RulesetNewResponseRulesActionLog RulesetNewResponseRulesAction = "log" + RulesetNewResponseRulesActionManagedChallenge RulesetNewResponseRulesAction = "managed_challenge" + RulesetNewResponseRulesActionRedirect RulesetNewResponseRulesAction = "redirect" + RulesetNewResponseRulesActionRewrite RulesetNewResponseRulesAction = "rewrite" + RulesetNewResponseRulesActionRoute RulesetNewResponseRulesAction = "route" + RulesetNewResponseRulesActionScore RulesetNewResponseRulesAction = "score" + RulesetNewResponseRulesActionServeError RulesetNewResponseRulesAction = "serve_error" + RulesetNewResponseRulesActionSetConfig RulesetNewResponseRulesAction = "set_config" + RulesetNewResponseRulesActionSkip RulesetNewResponseRulesAction = "skip" + RulesetNewResponseRulesActionSetCacheSettings RulesetNewResponseRulesAction = "set_cache_settings" ) -func (r RulesetNewResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { +func (r RulesetNewResponseRulesAction) IsKnown() bool { switch r { - case RulesetNewResponseRulesRulesetsChallengeRuleActionChallenge: + case RulesetNewResponseRulesActionBlock, RulesetNewResponseRulesActionChallenge, RulesetNewResponseRulesActionCompressResponse, RulesetNewResponseRulesActionExecute, RulesetNewResponseRulesActionJsChallenge, RulesetNewResponseRulesActionLog, RulesetNewResponseRulesActionManagedChallenge, RulesetNewResponseRulesActionRedirect, RulesetNewResponseRulesActionRewrite, RulesetNewResponseRulesActionRoute, RulesetNewResponseRulesActionScore, RulesetNewResponseRulesActionServeError, RulesetNewResponseRulesActionSetConfig, RulesetNewResponseRulesActionSkip, RulesetNewResponseRulesActionSetCacheSettings: return true } return false } -type RulesetNewResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. +// A ruleset object. +type RulesetUpdateResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind RulesetUpdateResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase RulesetUpdateResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []RulesetUpdateResponseRule `json:"rules,required"` + // The version of the ruleset. Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON rulesetUpdateResponseJSON `json:"-"` } -// rulesetNewResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [RulesetNewResponseRulesRulesetsCompressResponseRule] -type rulesetNewResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field +// rulesetUpdateResponseJSON contains the JSON metadata for the struct +// [RulesetUpdateResponse] +type rulesetUpdateResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RulesetNewResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { +func (r *RulesetUpdateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r rulesetNewResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { +func (r rulesetUpdateResponseJSON) RawJSON() string { return r.raw } -func (r RulesetNewResponseRulesRulesetsCompressResponseRule) implementsRulesetsRulesetNewResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsCompressResponseRuleAction string +// The kind of the ruleset. +type RulesetUpdateResponseKind string const ( - RulesetNewResponseRulesRulesetsCompressResponseRuleActionCompressResponse RulesetNewResponseRulesRulesetsCompressResponseRuleAction = "compress_response" + RulesetUpdateResponseKindManaged RulesetUpdateResponseKind = "managed" + RulesetUpdateResponseKindCustom RulesetUpdateResponseKind = "custom" + RulesetUpdateResponseKindRoot RulesetUpdateResponseKind = "root" + RulesetUpdateResponseKindZone RulesetUpdateResponseKind = "zone" ) -func (r RulesetNewResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { +func (r RulesetUpdateResponseKind) IsKnown() bool { switch r { - case RulesetNewResponseRulesRulesetsCompressResponseRuleActionCompressResponse: + case RulesetUpdateResponseKindManaged, RulesetUpdateResponseKindCustom, RulesetUpdateResponseKindRoot, RulesetUpdateResponseKindZone: return true } return false } -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsCompressResponseRuleActionParameters] -type rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string +// The phase of the ruleset. +type RulesetUpdateResponsePhase string const ( - RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" + RulesetUpdateResponsePhaseDDoSL4 RulesetUpdateResponsePhase = "ddos_l4" + RulesetUpdateResponsePhaseDDoSL7 RulesetUpdateResponsePhase = "ddos_l7" + RulesetUpdateResponsePhaseHTTPConfigSettings RulesetUpdateResponsePhase = "http_config_settings" + RulesetUpdateResponsePhaseHTTPCustomErrors RulesetUpdateResponsePhase = "http_custom_errors" + RulesetUpdateResponsePhaseHTTPLogCustomFields RulesetUpdateResponsePhase = "http_log_custom_fields" + RulesetUpdateResponsePhaseHTTPRatelimit RulesetUpdateResponsePhase = "http_ratelimit" + RulesetUpdateResponsePhaseHTTPRequestCacheSettings RulesetUpdateResponsePhase = "http_request_cache_settings" + RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect RulesetUpdateResponsePhase = "http_request_dynamic_redirect" + RulesetUpdateResponsePhaseHTTPRequestFirewallCustom RulesetUpdateResponsePhase = "http_request_firewall_custom" + RulesetUpdateResponsePhaseHTTPRequestFirewallManaged RulesetUpdateResponsePhase = "http_request_firewall_managed" + RulesetUpdateResponsePhaseHTTPRequestLateTransform RulesetUpdateResponsePhase = "http_request_late_transform" + RulesetUpdateResponsePhaseHTTPRequestOrigin RulesetUpdateResponsePhase = "http_request_origin" + RulesetUpdateResponsePhaseHTTPRequestRedirect RulesetUpdateResponsePhase = "http_request_redirect" + RulesetUpdateResponsePhaseHTTPRequestSanitize RulesetUpdateResponsePhase = "http_request_sanitize" + RulesetUpdateResponsePhaseHTTPRequestSbfm RulesetUpdateResponsePhase = "http_request_sbfm" + RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration RulesetUpdateResponsePhase = "http_request_select_configuration" + RulesetUpdateResponsePhaseHTTPRequestTransform RulesetUpdateResponsePhase = "http_request_transform" + RulesetUpdateResponsePhaseHTTPResponseCompression RulesetUpdateResponsePhase = "http_response_compression" + RulesetUpdateResponsePhaseHTTPResponseFirewallManaged RulesetUpdateResponsePhase = "http_response_firewall_managed" + RulesetUpdateResponsePhaseHTTPResponseHeadersTransform RulesetUpdateResponsePhase = "http_response_headers_transform" + RulesetUpdateResponsePhaseMagicTransit RulesetUpdateResponsePhase = "magic_transit" + RulesetUpdateResponsePhaseMagicTransitIDsManaged RulesetUpdateResponsePhase = "magic_transit_ids_managed" + RulesetUpdateResponsePhaseMagicTransitManaged RulesetUpdateResponsePhase = "magic_transit_managed" ) -func (r RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { +func (r RulesetUpdateResponsePhase) IsKnown() bool { switch r { - case RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RulesetNewResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: + case RulesetUpdateResponsePhaseDDoSL4, RulesetUpdateResponsePhaseDDoSL7, RulesetUpdateResponsePhaseHTTPConfigSettings, RulesetUpdateResponsePhaseHTTPCustomErrors, RulesetUpdateResponsePhaseHTTPLogCustomFields, RulesetUpdateResponsePhaseHTTPRatelimit, RulesetUpdateResponsePhaseHTTPRequestCacheSettings, RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect, RulesetUpdateResponsePhaseHTTPRequestFirewallCustom, RulesetUpdateResponsePhaseHTTPRequestFirewallManaged, RulesetUpdateResponsePhaseHTTPRequestLateTransform, RulesetUpdateResponsePhaseHTTPRequestOrigin, RulesetUpdateResponsePhaseHTTPRequestRedirect, RulesetUpdateResponsePhaseHTTPRequestSanitize, RulesetUpdateResponsePhaseHTTPRequestSbfm, RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration, RulesetUpdateResponsePhaseHTTPRequestTransform, RulesetUpdateResponsePhaseHTTPResponseCompression, RulesetUpdateResponsePhaseHTTPResponseFirewallManaged, RulesetUpdateResponsePhaseHTTPResponseHeadersTransform, RulesetUpdateResponsePhaseMagicTransit, RulesetUpdateResponsePhaseMagicTransitIDsManaged, RulesetUpdateResponsePhaseMagicTransitManaged: return true } return false } -type RulesetNewResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` +type RulesetUpdateResponseRule struct { // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` + Action RulesetUpdateResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` // An informative description of the rule. Description string `json:"description"` // Whether the rule should be executed. Enabled bool `json:"enabled"` // The expression defining which traffic will match the rule. Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON rulesetUpdateResponseRuleJSON `json:"-"` + union RulesetUpdateResponseRulesUnion } -// rulesetNewResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [RulesetNewResponseRulesRulesetsJsChallengeRule] -type rulesetNewResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field +// rulesetUpdateResponseRuleJSON contains the JSON metadata for the struct +// [RulesetUpdateResponseRule] +type rulesetUpdateResponseRuleJSON struct { Action apijson.Field ActionParameters apijson.Field Categories apijson.Field Description apijson.Field Enabled apijson.Field Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field Logging apijson.Field Ref apijson.Field + Version apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RulesetNewResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { +func (r rulesetUpdateResponseRuleJSON) RawJSON() string { return r.raw } -func (r RulesetNewResponseRulesRulesetsJsChallengeRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsJsChallengeRuleAction string - -const ( - RulesetNewResponseRulesRulesetsJsChallengeRuleActionJsChallenge RulesetNewResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RulesetNewResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true +func (r *RulesetUpdateResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err } - return false + return apijson.Port(r.union, &r) } -type RulesetNewResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` +func (r RulesetUpdateResponseRule) AsUnion() RulesetUpdateResponseRulesUnion { + return r.union } -// rulesetNewResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [RulesetNewResponseRulesRulesetsManagedChallengeRule] -type rulesetNewResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRulesetNewResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - RulesetNewResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RulesetNewResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RulesetNewResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RulesetNewResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for -// the struct [RulesetNewResponseRulesRulesetsRedirectRule] -type rulesetNewResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRedirectRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsRedirectRuleAction string - -const ( - RulesetNewResponseRulesRulesetsRedirectRuleActionRedirect RulesetNewResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RulesetNewResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParameters] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromList] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type RulesetUpdateResponseRulesUnion interface { + implementsRulesetsRulesetUpdateResponseRule() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", + reflect.TypeOf((*RulesetUpdateResponseRulesUnion)(nil)).Elem(), + "action", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", }, ) } -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRulesetNewResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetNewResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [RulesetNewResponseRulesRulesetsRewriteRule] -type rulesetNewResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsRewriteRuleAction string - -const ( - RulesetNewResponseRulesRulesetsRewriteRuleActionRewrite RulesetNewResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RulesetNewResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParameters] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RulesetNewResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURI] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRulesetNewResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetNewResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [RulesetNewResponseRulesRulesetsRouteRule] -type rulesetNewResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsRouteRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsRouteRuleAction string - -const ( - RulesetNewResponseRulesRulesetsRouteRuleActionRoute RulesetNewResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r RulesetNewResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RulesetNewResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RulesetNewResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON rulesetNewResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetNewResponseRulesRulesetsRouteRuleActionParameters] -type rulesetNewResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RulesetNewResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON rulesetNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRouteRuleActionParametersOrigin] -type rulesetNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type RulesetNewResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON rulesetNewResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsRouteRuleActionParametersSni] -type rulesetNewResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type RulesetNewResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [RulesetNewResponseRulesRulesetsScoreRule] -type rulesetNewResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsScoreRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsScoreRuleAction string - -const ( - RulesetNewResponseRulesRulesetsScoreRuleActionScore RulesetNewResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r RulesetNewResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON rulesetNewResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetNewResponseRulesRulesetsScoreRuleActionParameters] -type rulesetNewResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type RulesetNewResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [RulesetNewResponseRulesRulesetsServeErrorRule] -type rulesetNewResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsServeErrorRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsServeErrorRuleAction string - -const ( - RulesetNewResponseRulesRulesetsServeErrorRuleActionServeError RulesetNewResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RulesetNewResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON rulesetNewResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsServeErrorRuleActionParameters] -type rulesetNewResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RulesetNewResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RulesetNewResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [RulesetNewResponseRulesRulesetsSetConfigRule] -type rulesetNewResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsSetConfigRule) implementsRulesetsRulesetNewResponseRule() {} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsSetConfigRuleAction string - -const ( - RulesetNewResponseRulesRulesetsSetConfigRuleActionSetConfig RulesetNewResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RulesetNewResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetConfigRuleActionParameters] -type rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RulesetNewResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RulesetNewResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetNewResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [RulesetNewResponseRulesRulesetsSetCacheSettingsRule] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetNewResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRulesetNewResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RulesetNewResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RulesetNewResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type RulesetNewResponseRulesAction string - -const ( - RulesetNewResponseRulesActionBlock RulesetNewResponseRulesAction = "block" - RulesetNewResponseRulesActionChallenge RulesetNewResponseRulesAction = "challenge" - RulesetNewResponseRulesActionCompressResponse RulesetNewResponseRulesAction = "compress_response" - RulesetNewResponseRulesActionExecute RulesetNewResponseRulesAction = "execute" - RulesetNewResponseRulesActionJsChallenge RulesetNewResponseRulesAction = "js_challenge" - RulesetNewResponseRulesActionLog RulesetNewResponseRulesAction = "log" - RulesetNewResponseRulesActionManagedChallenge RulesetNewResponseRulesAction = "managed_challenge" - RulesetNewResponseRulesActionRedirect RulesetNewResponseRulesAction = "redirect" - RulesetNewResponseRulesActionRewrite RulesetNewResponseRulesAction = "rewrite" - RulesetNewResponseRulesActionRoute RulesetNewResponseRulesAction = "route" - RulesetNewResponseRulesActionScore RulesetNewResponseRulesAction = "score" - RulesetNewResponseRulesActionServeError RulesetNewResponseRulesAction = "serve_error" - RulesetNewResponseRulesActionSetConfig RulesetNewResponseRulesAction = "set_config" - RulesetNewResponseRulesActionSkip RulesetNewResponseRulesAction = "skip" - RulesetNewResponseRulesActionSetCacheSettings RulesetNewResponseRulesAction = "set_cache_settings" -) - -func (r RulesetNewResponseRulesAction) IsKnown() bool { - switch r { - case RulesetNewResponseRulesActionBlock, RulesetNewResponseRulesActionChallenge, RulesetNewResponseRulesActionCompressResponse, RulesetNewResponseRulesActionExecute, RulesetNewResponseRulesActionJsChallenge, RulesetNewResponseRulesActionLog, RulesetNewResponseRulesActionManagedChallenge, RulesetNewResponseRulesActionRedirect, RulesetNewResponseRulesActionRewrite, RulesetNewResponseRulesActionRoute, RulesetNewResponseRulesActionScore, RulesetNewResponseRulesActionServeError, RulesetNewResponseRulesActionSetConfig, RulesetNewResponseRulesActionSkip, RulesetNewResponseRulesActionSetCacheSettings: - return true - } - return false -} - -// A ruleset object. -type RulesetUpdateResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind RulesetUpdateResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase RulesetUpdateResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []RulesetUpdateResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON rulesetUpdateResponseJSON `json:"-"` -} - -// rulesetUpdateResponseJSON contains the JSON metadata for the struct -// [RulesetUpdateResponse] -type rulesetUpdateResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field - Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseJSON) RawJSON() string { - return r.raw -} - -// The kind of the ruleset. -type RulesetUpdateResponseKind string - -const ( - RulesetUpdateResponseKindManaged RulesetUpdateResponseKind = "managed" - RulesetUpdateResponseKindCustom RulesetUpdateResponseKind = "custom" - RulesetUpdateResponseKindRoot RulesetUpdateResponseKind = "root" - RulesetUpdateResponseKindZone RulesetUpdateResponseKind = "zone" -) - -func (r RulesetUpdateResponseKind) IsKnown() bool { - switch r { - case RulesetUpdateResponseKindManaged, RulesetUpdateResponseKindCustom, RulesetUpdateResponseKindRoot, RulesetUpdateResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetUpdateResponsePhase string - -const ( - RulesetUpdateResponsePhaseDDoSL4 RulesetUpdateResponsePhase = "ddos_l4" - RulesetUpdateResponsePhaseDDoSL7 RulesetUpdateResponsePhase = "ddos_l7" - RulesetUpdateResponsePhaseHTTPConfigSettings RulesetUpdateResponsePhase = "http_config_settings" - RulesetUpdateResponsePhaseHTTPCustomErrors RulesetUpdateResponsePhase = "http_custom_errors" - RulesetUpdateResponsePhaseHTTPLogCustomFields RulesetUpdateResponsePhase = "http_log_custom_fields" - RulesetUpdateResponsePhaseHTTPRatelimit RulesetUpdateResponsePhase = "http_ratelimit" - RulesetUpdateResponsePhaseHTTPRequestCacheSettings RulesetUpdateResponsePhase = "http_request_cache_settings" - RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect RulesetUpdateResponsePhase = "http_request_dynamic_redirect" - RulesetUpdateResponsePhaseHTTPRequestFirewallCustom RulesetUpdateResponsePhase = "http_request_firewall_custom" - RulesetUpdateResponsePhaseHTTPRequestFirewallManaged RulesetUpdateResponsePhase = "http_request_firewall_managed" - RulesetUpdateResponsePhaseHTTPRequestLateTransform RulesetUpdateResponsePhase = "http_request_late_transform" - RulesetUpdateResponsePhaseHTTPRequestOrigin RulesetUpdateResponsePhase = "http_request_origin" - RulesetUpdateResponsePhaseHTTPRequestRedirect RulesetUpdateResponsePhase = "http_request_redirect" - RulesetUpdateResponsePhaseHTTPRequestSanitize RulesetUpdateResponsePhase = "http_request_sanitize" - RulesetUpdateResponsePhaseHTTPRequestSbfm RulesetUpdateResponsePhase = "http_request_sbfm" - RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration RulesetUpdateResponsePhase = "http_request_select_configuration" - RulesetUpdateResponsePhaseHTTPRequestTransform RulesetUpdateResponsePhase = "http_request_transform" - RulesetUpdateResponsePhaseHTTPResponseCompression RulesetUpdateResponsePhase = "http_response_compression" - RulesetUpdateResponsePhaseHTTPResponseFirewallManaged RulesetUpdateResponsePhase = "http_response_firewall_managed" - RulesetUpdateResponsePhaseHTTPResponseHeadersTransform RulesetUpdateResponsePhase = "http_response_headers_transform" - RulesetUpdateResponsePhaseMagicTransit RulesetUpdateResponsePhase = "magic_transit" - RulesetUpdateResponsePhaseMagicTransitIDsManaged RulesetUpdateResponsePhase = "magic_transit_ids_managed" - RulesetUpdateResponsePhaseMagicTransitManaged RulesetUpdateResponsePhase = "magic_transit_managed" -) - -func (r RulesetUpdateResponsePhase) IsKnown() bool { - switch r { - case RulesetUpdateResponsePhaseDDoSL4, RulesetUpdateResponsePhaseDDoSL7, RulesetUpdateResponsePhaseHTTPConfigSettings, RulesetUpdateResponsePhaseHTTPCustomErrors, RulesetUpdateResponsePhaseHTTPLogCustomFields, RulesetUpdateResponsePhaseHTTPRatelimit, RulesetUpdateResponsePhaseHTTPRequestCacheSettings, RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect, RulesetUpdateResponsePhaseHTTPRequestFirewallCustom, RulesetUpdateResponsePhaseHTTPRequestFirewallManaged, RulesetUpdateResponsePhaseHTTPRequestLateTransform, RulesetUpdateResponsePhaseHTTPRequestOrigin, RulesetUpdateResponsePhaseHTTPRequestRedirect, RulesetUpdateResponsePhaseHTTPRequestSanitize, RulesetUpdateResponsePhaseHTTPRequestSbfm, RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration, RulesetUpdateResponsePhaseHTTPRequestTransform, RulesetUpdateResponsePhaseHTTPResponseCompression, RulesetUpdateResponsePhaseHTTPResponseFirewallManaged, RulesetUpdateResponsePhaseHTTPResponseHeadersTransform, RulesetUpdateResponsePhaseMagicTransit, RulesetUpdateResponsePhaseMagicTransitIDsManaged, RulesetUpdateResponsePhaseMagicTransitManaged: - return true - } - return false -} - -type RulesetUpdateResponseRule struct { - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON rulesetUpdateResponseRuleJSON `json:"-"` - union RulesetUpdateResponseRulesUnion -} - -// rulesetUpdateResponseRuleJSON contains the JSON metadata for the struct -// [RulesetUpdateResponseRule] -type rulesetUpdateResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetUpdateResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetUpdateResponseRule) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetUpdateResponseRule) AsUnion() RulesetUpdateResponseRulesUnion { - return r.union -} - -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsChallengeRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsRedirectRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsRouteRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsScoreRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsServeErrorRule], -// [rulesets.RulesetUpdateResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] -// or [rulesets.RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule]. -type RulesetUpdateResponseRulesUnion interface { - implementsRulesetsRulesetUpdateResponseRule() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetUpdateResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", - }, - ) -} - -type RulesetUpdateResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata -// for the struct [RulesetUpdateResponseRulesRulesetsChallengeRule] -type rulesetUpdateResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsChallengeRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsChallengeRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsChallengeRuleActionChallenge RulesetUpdateResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r RulesetUpdateResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [RulesetUpdateResponseRulesRulesetsCompressResponseRule] -type rulesetUpdateResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsCompressResponseRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsCompressResponseRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionCompressResponse RulesetUpdateResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r RulesetUpdateResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RulesetUpdateResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [RulesetUpdateResponseRulesRulesetsJsChallengeRule] -type rulesetUpdateResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsJsChallengeRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsJsChallengeRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsJsChallengeRuleActionJsChallenge RulesetUpdateResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RulesetUpdateResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [RulesetUpdateResponseRulesRulesetsManagedChallengeRule] -type rulesetUpdateResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RulesetUpdateResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RulesetUpdateResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata -// for the struct [RulesetUpdateResponseRulesRulesetsRedirectRule] -type rulesetUpdateResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRedirectRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsRedirectRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsRedirectRuleActionRedirect RulesetUpdateResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RulesetUpdateResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRulesetUpdateResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [RulesetUpdateResponseRulesRulesetsRewriteRule] -type rulesetUpdateResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsRewriteRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsRewriteRuleActionRewrite RulesetUpdateResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains -// the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURI] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRulesetUpdateResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetUpdateResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for -// the struct [RulesetUpdateResponseRulesRulesetsRouteRule] -type rulesetUpdateResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsRouteRule) implementsRulesetsRulesetUpdateResponseRule() {} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsRouteRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsRouteRuleActionRoute RulesetUpdateResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r RulesetUpdateResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRouteRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains -// the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin] -type rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSni] -type rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type RulesetUpdateResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for -// the struct [RulesetUpdateResponseRulesRulesetsScoreRule] -type rulesetUpdateResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsScoreRule) implementsRulesetsRulesetUpdateResponseRule() {} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsScoreRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsScoreRuleActionScore RulesetUpdateResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r RulesetUpdateResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON rulesetUpdateResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsScoreRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsScoreRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type RulesetUpdateResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata -// for the struct [RulesetUpdateResponseRulesRulesetsServeErrorRule] -type rulesetUpdateResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsServeErrorRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsServeErrorRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsServeErrorRuleActionServeError RulesetUpdateResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RulesetUpdateResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON rulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RulesetUpdateResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata -// for the struct [RulesetUpdateResponseRulesRulesetsSetConfigRule] -type rulesetUpdateResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsSetConfigRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionSetConfig RulesetUpdateResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RulesetUpdateResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RulesetUpdateResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetUpdateResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRulesetUpdateResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetUpdateResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type RulesetUpdateResponseRulesAction string - -const ( - RulesetUpdateResponseRulesActionBlock RulesetUpdateResponseRulesAction = "block" - RulesetUpdateResponseRulesActionChallenge RulesetUpdateResponseRulesAction = "challenge" - RulesetUpdateResponseRulesActionCompressResponse RulesetUpdateResponseRulesAction = "compress_response" - RulesetUpdateResponseRulesActionExecute RulesetUpdateResponseRulesAction = "execute" - RulesetUpdateResponseRulesActionJsChallenge RulesetUpdateResponseRulesAction = "js_challenge" - RulesetUpdateResponseRulesActionLog RulesetUpdateResponseRulesAction = "log" - RulesetUpdateResponseRulesActionManagedChallenge RulesetUpdateResponseRulesAction = "managed_challenge" - RulesetUpdateResponseRulesActionRedirect RulesetUpdateResponseRulesAction = "redirect" - RulesetUpdateResponseRulesActionRewrite RulesetUpdateResponseRulesAction = "rewrite" - RulesetUpdateResponseRulesActionRoute RulesetUpdateResponseRulesAction = "route" - RulesetUpdateResponseRulesActionScore RulesetUpdateResponseRulesAction = "score" - RulesetUpdateResponseRulesActionServeError RulesetUpdateResponseRulesAction = "serve_error" - RulesetUpdateResponseRulesActionSetConfig RulesetUpdateResponseRulesAction = "set_config" - RulesetUpdateResponseRulesActionSkip RulesetUpdateResponseRulesAction = "skip" - RulesetUpdateResponseRulesActionSetCacheSettings RulesetUpdateResponseRulesAction = "set_cache_settings" -) - -func (r RulesetUpdateResponseRulesAction) IsKnown() bool { - switch r { - case RulesetUpdateResponseRulesActionBlock, RulesetUpdateResponseRulesActionChallenge, RulesetUpdateResponseRulesActionCompressResponse, RulesetUpdateResponseRulesActionExecute, RulesetUpdateResponseRulesActionJsChallenge, RulesetUpdateResponseRulesActionLog, RulesetUpdateResponseRulesActionManagedChallenge, RulesetUpdateResponseRulesActionRedirect, RulesetUpdateResponseRulesActionRewrite, RulesetUpdateResponseRulesActionRoute, RulesetUpdateResponseRulesActionScore, RulesetUpdateResponseRulesActionServeError, RulesetUpdateResponseRulesActionSetConfig, RulesetUpdateResponseRulesActionSkip, RulesetUpdateResponseRulesActionSetCacheSettings: - return true - } - return false -} - -// A ruleset object. -type RulesetGetResponse struct { - // The unique ID of the ruleset. - ID string `json:"id,required"` - // The kind of the ruleset. - Kind RulesetGetResponseKind `json:"kind,required"` - // The timestamp of when the ruleset was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The human-readable name of the ruleset. - Name string `json:"name,required"` - // The phase of the ruleset. - Phase RulesetGetResponsePhase `json:"phase,required"` - // The list of rules in the ruleset. - Rules []RulesetGetResponseRule `json:"rules,required"` - // The version of the ruleset. - Version string `json:"version,required"` - // An informative description of the ruleset. - Description string `json:"description"` - JSON rulesetGetResponseJSON `json:"-"` -} - -// rulesetGetResponseJSON contains the JSON metadata for the struct -// [RulesetGetResponse] -type rulesetGetResponseJSON struct { - ID apijson.Field - Kind apijson.Field - LastUpdated apijson.Field - Name apijson.Field - Phase apijson.Field - Rules apijson.Field - Version apijson.Field - Description apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseJSON) RawJSON() string { - return r.raw -} - -// The kind of the ruleset. -type RulesetGetResponseKind string - -const ( - RulesetGetResponseKindManaged RulesetGetResponseKind = "managed" - RulesetGetResponseKindCustom RulesetGetResponseKind = "custom" - RulesetGetResponseKindRoot RulesetGetResponseKind = "root" - RulesetGetResponseKindZone RulesetGetResponseKind = "zone" -) - -func (r RulesetGetResponseKind) IsKnown() bool { - switch r { - case RulesetGetResponseKindManaged, RulesetGetResponseKindCustom, RulesetGetResponseKindRoot, RulesetGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetGetResponsePhase string - -const ( - RulesetGetResponsePhaseDDoSL4 RulesetGetResponsePhase = "ddos_l4" - RulesetGetResponsePhaseDDoSL7 RulesetGetResponsePhase = "ddos_l7" - RulesetGetResponsePhaseHTTPConfigSettings RulesetGetResponsePhase = "http_config_settings" - RulesetGetResponsePhaseHTTPCustomErrors RulesetGetResponsePhase = "http_custom_errors" - RulesetGetResponsePhaseHTTPLogCustomFields RulesetGetResponsePhase = "http_log_custom_fields" - RulesetGetResponsePhaseHTTPRatelimit RulesetGetResponsePhase = "http_ratelimit" - RulesetGetResponsePhaseHTTPRequestCacheSettings RulesetGetResponsePhase = "http_request_cache_settings" - RulesetGetResponsePhaseHTTPRequestDynamicRedirect RulesetGetResponsePhase = "http_request_dynamic_redirect" - RulesetGetResponsePhaseHTTPRequestFirewallCustom RulesetGetResponsePhase = "http_request_firewall_custom" - RulesetGetResponsePhaseHTTPRequestFirewallManaged RulesetGetResponsePhase = "http_request_firewall_managed" - RulesetGetResponsePhaseHTTPRequestLateTransform RulesetGetResponsePhase = "http_request_late_transform" - RulesetGetResponsePhaseHTTPRequestOrigin RulesetGetResponsePhase = "http_request_origin" - RulesetGetResponsePhaseHTTPRequestRedirect RulesetGetResponsePhase = "http_request_redirect" - RulesetGetResponsePhaseHTTPRequestSanitize RulesetGetResponsePhase = "http_request_sanitize" - RulesetGetResponsePhaseHTTPRequestSbfm RulesetGetResponsePhase = "http_request_sbfm" - RulesetGetResponsePhaseHTTPRequestSelectConfiguration RulesetGetResponsePhase = "http_request_select_configuration" - RulesetGetResponsePhaseHTTPRequestTransform RulesetGetResponsePhase = "http_request_transform" - RulesetGetResponsePhaseHTTPResponseCompression RulesetGetResponsePhase = "http_response_compression" - RulesetGetResponsePhaseHTTPResponseFirewallManaged RulesetGetResponsePhase = "http_response_firewall_managed" - RulesetGetResponsePhaseHTTPResponseHeadersTransform RulesetGetResponsePhase = "http_response_headers_transform" - RulesetGetResponsePhaseMagicTransit RulesetGetResponsePhase = "magic_transit" - RulesetGetResponsePhaseMagicTransitIDsManaged RulesetGetResponsePhase = "magic_transit_ids_managed" - RulesetGetResponsePhaseMagicTransitManaged RulesetGetResponsePhase = "magic_transit_managed" -) - -func (r RulesetGetResponsePhase) IsKnown() bool { - switch r { - case RulesetGetResponsePhaseDDoSL4, RulesetGetResponsePhaseDDoSL7, RulesetGetResponsePhaseHTTPConfigSettings, RulesetGetResponsePhaseHTTPCustomErrors, RulesetGetResponsePhaseHTTPLogCustomFields, RulesetGetResponsePhaseHTTPRatelimit, RulesetGetResponsePhaseHTTPRequestCacheSettings, RulesetGetResponsePhaseHTTPRequestDynamicRedirect, RulesetGetResponsePhaseHTTPRequestFirewallCustom, RulesetGetResponsePhaseHTTPRequestFirewallManaged, RulesetGetResponsePhaseHTTPRequestLateTransform, RulesetGetResponsePhaseHTTPRequestOrigin, RulesetGetResponsePhaseHTTPRequestRedirect, RulesetGetResponsePhaseHTTPRequestSanitize, RulesetGetResponsePhaseHTTPRequestSbfm, RulesetGetResponsePhaseHTTPRequestSelectConfiguration, RulesetGetResponsePhaseHTTPRequestTransform, RulesetGetResponsePhaseHTTPResponseCompression, RulesetGetResponsePhaseHTTPResponseFirewallManaged, RulesetGetResponsePhaseHTTPResponseHeadersTransform, RulesetGetResponsePhaseMagicTransit, RulesetGetResponsePhaseMagicTransitIDsManaged, RulesetGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - -type RulesetGetResponseRule struct { - // The action to perform when the rule matches. - Action RulesetGetResponseRulesAction `json:"action"` - ActionParameters interface{} `json:"action_parameters,required"` - Categories interface{} `json:"categories,required"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // The unique ID of the rule. - ID string `json:"id"` - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - // The version of the rule. - Version string `json:"version,required"` - JSON rulesetGetResponseRuleJSON `json:"-"` - union RulesetGetResponseRulesUnion -} - -// rulesetGetResponseRuleJSON contains the JSON metadata for the struct -// [RulesetGetResponseRule] -type rulesetGetResponseRuleJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - ID apijson.Field - LastUpdated apijson.Field - Logging apijson.Field - Ref apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetGetResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetGetResponseRule) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetGetResponseRule) AsUnion() RulesetGetResponseRulesUnion { - return r.union -} - -// Union satisfied by [rulesets.BlockRule], -// [rulesets.RulesetGetResponseRulesRulesetsChallengeRule], -// [rulesets.RulesetGetResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.RulesetGetResponseRulesRulesetsJsChallengeRule], [rulesets.LogRule], -// [rulesets.RulesetGetResponseRulesRulesetsManagedChallengeRule], -// [rulesets.RulesetGetResponseRulesRulesetsRedirectRule], -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRule], -// [rulesets.RulesetGetResponseRulesRulesetsRouteRule], -// [rulesets.RulesetGetResponseRulesRulesetsScoreRule], -// [rulesets.RulesetGetResponseRulesRulesetsServeErrorRule], -// [rulesets.RulesetGetResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.RulesetGetResponseRulesRulesetsSetCacheSettingsRule]. -type RulesetGetResponseRulesUnion interface { - implementsRulesetsRulesetGetResponseRule() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetGetResponseRulesUnion)(nil)).Elem(), - "action", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(BlockRule{}), - DiscriminatorValue: "block", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsChallengeRule{}), - DiscriminatorValue: "challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsCompressResponseRule{}), - DiscriminatorValue: "compress_response", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ExecuteRule{}), - DiscriminatorValue: "execute", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsJsChallengeRule{}), - DiscriminatorValue: "js_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(LogRule{}), - DiscriminatorValue: "log", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsManagedChallengeRule{}), - DiscriminatorValue: "managed_challenge", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRedirectRule{}), - DiscriminatorValue: "redirect", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRule{}), - DiscriminatorValue: "rewrite", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRouteRule{}), - DiscriminatorValue: "route", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsScoreRule{}), - DiscriminatorValue: "score", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsServeErrorRule{}), - DiscriminatorValue: "serve_error", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsSetConfigRule{}), - DiscriminatorValue: "set_config", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SkipRule{}), - DiscriminatorValue: "skip", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsSetCacheSettingsRule{}), - DiscriminatorValue: "set_cache_settings", - }, - ) -} - -type RulesetGetResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [RulesetGetResponseRulesRulesetsChallengeRule] -type rulesetGetResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsChallengeRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsChallengeRuleAction string - -const ( - RulesetGetResponseRulesRulesetsChallengeRuleActionChallenge RulesetGetResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r RulesetGetResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [RulesetGetResponseRulesRulesetsCompressResponseRule] -type rulesetGetResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsCompressResponseRule) implementsRulesetsRulesetGetResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsCompressResponseRuleAction string - -const ( - RulesetGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse RulesetGetResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r RulesetGetResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsCompressResponseRuleActionParameters] -type rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RulesetGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [RulesetGetResponseRulesRulesetsJsChallengeRule] -type rulesetGetResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsJsChallengeRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsJsChallengeRuleAction string - -const ( - RulesetGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge RulesetGetResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RulesetGetResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [RulesetGetResponseRulesRulesetsManagedChallengeRule] -type rulesetGetResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsManagedChallengeRule) implementsRulesetsRulesetGetResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - RulesetGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge RulesetGetResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RulesetGetResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for -// the struct [RulesetGetResponseRulesRulesetsRedirectRule] -type rulesetGetResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRedirectRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsRedirectRuleAction string - -const ( - RulesetGetResponseRulesRulesetsRedirectRuleActionRedirect RulesetGetResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RulesetGetResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParameters] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromList] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRulesetGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type RulesetGetResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [RulesetGetResponseRulesRulesetsRewriteRule] -type rulesetGetResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsRewriteRuleAction string - -const ( - RulesetGetResponseRulesRulesetsRewriteRuleActionRewrite RulesetGetResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RulesetGetResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParameters] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RulesetGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURI] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRulesetGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type RulesetGetResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [RulesetGetResponseRulesRulesetsRouteRule] -type rulesetGetResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsRouteRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsRouteRuleAction string - -const ( - RulesetGetResponseRulesRulesetsRouteRuleActionRoute RulesetGetResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r RulesetGetResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin RulesetGetResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni RulesetGetResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON rulesetGetResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetGetResponseRulesRulesetsRouteRuleActionParameters] -type rulesetGetResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type RulesetGetResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON rulesetGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRouteRuleActionParametersOrigin] -type rulesetGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type RulesetGetResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON rulesetGetResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsRouteRuleActionParametersSni] -type rulesetGetResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type RulesetGetResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [RulesetGetResponseRulesRulesetsScoreRule] -type rulesetGetResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsScoreRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsScoreRuleAction string - -const ( - RulesetGetResponseRulesRulesetsScoreRuleActionScore RulesetGetResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r RulesetGetResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON rulesetGetResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct -// [RulesetGetResponseRulesRulesetsScoreRuleActionParameters] -type rulesetGetResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type RulesetGetResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [RulesetGetResponseRulesRulesetsServeErrorRule] -type rulesetGetResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsServeErrorRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsServeErrorRuleAction string - -const ( - RulesetGetResponseRulesRulesetsServeErrorRuleActionServeError RulesetGetResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RulesetGetResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON rulesetGetResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsServeErrorRuleActionParameters] -type rulesetGetResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RulesetGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [RulesetGetResponseRulesRulesetsSetConfigRule] -type rulesetGetResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsSetConfigRule) implementsRulesetsRulesetGetResponseRule() {} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsSetConfigRuleAction string - -const ( - RulesetGetResponseRulesRulesetsSetConfigRuleActionSetConfig RulesetGetResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RulesetGetResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetConfigRuleActionParameters] -type rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, RulesetGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RulesetGetResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action RulesetGetResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [RulesetGetResponseRulesRulesetsSetCacheSettingsRule] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r RulesetGetResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsRulesetGetResponseRule() { -} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RulesetGetResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RulesetGetResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - -// The action to perform when the rule matches. -type RulesetGetResponseRulesAction string - -const ( - RulesetGetResponseRulesActionBlock RulesetGetResponseRulesAction = "block" - RulesetGetResponseRulesActionChallenge RulesetGetResponseRulesAction = "challenge" - RulesetGetResponseRulesActionCompressResponse RulesetGetResponseRulesAction = "compress_response" - RulesetGetResponseRulesActionExecute RulesetGetResponseRulesAction = "execute" - RulesetGetResponseRulesActionJsChallenge RulesetGetResponseRulesAction = "js_challenge" - RulesetGetResponseRulesActionLog RulesetGetResponseRulesAction = "log" - RulesetGetResponseRulesActionManagedChallenge RulesetGetResponseRulesAction = "managed_challenge" - RulesetGetResponseRulesActionRedirect RulesetGetResponseRulesAction = "redirect" - RulesetGetResponseRulesActionRewrite RulesetGetResponseRulesAction = "rewrite" - RulesetGetResponseRulesActionRoute RulesetGetResponseRulesAction = "route" - RulesetGetResponseRulesActionScore RulesetGetResponseRulesAction = "score" - RulesetGetResponseRulesActionServeError RulesetGetResponseRulesAction = "serve_error" - RulesetGetResponseRulesActionSetConfig RulesetGetResponseRulesAction = "set_config" - RulesetGetResponseRulesActionSkip RulesetGetResponseRulesAction = "skip" - RulesetGetResponseRulesActionSetCacheSettings RulesetGetResponseRulesAction = "set_cache_settings" -) - -func (r RulesetGetResponseRulesAction) IsKnown() bool { - switch r { - case RulesetGetResponseRulesActionBlock, RulesetGetResponseRulesActionChallenge, RulesetGetResponseRulesActionCompressResponse, RulesetGetResponseRulesActionExecute, RulesetGetResponseRulesActionJsChallenge, RulesetGetResponseRulesActionLog, RulesetGetResponseRulesActionManagedChallenge, RulesetGetResponseRulesActionRedirect, RulesetGetResponseRulesActionRewrite, RulesetGetResponseRulesActionRoute, RulesetGetResponseRulesActionScore, RulesetGetResponseRulesActionServeError, RulesetGetResponseRulesActionSetConfig, RulesetGetResponseRulesActionSkip, RulesetGetResponseRulesActionSetCacheSettings: - return true - } - return false -} - -type RulesetNewParams struct { - // The kind of the ruleset. - Kind param.Field[RulesetNewParamsKind] `json:"kind,required"` - // The human-readable name of the ruleset. - Name param.Field[string] `json:"name,required"` - // The phase of the ruleset. - Phase param.Field[RulesetNewParamsPhase] `json:"phase,required"` - // The list of rules in the ruleset. - Rules param.Field[[]RulesetNewParamsRuleUnion] `json:"rules,required"` - // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - AccountID param.Field[string] `path:"account_id"` - // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - ZoneID param.Field[string] `path:"zone_id"` - // An informative description of the ruleset. - Description param.Field[string] `json:"description"` -} - -func (r RulesetNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The kind of the ruleset. -type RulesetNewParamsKind string - -const ( - RulesetNewParamsKindManaged RulesetNewParamsKind = "managed" - RulesetNewParamsKindCustom RulesetNewParamsKind = "custom" - RulesetNewParamsKindRoot RulesetNewParamsKind = "root" - RulesetNewParamsKindZone RulesetNewParamsKind = "zone" -) - -func (r RulesetNewParamsKind) IsKnown() bool { - switch r { - case RulesetNewParamsKindManaged, RulesetNewParamsKindCustom, RulesetNewParamsKindRoot, RulesetNewParamsKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetNewParamsPhase string - -const ( - RulesetNewParamsPhaseDDoSL4 RulesetNewParamsPhase = "ddos_l4" - RulesetNewParamsPhaseDDoSL7 RulesetNewParamsPhase = "ddos_l7" - RulesetNewParamsPhaseHTTPConfigSettings RulesetNewParamsPhase = "http_config_settings" - RulesetNewParamsPhaseHTTPCustomErrors RulesetNewParamsPhase = "http_custom_errors" - RulesetNewParamsPhaseHTTPLogCustomFields RulesetNewParamsPhase = "http_log_custom_fields" - RulesetNewParamsPhaseHTTPRatelimit RulesetNewParamsPhase = "http_ratelimit" - RulesetNewParamsPhaseHTTPRequestCacheSettings RulesetNewParamsPhase = "http_request_cache_settings" - RulesetNewParamsPhaseHTTPRequestDynamicRedirect RulesetNewParamsPhase = "http_request_dynamic_redirect" - RulesetNewParamsPhaseHTTPRequestFirewallCustom RulesetNewParamsPhase = "http_request_firewall_custom" - RulesetNewParamsPhaseHTTPRequestFirewallManaged RulesetNewParamsPhase = "http_request_firewall_managed" - RulesetNewParamsPhaseHTTPRequestLateTransform RulesetNewParamsPhase = "http_request_late_transform" - RulesetNewParamsPhaseHTTPRequestOrigin RulesetNewParamsPhase = "http_request_origin" - RulesetNewParamsPhaseHTTPRequestRedirect RulesetNewParamsPhase = "http_request_redirect" - RulesetNewParamsPhaseHTTPRequestSanitize RulesetNewParamsPhase = "http_request_sanitize" - RulesetNewParamsPhaseHTTPRequestSbfm RulesetNewParamsPhase = "http_request_sbfm" - RulesetNewParamsPhaseHTTPRequestSelectConfiguration RulesetNewParamsPhase = "http_request_select_configuration" - RulesetNewParamsPhaseHTTPRequestTransform RulesetNewParamsPhase = "http_request_transform" - RulesetNewParamsPhaseHTTPResponseCompression RulesetNewParamsPhase = "http_response_compression" - RulesetNewParamsPhaseHTTPResponseFirewallManaged RulesetNewParamsPhase = "http_response_firewall_managed" - RulesetNewParamsPhaseHTTPResponseHeadersTransform RulesetNewParamsPhase = "http_response_headers_transform" - RulesetNewParamsPhaseMagicTransit RulesetNewParamsPhase = "magic_transit" - RulesetNewParamsPhaseMagicTransitIDsManaged RulesetNewParamsPhase = "magic_transit_ids_managed" - RulesetNewParamsPhaseMagicTransitManaged RulesetNewParamsPhase = "magic_transit_managed" -) - -func (r RulesetNewParamsPhase) IsKnown() bool { - switch r { - case RulesetNewParamsPhaseDDoSL4, RulesetNewParamsPhaseDDoSL7, RulesetNewParamsPhaseHTTPConfigSettings, RulesetNewParamsPhaseHTTPCustomErrors, RulesetNewParamsPhaseHTTPLogCustomFields, RulesetNewParamsPhaseHTTPRatelimit, RulesetNewParamsPhaseHTTPRequestCacheSettings, RulesetNewParamsPhaseHTTPRequestDynamicRedirect, RulesetNewParamsPhaseHTTPRequestFirewallCustom, RulesetNewParamsPhaseHTTPRequestFirewallManaged, RulesetNewParamsPhaseHTTPRequestLateTransform, RulesetNewParamsPhaseHTTPRequestOrigin, RulesetNewParamsPhaseHTTPRequestRedirect, RulesetNewParamsPhaseHTTPRequestSanitize, RulesetNewParamsPhaseHTTPRequestSbfm, RulesetNewParamsPhaseHTTPRequestSelectConfiguration, RulesetNewParamsPhaseHTTPRequestTransform, RulesetNewParamsPhaseHTTPResponseCompression, RulesetNewParamsPhaseHTTPResponseFirewallManaged, RulesetNewParamsPhaseHTTPResponseHeadersTransform, RulesetNewParamsPhaseMagicTransit, RulesetNewParamsPhaseMagicTransitIDsManaged, RulesetNewParamsPhaseMagicTransitManaged: - return true - } - return false -} - -type RulesetNewParamsRule struct { - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesAction] `json:"action"` - ActionParameters param.Field[interface{}] `json:"action_parameters,required"` - Categories param.Field[interface{}] `json:"categories,required"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// Satisfied by [rulesets.BlockRuleParam], -// [rulesets.RulesetNewParamsRulesRulesetsChallengeRule], -// [rulesets.RulesetNewParamsRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRuleParam], -// [rulesets.RulesetNewParamsRulesRulesetsJsChallengeRule], -// [rulesets.LogRuleParam], -// [rulesets.RulesetNewParamsRulesRulesetsManagedChallengeRule], -// [rulesets.RulesetNewParamsRulesRulesetsRedirectRule], -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRule], -// [rulesets.RulesetNewParamsRulesRulesetsRouteRule], -// [rulesets.RulesetNewParamsRulesRulesetsScoreRule], -// [rulesets.RulesetNewParamsRulesRulesetsServeErrorRule], -// [rulesets.RulesetNewParamsRulesRulesetsSetConfigRule], [rulesets.SkipRuleParam], -// [rulesets.RulesetNewParamsRulesRulesetsSetCacheSettingsRule], -// [RulesetNewParamsRule]. -type RulesetNewParamsRuleUnion interface { - implementsRulesetsRulesetNewParamsRuleUnion() -} - -type RulesetNewParamsRulesRulesetsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsChallengeRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsChallengeRuleAction string - -const ( - RulesetNewParamsRulesRulesetsChallengeRuleActionChallenge RulesetNewParamsRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r RulesetNewParamsRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsCompressResponseRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsCompressResponseRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsCompressResponseRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsCompressResponseRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsCompressResponseRule) implementsRulesetsRulesetNewParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsCompressResponseRuleAction string - -const ( - RulesetNewParamsRulesRulesetsCompressResponseRuleActionCompressResponse RulesetNewParamsRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r RulesetNewParamsRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms param.Field[[]RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm] `json:"algorithms"` -} - -func (r RulesetNewParamsRulesRulesetsCompressResponseRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Compression algorithm to enable. -type RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name param.Field[RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName] `json:"name"` -} - -func (r RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Name of compression algorithm to enable. -type RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RulesetNewParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsJsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsJsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsJsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsJsChallengeRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsJsChallengeRuleAction string - -const ( - RulesetNewParamsRulesRulesetsJsChallengeRuleActionJsChallenge RulesetNewParamsRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RulesetNewParamsRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsManagedChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsManagedChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsManagedChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsManagedChallengeRule) implementsRulesetsRulesetNewParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsManagedChallengeRuleAction string - -const ( - RulesetNewParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge RulesetNewParamsRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RulesetNewParamsRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsRedirectRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsRedirectRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsRedirectRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRedirectRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsRedirectRuleAction string - -const ( - RulesetNewParamsRulesRulesetsRedirectRuleActionRedirect RulesetNewParamsRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RulesetNewParamsRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList param.Field[RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromList] `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue param.Field[RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValue] `json:"from_value"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on a bulk list lookup. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key param.Field[string] `json:"key"` - // The name of the list to match against. - Name param.Field[string] `json:"name"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromList) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on the request properties. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString param.Field[bool] `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode param.Field[RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode] `json:"status_code"` - // The URL to redirect the request to. - TargetURL param.Field[RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion] `json:"target_url"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The status code to be used for the redirect. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) implementsRulesetsRulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -// The URL to redirect the request to. -// -// Satisfied by -// [rulesets.RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect], -// [rulesets.RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect], -// [RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL]. -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() -} - -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRulesetNewParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsRewriteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsRewriteRuleAction string - -const ( - RulesetNewParamsRulesRulesetsRewriteRuleActionRewrite RulesetNewParamsRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RulesetNewParamsRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers param.Field[map[string]RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion] `json:"headers"` - // URI to rewrite the request to. - URI param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURI] `json:"uri"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Remove the header from the request. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeaders struct { - Operation param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value"` - // Expression for the header value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeaders) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeaders) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -// Remove the header from the request. -// -// Satisfied by -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader], -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader], -// [RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeaders]. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() -} - -// Remove the header from the request. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation] `json:"operation,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression param.Field[string] `json:"expression,required"` - Operation param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation] `json:"operation,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RulesetNewParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion] `json:"path"` - // Query portion rewrite. - Query param.Field[RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion] `json:"query"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURI) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Path portion rewrite. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPath) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPath) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Path portion rewrite. -// -// Satisfied by -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue], -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue], -// [RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPath]. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Query portion rewrite. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQuery) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQuery) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -// Query portion rewrite. -// -// Satisfied by -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue], -// [rulesets.RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue], -// [RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQuery]. -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRulesetNewParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type RulesetNewParamsRulesRulesetsRouteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsRouteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsRouteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsRouteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsRouteRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsRouteRuleAction string - -const ( - RulesetNewParamsRulesRulesetsRouteRuleActionRoute RulesetNewParamsRulesRulesetsRouteRuleAction = "route" -) - -func (r RulesetNewParamsRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader param.Field[string] `json:"host_header"` - // Override the IP/TCP destination. - Origin param.Field[RulesetNewParamsRulesRulesetsRouteRuleActionParametersOrigin] `json:"origin"` - // Override the Server Name Indication (SNI). - Sni param.Field[RulesetNewParamsRulesRulesetsRouteRuleActionParametersSni] `json:"sni"` -} - -func (r RulesetNewParamsRulesRulesetsRouteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the IP/TCP destination. -type RulesetNewParamsRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host param.Field[string] `json:"host"` - // Override the destination port. - Port param.Field[float64] `json:"port"` -} - -func (r RulesetNewParamsRulesRulesetsRouteRuleActionParametersOrigin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the Server Name Indication (SNI). -type RulesetNewParamsRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetNewParamsRulesRulesetsRouteRuleActionParametersSni) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RulesetNewParamsRulesRulesetsScoreRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsScoreRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsScoreRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsScoreRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsScoreRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsScoreRuleAction string - -const ( - RulesetNewParamsRulesRulesetsScoreRuleActionScore RulesetNewParamsRulesRulesetsScoreRuleAction = "score" -) - -func (r RulesetNewParamsRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment param.Field[int64] `json:"increment"` -} - -func (r RulesetNewParamsRulesRulesetsScoreRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RulesetNewParamsRulesRulesetsServeErrorRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsServeErrorRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsServeErrorRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsServeErrorRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsServeErrorRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsServeErrorRuleAction string - -const ( - RulesetNewParamsRulesRulesetsServeErrorRuleActionServeError RulesetNewParamsRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r RulesetNewParamsRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content param.Field[string] `json:"content"` - // Content-type header to set with the response. - ContentType param.Field[RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType] `json:"content_type"` - // The status code to use for the error. - StatusCode param.Field[float64] `json:"status_code"` -} - -func (r RulesetNewParamsRulesRulesetsServeErrorRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Content-type header to set with the response. -type RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RulesetNewParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsSetConfigRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsSetConfigRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsSetConfigRule) implementsRulesetsRulesetNewParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsSetConfigRuleAction string - -const ( - RulesetNewParamsRulesRulesetsSetConfigRuleActionSetConfig RulesetNewParamsRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites param.Field[bool] `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersAutominify] `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic param.Field[bool] `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps param.Field[bool] `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz param.Field[bool] `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation param.Field[bool] `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection param.Field[bool] `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage param.Field[bool] `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption param.Field[bool] `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish] `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader param.Field[bool] `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel] `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes param.Field[bool] `json:"server_side_excludes"` - // Configure the SSL level. - SSL param.Field[RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL] `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg param.Field[bool] `json:"sxg"` -} - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Select which file extensions to minify automatically. -type RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css param.Field[bool] `json:"css"` - // Minify HTML files. - HTML param.Field[bool] `json:"html"` - // Minify JS files. - Js param.Field[bool] `json:"js"` -} - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersAutominify) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Configure the Polish level. -type RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishOff RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishOff, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLOff RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLFull RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLOff, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLFull, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict, RulesetNewParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type RulesetNewParamsRulesRulesetsSetCacheSettingsRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRule) implementsRulesetsRulesetNewParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RulesetNewParamsRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts param.Field[[]int64] `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache param.Field[bool] `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl param.Field[bool] `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru param.Field[bool] `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout param.Field[int64] `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags param.Field[bool] `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] `json:"serve_stale"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode] `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Determines which browser ttl mode to use. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType param.Field[bool] `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor param.Field[bool] `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder param.Field[bool] `json:"ignore_query_strings_order"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] `json:"cookie"` - // The header names and values to include in building the cache key. - Header param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] `json:"user"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The cookies to include in building the cache key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Include these cookies' names and their values. - Include param.Field[[]string] `json:"include"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The header names and values to include in building the cache key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin param.Field[bool] `json:"exclude_origin"` - // Include these headers' names and their values. - Include param.Field[[]string] `json:"include"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether to use the original host or the resolved host in the cache key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved param.Field[bool] `json:"resolved"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] `json:"include"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List param.Field[[]string] `json:"list"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters used to build the cache key. - List param.Field[[]string] `json:"list"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Characteristics of the request user agent used in building the cache key. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType param.Field[bool] `json:"device_type"` - // Use the user agents's country in the cache key. - Geo param.Field[bool] `json:"geo"` - // Use the user agent's language in the cache key. - Lang param.Field[bool] `json:"lang"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible param.Field[bool] `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize param.Field[int64] `json:"min_file_size,required"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default,required"` - // edge ttl options - Mode param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode] `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL param.Field[[]RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] `json:"status_code_ttl,required"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// edge ttl options -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value param.Field[int64] `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange param.Field[RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue param.Field[int64] `json:"status_code_value"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The range of status codes used to apply the selected mode. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From param.Field[int64] `json:"from,required"` - // response status code upper bound - To param.Field[int64] `json:"to,required"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating param.Field[bool] `json:"disable_stale_while_updating,required"` -} - -func (r RulesetNewParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The action to perform when the rule matches. -type RulesetNewParamsRulesAction string - -const ( - RulesetNewParamsRulesActionBlock RulesetNewParamsRulesAction = "block" - RulesetNewParamsRulesActionChallenge RulesetNewParamsRulesAction = "challenge" - RulesetNewParamsRulesActionCompressResponse RulesetNewParamsRulesAction = "compress_response" - RulesetNewParamsRulesActionExecute RulesetNewParamsRulesAction = "execute" - RulesetNewParamsRulesActionJsChallenge RulesetNewParamsRulesAction = "js_challenge" - RulesetNewParamsRulesActionLog RulesetNewParamsRulesAction = "log" - RulesetNewParamsRulesActionManagedChallenge RulesetNewParamsRulesAction = "managed_challenge" - RulesetNewParamsRulesActionRedirect RulesetNewParamsRulesAction = "redirect" - RulesetNewParamsRulesActionRewrite RulesetNewParamsRulesAction = "rewrite" - RulesetNewParamsRulesActionRoute RulesetNewParamsRulesAction = "route" - RulesetNewParamsRulesActionScore RulesetNewParamsRulesAction = "score" - RulesetNewParamsRulesActionServeError RulesetNewParamsRulesAction = "serve_error" - RulesetNewParamsRulesActionSetConfig RulesetNewParamsRulesAction = "set_config" - RulesetNewParamsRulesActionSkip RulesetNewParamsRulesAction = "skip" - RulesetNewParamsRulesActionSetCacheSettings RulesetNewParamsRulesAction = "set_cache_settings" -) - -func (r RulesetNewParamsRulesAction) IsKnown() bool { - switch r { - case RulesetNewParamsRulesActionBlock, RulesetNewParamsRulesActionChallenge, RulesetNewParamsRulesActionCompressResponse, RulesetNewParamsRulesActionExecute, RulesetNewParamsRulesActionJsChallenge, RulesetNewParamsRulesActionLog, RulesetNewParamsRulesActionManagedChallenge, RulesetNewParamsRulesActionRedirect, RulesetNewParamsRulesActionRewrite, RulesetNewParamsRulesActionRoute, RulesetNewParamsRulesActionScore, RulesetNewParamsRulesActionServeError, RulesetNewParamsRulesActionSetConfig, RulesetNewParamsRulesActionSkip, RulesetNewParamsRulesActionSetCacheSettings: - return true - } - return false -} - -// A response object. -type RulesetNewResponseEnvelope struct { - // A list of error messages. - Errors []RulesetNewResponseEnvelopeErrors `json:"errors,required"` - // A list of warning messages. - Messages []RulesetNewResponseEnvelopeMessages `json:"messages,required"` - // A ruleset object. - Result RulesetNewResponse `json:"result,required"` - // Whether the API call was successful. - Success RulesetNewResponseEnvelopeSuccess `json:"success,required"` - JSON rulesetNewResponseEnvelopeJSON `json:"-"` -} - -// rulesetNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [RulesetNewResponseEnvelope] -type rulesetNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// A message. -type RulesetNewResponseEnvelopeErrors struct { - // A text description of this message. - Message string `json:"message,required"` - // A unique code for this message. - Code int64 `json:"code"` - // The source of this message. - Source RulesetNewResponseEnvelopeErrorsSource `json:"source"` - JSON rulesetNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// rulesetNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [RulesetNewResponseEnvelopeErrors] -type rulesetNewResponseEnvelopeErrorsJSON struct { - Message apijson.Field - Code apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw -} - -// The source of this message. -type RulesetNewResponseEnvelopeErrorsSource struct { - // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON rulesetNewResponseEnvelopeErrorsSourceJSON `json:"-"` -} - -// rulesetNewResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the -// struct [RulesetNewResponseEnvelopeErrorsSource] -type rulesetNewResponseEnvelopeErrorsSourceJSON struct { - Pointer apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseEnvelopeErrorsSourceJSON) RawJSON() string { - return r.raw -} - -// A message. -type RulesetNewResponseEnvelopeMessages struct { - // A text description of this message. - Message string `json:"message,required"` - // A unique code for this message. - Code int64 `json:"code"` - // The source of this message. - Source RulesetNewResponseEnvelopeMessagesSource `json:"source"` - JSON rulesetNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// rulesetNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct -// [RulesetNewResponseEnvelopeMessages] -type rulesetNewResponseEnvelopeMessagesJSON struct { - Message apijson.Field - Code apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw -} - -// The source of this message. -type RulesetNewResponseEnvelopeMessagesSource struct { - // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON rulesetNewResponseEnvelopeMessagesSourceJSON `json:"-"` -} - -// rulesetNewResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the -// struct [RulesetNewResponseEnvelopeMessagesSource] -type rulesetNewResponseEnvelopeMessagesSourceJSON struct { - Pointer apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RulesetNewResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r rulesetNewResponseEnvelopeMessagesSourceJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful. -type RulesetNewResponseEnvelopeSuccess bool - -const ( - RulesetNewResponseEnvelopeSuccessTrue RulesetNewResponseEnvelopeSuccess = true -) - -func (r RulesetNewResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RulesetNewResponseEnvelopeSuccessTrue: - return true - } - return false -} - -type RulesetUpdateParams struct { - // The list of rules in the ruleset. - Rules param.Field[[]RulesetUpdateParamsRuleUnion] `json:"rules,required"` - // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - AccountID param.Field[string] `path:"account_id"` - // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - ZoneID param.Field[string] `path:"zone_id"` - // An informative description of the ruleset. - Description param.Field[string] `json:"description"` - // The kind of the ruleset. - Kind param.Field[RulesetUpdateParamsKind] `json:"kind"` - // The human-readable name of the ruleset. - Name param.Field[string] `json:"name"` - // The phase of the ruleset. - Phase param.Field[RulesetUpdateParamsPhase] `json:"phase"` -} - -func (r RulesetUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RulesetUpdateParamsRule struct { - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesAction] `json:"action"` - ActionParameters param.Field[interface{}] `json:"action_parameters,required"` - Categories param.Field[interface{}] `json:"categories,required"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRule) implementsRulesetsRulesetUpdateParamsRuleUnion() {} - -// Satisfied by [rulesets.BlockRuleParam], -// [rulesets.RulesetUpdateParamsRulesRulesetsChallengeRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRuleParam], -// [rulesets.RulesetUpdateParamsRulesRulesetsJsChallengeRule], -// [rulesets.LogRuleParam], -// [rulesets.RulesetUpdateParamsRulesRulesetsManagedChallengeRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsRedirectRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsRouteRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsScoreRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsServeErrorRule], -// [rulesets.RulesetUpdateParamsRulesRulesetsSetConfigRule], -// [rulesets.SkipRuleParam], -// [rulesets.RulesetUpdateParamsRulesRulesetsSetCacheSettingsRule], -// [RulesetUpdateParamsRule]. -type RulesetUpdateParamsRuleUnion interface { - implementsRulesetsRulesetUpdateParamsRuleUnion() -} - -type RulesetUpdateParamsRulesRulesetsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsChallengeRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsChallengeRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsChallengeRuleActionChallenge RulesetUpdateParamsRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r RulesetUpdateParamsRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type RulesetUpdateParamsRulesRulesetsCompressResponseRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsCompressResponseRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsCompressResponseRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionCompressResponse RulesetUpdateParamsRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms param.Field[[]RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm] `json:"algorithms"` -} - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Compression algorithm to enable. -type RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name param.Field[RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName] `json:"name"` -} - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithm) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Name of compression algorithm to enable. -type RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, RulesetUpdateParamsRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type RulesetUpdateParamsRulesRulesetsJsChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsJsChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsJsChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsJsChallengeRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsJsChallengeRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsJsChallengeRuleActionJsChallenge RulesetUpdateParamsRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r RulesetUpdateParamsRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type RulesetUpdateParamsRulesRulesetsManagedChallengeRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsManagedChallengeRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[interface{}] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsManagedChallengeRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsManagedChallengeRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsManagedChallengeRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge RulesetUpdateParamsRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r RulesetUpdateParamsRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type RulesetUpdateParamsRulesRulesetsRedirectRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsRedirectRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsRedirectRuleActionRedirect RulesetUpdateParamsRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList] `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue] `json:"from_value"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on a bulk list lookup. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key param.Field[string] `json:"key"` - // The name of the list to match against. - Name param.Field[string] `json:"name"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromList) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Serve a redirect based on the request properties. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString param.Field[bool] `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode] `json:"status_code"` - // The URL to redirect the request to. - TargetURL param.Field[RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion] `json:"target_url"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The status code to be used for the redirect. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) implementsRulesetsRulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -// The URL to redirect the request to. -// -// Satisfied by -// [rulesets.RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect], -// [rulesets.RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect], -// [RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURL]. -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsRulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() -} - -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value param.Field[string] `json:"value"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsRulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsRulesetUpdateParamsRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsRewriteRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsRewriteRuleActionRewrite RulesetUpdateParamsRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers param.Field[map[string]RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion] `json:"headers"` - // URI to rewrite the request to. - URI param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURI] `json:"uri"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Remove the header from the request. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders struct { - Operation param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value"` - // Expression for the header value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -// Remove the header from the request. -// -// Satisfied by -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader], -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader], -// [RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeaders]. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() -} - -// Remove the header from the request. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation] `json:"operation,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation] `json:"operation,required"` - // Static value for the header. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression param.Field[string] `json:"expression,required"` - Operation param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation] `json:"operation,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion] `json:"path"` - // Query portion rewrite. - Query param.Field[RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion] `json:"query"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURI) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Path portion rewrite. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Path portion rewrite. -// -// Satisfied by -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue], -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue], -// [RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPath]. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIPathUnion() { -} - -// Query portion rewrite. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value param.Field[string] `json:"value"` - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -// Query portion rewrite. -// -// Satisfied by -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue], -// [rulesets.RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue], -// [RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQuery]. -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression param.Field[string] `json:"expression,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsRulesetUpdateParamsRulesRulesetsRewriteRuleActionParametersURIQueryUnion() { -} - -type RulesetUpdateParamsRulesRulesetsRouteRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsRouteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsRouteRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsRouteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsRouteRule) implementsRulesetsRulesetUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsRouteRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsRouteRuleActionRoute RulesetUpdateParamsRulesRulesetsRouteRuleAction = "route" -) - -func (r RulesetUpdateParamsRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader param.Field[string] `json:"host_header"` - // Override the IP/TCP destination. - Origin param.Field[RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin] `json:"origin"` - // Override the Server Name Indication (SNI). - Sni param.Field[RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersSni] `json:"sni"` -} - -func (r RulesetUpdateParamsRulesRulesetsRouteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the IP/TCP destination. -type RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host param.Field[string] `json:"host"` - // Override the destination port. - Port param.Field[float64] `json:"port"` -} - -func (r RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersOrigin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Override the Server Name Indication (SNI). -type RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value param.Field[string] `json:"value,required"` -} - -func (r RulesetUpdateParamsRulesRulesetsRouteRuleActionParametersSni) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RulesetUpdateParamsRulesRulesetsScoreRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsScoreRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsScoreRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RulesetUpdateParamsRulesRulesetsScoreRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsScoreRule) implementsRulesetsRulesetUpdateParamsRuleUnion() {} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsScoreRuleAction string +// The action to perform when the rule matches. +type RulesetUpdateResponseRulesAction string const ( - RulesetUpdateParamsRulesRulesetsScoreRuleActionScore RulesetUpdateParamsRulesRulesetsScoreRuleAction = "score" + RulesetUpdateResponseRulesActionBlock RulesetUpdateResponseRulesAction = "block" + RulesetUpdateResponseRulesActionChallenge RulesetUpdateResponseRulesAction = "challenge" + RulesetUpdateResponseRulesActionCompressResponse RulesetUpdateResponseRulesAction = "compress_response" + RulesetUpdateResponseRulesActionExecute RulesetUpdateResponseRulesAction = "execute" + RulesetUpdateResponseRulesActionJsChallenge RulesetUpdateResponseRulesAction = "js_challenge" + RulesetUpdateResponseRulesActionLog RulesetUpdateResponseRulesAction = "log" + RulesetUpdateResponseRulesActionManagedChallenge RulesetUpdateResponseRulesAction = "managed_challenge" + RulesetUpdateResponseRulesActionRedirect RulesetUpdateResponseRulesAction = "redirect" + RulesetUpdateResponseRulesActionRewrite RulesetUpdateResponseRulesAction = "rewrite" + RulesetUpdateResponseRulesActionRoute RulesetUpdateResponseRulesAction = "route" + RulesetUpdateResponseRulesActionScore RulesetUpdateResponseRulesAction = "score" + RulesetUpdateResponseRulesActionServeError RulesetUpdateResponseRulesAction = "serve_error" + RulesetUpdateResponseRulesActionSetConfig RulesetUpdateResponseRulesAction = "set_config" + RulesetUpdateResponseRulesActionSkip RulesetUpdateResponseRulesAction = "skip" + RulesetUpdateResponseRulesActionSetCacheSettings RulesetUpdateResponseRulesAction = "set_cache_settings" ) -func (r RulesetUpdateParamsRulesRulesetsScoreRuleAction) IsKnown() bool { +func (r RulesetUpdateResponseRulesAction) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsScoreRuleActionScore: + case RulesetUpdateResponseRulesActionBlock, RulesetUpdateResponseRulesActionChallenge, RulesetUpdateResponseRulesActionCompressResponse, RulesetUpdateResponseRulesActionExecute, RulesetUpdateResponseRulesActionJsChallenge, RulesetUpdateResponseRulesActionLog, RulesetUpdateResponseRulesActionManagedChallenge, RulesetUpdateResponseRulesActionRedirect, RulesetUpdateResponseRulesActionRewrite, RulesetUpdateResponseRulesActionRoute, RulesetUpdateResponseRulesActionScore, RulesetUpdateResponseRulesActionServeError, RulesetUpdateResponseRulesActionSetConfig, RulesetUpdateResponseRulesActionSkip, RulesetUpdateResponseRulesActionSetCacheSettings: return true } return false } -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment param.Field[int64] `json:"increment"` -} - -func (r RulesetUpdateParamsRulesRulesetsScoreRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// A ruleset object. +type RulesetGetResponse struct { + // The unique ID of the ruleset. + ID string `json:"id,required"` + // The kind of the ruleset. + Kind RulesetGetResponseKind `json:"kind,required"` + // The timestamp of when the ruleset was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` + // The human-readable name of the ruleset. + Name string `json:"name,required"` + // The phase of the ruleset. + Phase RulesetGetResponsePhase `json:"phase,required"` + // The list of rules in the ruleset. + Rules []RulesetGetResponseRule `json:"rules,required"` + // The version of the ruleset. + Version string `json:"version,required"` + // An informative description of the ruleset. + Description string `json:"description"` + JSON rulesetGetResponseJSON `json:"-"` } -type RulesetUpdateParamsRulesRulesetsServeErrorRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` - // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsServeErrorRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParameters] `json:"action_parameters"` - // An informative description of the rule. - Description param.Field[string] `json:"description"` - // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` - // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` +// rulesetGetResponseJSON contains the JSON metadata for the struct +// [RulesetGetResponse] +type rulesetGetResponseJSON struct { + ID apijson.Field + Kind apijson.Field + LastUpdated apijson.Field + Name apijson.Field + Phase apijson.Field + Rules apijson.Field + Version apijson.Field + Description apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r RulesetUpdateParamsRulesRulesetsServeErrorRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r *RulesetGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsServeErrorRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { +func (r rulesetGetResponseJSON) RawJSON() string { + return r.raw } -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsServeErrorRuleAction string +// The kind of the ruleset. +type RulesetGetResponseKind string const ( - RulesetUpdateParamsRulesRulesetsServeErrorRuleActionServeError RulesetUpdateParamsRulesRulesetsServeErrorRuleAction = "serve_error" + RulesetGetResponseKindManaged RulesetGetResponseKind = "managed" + RulesetGetResponseKindCustom RulesetGetResponseKind = "custom" + RulesetGetResponseKindRoot RulesetGetResponseKind = "root" + RulesetGetResponseKindZone RulesetGetResponseKind = "zone" ) -func (r RulesetUpdateParamsRulesRulesetsServeErrorRuleAction) IsKnown() bool { +func (r RulesetGetResponseKind) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsServeErrorRuleActionServeError: + case RulesetGetResponseKindManaged, RulesetGetResponseKindCustom, RulesetGetResponseKindRoot, RulesetGetResponseKindZone: return true } return false } -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content param.Field[string] `json:"content"` - // Content-type header to set with the response. - ContentType param.Field[RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType] `json:"content_type"` - // The status code to use for the error. - StatusCode param.Field[float64] `json:"status_code"` -} - -func (r RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Content-type header to set with the response. -type RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType string +// The phase of the ruleset. +type RulesetGetResponsePhase string const ( - RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" + RulesetGetResponsePhaseDDoSL4 RulesetGetResponsePhase = "ddos_l4" + RulesetGetResponsePhaseDDoSL7 RulesetGetResponsePhase = "ddos_l7" + RulesetGetResponsePhaseHTTPConfigSettings RulesetGetResponsePhase = "http_config_settings" + RulesetGetResponsePhaseHTTPCustomErrors RulesetGetResponsePhase = "http_custom_errors" + RulesetGetResponsePhaseHTTPLogCustomFields RulesetGetResponsePhase = "http_log_custom_fields" + RulesetGetResponsePhaseHTTPRatelimit RulesetGetResponsePhase = "http_ratelimit" + RulesetGetResponsePhaseHTTPRequestCacheSettings RulesetGetResponsePhase = "http_request_cache_settings" + RulesetGetResponsePhaseHTTPRequestDynamicRedirect RulesetGetResponsePhase = "http_request_dynamic_redirect" + RulesetGetResponsePhaseHTTPRequestFirewallCustom RulesetGetResponsePhase = "http_request_firewall_custom" + RulesetGetResponsePhaseHTTPRequestFirewallManaged RulesetGetResponsePhase = "http_request_firewall_managed" + RulesetGetResponsePhaseHTTPRequestLateTransform RulesetGetResponsePhase = "http_request_late_transform" + RulesetGetResponsePhaseHTTPRequestOrigin RulesetGetResponsePhase = "http_request_origin" + RulesetGetResponsePhaseHTTPRequestRedirect RulesetGetResponsePhase = "http_request_redirect" + RulesetGetResponsePhaseHTTPRequestSanitize RulesetGetResponsePhase = "http_request_sanitize" + RulesetGetResponsePhaseHTTPRequestSbfm RulesetGetResponsePhase = "http_request_sbfm" + RulesetGetResponsePhaseHTTPRequestSelectConfiguration RulesetGetResponsePhase = "http_request_select_configuration" + RulesetGetResponsePhaseHTTPRequestTransform RulesetGetResponsePhase = "http_request_transform" + RulesetGetResponsePhaseHTTPResponseCompression RulesetGetResponsePhase = "http_response_compression" + RulesetGetResponsePhaseHTTPResponseFirewallManaged RulesetGetResponsePhase = "http_response_firewall_managed" + RulesetGetResponsePhaseHTTPResponseHeadersTransform RulesetGetResponsePhase = "http_response_headers_transform" + RulesetGetResponsePhaseMagicTransit RulesetGetResponsePhase = "magic_transit" + RulesetGetResponsePhaseMagicTransitIDsManaged RulesetGetResponsePhase = "magic_transit_ids_managed" + RulesetGetResponsePhaseMagicTransitManaged RulesetGetResponsePhase = "magic_transit_managed" ) -func (r RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { +func (r RulesetGetResponsePhase) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, RulesetUpdateParamsRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: + case RulesetGetResponsePhaseDDoSL4, RulesetGetResponsePhaseDDoSL7, RulesetGetResponsePhaseHTTPConfigSettings, RulesetGetResponsePhaseHTTPCustomErrors, RulesetGetResponsePhaseHTTPLogCustomFields, RulesetGetResponsePhaseHTTPRatelimit, RulesetGetResponsePhaseHTTPRequestCacheSettings, RulesetGetResponsePhaseHTTPRequestDynamicRedirect, RulesetGetResponsePhaseHTTPRequestFirewallCustom, RulesetGetResponsePhaseHTTPRequestFirewallManaged, RulesetGetResponsePhaseHTTPRequestLateTransform, RulesetGetResponsePhaseHTTPRequestOrigin, RulesetGetResponsePhaseHTTPRequestRedirect, RulesetGetResponsePhaseHTTPRequestSanitize, RulesetGetResponsePhaseHTTPRequestSbfm, RulesetGetResponsePhaseHTTPRequestSelectConfiguration, RulesetGetResponsePhaseHTTPRequestTransform, RulesetGetResponsePhaseHTTPResponseCompression, RulesetGetResponsePhaseHTTPResponseFirewallManaged, RulesetGetResponsePhaseHTTPResponseHeadersTransform, RulesetGetResponsePhaseMagicTransit, RulesetGetResponsePhaseMagicTransitIDsManaged, RulesetGetResponsePhaseMagicTransitManaged: return true } return false } -type RulesetUpdateParamsRulesRulesetsSetConfigRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` +type RulesetGetResponseRule struct { // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParameters] `json:"action_parameters"` + Action RulesetGetResponseRulesAction `json:"action"` + ActionParameters interface{} `json:"action_parameters,required"` + Categories interface{} `json:"categories,required"` // An informative description of the rule. - Description param.Field[string] `json:"description"` + Description string `json:"description"` // Whether the rule should be executed. - Enabled param.Field[bool] `json:"enabled"` + Enabled bool `json:"enabled"` // The expression defining which traffic will match the rule. - Expression param.Field[string] `json:"expression"` + Expression string `json:"expression"` + // The unique ID of the rule. + ID string `json:"id"` + // The timestamp of when the rule was last modified. + LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging param.Field[LoggingParam] `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` + Ref string `json:"ref"` + // The version of the rule. + Version string `json:"version,required"` + JSON rulesetGetResponseRuleJSON `json:"-"` + union RulesetGetResponseRulesUnion } -func (r RulesetUpdateParamsRulesRulesetsSetConfigRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetGetResponseRuleJSON contains the JSON metadata for the struct +// [RulesetGetResponseRule] +type rulesetGetResponseRuleJSON struct { + Action apijson.Field + ActionParameters apijson.Field + Categories apijson.Field + Description apijson.Field + Enabled apijson.Field + Expression apijson.Field + ID apijson.Field + LastUpdated apijson.Field + Logging apijson.Field + Ref apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r rulesetGetResponseRuleJSON) RawJSON() string { + return r.raw +} + +func (r *RulesetGetResponseRule) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) +} + +func (r RulesetGetResponseRule) AsUnion() RulesetGetResponseRulesUnion { + return r.union +} + +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. +type RulesetGetResponseRulesUnion interface { + implementsRulesetsRulesetGetResponseRule() } -func (r RulesetUpdateParamsRulesRulesetsSetConfigRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RulesetGetResponseRulesUnion)(nil)).Elem(), + "action", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(BlockRule{}), + DiscriminatorValue: "block", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ChallengeRule{}), + DiscriminatorValue: "challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(CompressResponseRule{}), + DiscriminatorValue: "compress_response", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ExecuteRule{}), + DiscriminatorValue: "execute", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(JsChallengeRule{}), + DiscriminatorValue: "js_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(LogRule{}), + DiscriminatorValue: "log", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ManagedChallengeRule{}), + DiscriminatorValue: "managed_challenge", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RedirectRule{}), + DiscriminatorValue: "redirect", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RewriteRule{}), + DiscriminatorValue: "rewrite", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(RouteRule{}), + DiscriminatorValue: "route", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ScoreRule{}), + DiscriminatorValue: "score", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ServeErrorRule{}), + DiscriminatorValue: "serve_error", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetConfigRule{}), + DiscriminatorValue: "set_config", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SkipRule{}), + DiscriminatorValue: "skip", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(SetCacheSettingsRule{}), + DiscriminatorValue: "set_cache_settings", + }, + ) } // The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleAction string +type RulesetGetResponseRulesAction string const ( - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionSetConfig RulesetUpdateParamsRulesRulesetsSetConfigRuleAction = "set_config" + RulesetGetResponseRulesActionBlock RulesetGetResponseRulesAction = "block" + RulesetGetResponseRulesActionChallenge RulesetGetResponseRulesAction = "challenge" + RulesetGetResponseRulesActionCompressResponse RulesetGetResponseRulesAction = "compress_response" + RulesetGetResponseRulesActionExecute RulesetGetResponseRulesAction = "execute" + RulesetGetResponseRulesActionJsChallenge RulesetGetResponseRulesAction = "js_challenge" + RulesetGetResponseRulesActionLog RulesetGetResponseRulesAction = "log" + RulesetGetResponseRulesActionManagedChallenge RulesetGetResponseRulesAction = "managed_challenge" + RulesetGetResponseRulesActionRedirect RulesetGetResponseRulesAction = "redirect" + RulesetGetResponseRulesActionRewrite RulesetGetResponseRulesAction = "rewrite" + RulesetGetResponseRulesActionRoute RulesetGetResponseRulesAction = "route" + RulesetGetResponseRulesActionScore RulesetGetResponseRulesAction = "score" + RulesetGetResponseRulesActionServeError RulesetGetResponseRulesAction = "serve_error" + RulesetGetResponseRulesActionSetConfig RulesetGetResponseRulesAction = "set_config" + RulesetGetResponseRulesActionSkip RulesetGetResponseRulesAction = "skip" + RulesetGetResponseRulesActionSetCacheSettings RulesetGetResponseRulesAction = "set_cache_settings" ) -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleAction) IsKnown() bool { +func (r RulesetGetResponseRulesAction) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsSetConfigRuleActionSetConfig: + case RulesetGetResponseRulesActionBlock, RulesetGetResponseRulesActionChallenge, RulesetGetResponseRulesActionCompressResponse, RulesetGetResponseRulesActionExecute, RulesetGetResponseRulesActionJsChallenge, RulesetGetResponseRulesActionLog, RulesetGetResponseRulesActionManagedChallenge, RulesetGetResponseRulesActionRedirect, RulesetGetResponseRulesActionRewrite, RulesetGetResponseRulesActionRoute, RulesetGetResponseRulesActionScore, RulesetGetResponseRulesActionServeError, RulesetGetResponseRulesActionSetConfig, RulesetGetResponseRulesActionSkip, RulesetGetResponseRulesActionSetCacheSettings: return true } return false } -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites param.Field[bool] `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify] `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic param.Field[bool] `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps param.Field[bool] `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz param.Field[bool] `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation param.Field[bool] `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection param.Field[bool] `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage param.Field[bool] `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption param.Field[bool] `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish] `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader param.Field[bool] `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel] `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes param.Field[bool] `json:"server_side_excludes"` - // Configure the SSL level. - SSL param.Field[RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL] `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg param.Field[bool] `json:"sxg"` -} - -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Select which file extensions to minify automatically. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css param.Field[bool] `json:"css"` - // Minify HTML files. - HTML param.Field[bool] `json:"html"` - // Minify JS files. - Js param.Field[bool] `json:"js"` +type RulesetNewParams struct { + // The kind of the ruleset. + Kind param.Field[RulesetNewParamsKind] `json:"kind,required"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name,required"` + // The phase of the ruleset. + Phase param.Field[RulesetNewParamsPhase] `json:"phase,required"` + // The list of rules in the ruleset. + Rules param.Field[[]RulesetNewParamsRuleUnion] `json:"rules,required"` + // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + AccountID param.Field[string] `path:"account_id"` + // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + ZoneID param.Field[string] `path:"zone_id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` } -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersAutominify) MarshalJSON() (data []byte, err error) { +func (r RulesetNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Configure the Polish level. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishOff RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "off" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishOff, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossless, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel string +// The kind of the ruleset. +type RulesetNewParamsKind string const ( - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" + RulesetNewParamsKindManaged RulesetNewParamsKind = "managed" + RulesetNewParamsKindCustom RulesetNewParamsKind = "custom" + RulesetNewParamsKindRoot RulesetNewParamsKind = "root" + RulesetNewParamsKindZone RulesetNewParamsKind = "zone" ) -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { +func (r RulesetNewParamsKind) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: + case RulesetNewParamsKindManaged, RulesetNewParamsKindCustom, RulesetNewParamsKindRoot, RulesetNewParamsKindZone: return true } return false } -// Configure the SSL level. -type RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL string +// The phase of the ruleset. +type RulesetNewParamsPhase string const ( - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOff RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "off" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFull RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "full" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" + RulesetNewParamsPhaseDDoSL4 RulesetNewParamsPhase = "ddos_l4" + RulesetNewParamsPhaseDDoSL7 RulesetNewParamsPhase = "ddos_l7" + RulesetNewParamsPhaseHTTPConfigSettings RulesetNewParamsPhase = "http_config_settings" + RulesetNewParamsPhaseHTTPCustomErrors RulesetNewParamsPhase = "http_custom_errors" + RulesetNewParamsPhaseHTTPLogCustomFields RulesetNewParamsPhase = "http_log_custom_fields" + RulesetNewParamsPhaseHTTPRatelimit RulesetNewParamsPhase = "http_ratelimit" + RulesetNewParamsPhaseHTTPRequestCacheSettings RulesetNewParamsPhase = "http_request_cache_settings" + RulesetNewParamsPhaseHTTPRequestDynamicRedirect RulesetNewParamsPhase = "http_request_dynamic_redirect" + RulesetNewParamsPhaseHTTPRequestFirewallCustom RulesetNewParamsPhase = "http_request_firewall_custom" + RulesetNewParamsPhaseHTTPRequestFirewallManaged RulesetNewParamsPhase = "http_request_firewall_managed" + RulesetNewParamsPhaseHTTPRequestLateTransform RulesetNewParamsPhase = "http_request_late_transform" + RulesetNewParamsPhaseHTTPRequestOrigin RulesetNewParamsPhase = "http_request_origin" + RulesetNewParamsPhaseHTTPRequestRedirect RulesetNewParamsPhase = "http_request_redirect" + RulesetNewParamsPhaseHTTPRequestSanitize RulesetNewParamsPhase = "http_request_sanitize" + RulesetNewParamsPhaseHTTPRequestSbfm RulesetNewParamsPhase = "http_request_sbfm" + RulesetNewParamsPhaseHTTPRequestSelectConfiguration RulesetNewParamsPhase = "http_request_select_configuration" + RulesetNewParamsPhaseHTTPRequestTransform RulesetNewParamsPhase = "http_request_transform" + RulesetNewParamsPhaseHTTPResponseCompression RulesetNewParamsPhase = "http_response_compression" + RulesetNewParamsPhaseHTTPResponseFirewallManaged RulesetNewParamsPhase = "http_response_firewall_managed" + RulesetNewParamsPhaseHTTPResponseHeadersTransform RulesetNewParamsPhase = "http_response_headers_transform" + RulesetNewParamsPhaseMagicTransit RulesetNewParamsPhase = "magic_transit" + RulesetNewParamsPhaseMagicTransitIDsManaged RulesetNewParamsPhase = "magic_transit_ids_managed" + RulesetNewParamsPhaseMagicTransitManaged RulesetNewParamsPhase = "magic_transit_managed" ) -func (r RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { +func (r RulesetNewParamsPhase) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOff, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFlexible, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLFull, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLStrict, RulesetUpdateParamsRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: + case RulesetNewParamsPhaseDDoSL4, RulesetNewParamsPhaseDDoSL7, RulesetNewParamsPhaseHTTPConfigSettings, RulesetNewParamsPhaseHTTPCustomErrors, RulesetNewParamsPhaseHTTPLogCustomFields, RulesetNewParamsPhaseHTTPRatelimit, RulesetNewParamsPhaseHTTPRequestCacheSettings, RulesetNewParamsPhaseHTTPRequestDynamicRedirect, RulesetNewParamsPhaseHTTPRequestFirewallCustom, RulesetNewParamsPhaseHTTPRequestFirewallManaged, RulesetNewParamsPhaseHTTPRequestLateTransform, RulesetNewParamsPhaseHTTPRequestOrigin, RulesetNewParamsPhaseHTTPRequestRedirect, RulesetNewParamsPhaseHTTPRequestSanitize, RulesetNewParamsPhaseHTTPRequestSbfm, RulesetNewParamsPhaseHTTPRequestSelectConfiguration, RulesetNewParamsPhaseHTTPRequestTransform, RulesetNewParamsPhaseHTTPResponseCompression, RulesetNewParamsPhaseHTTPResponseFirewallManaged, RulesetNewParamsPhaseHTTPResponseHeadersTransform, RulesetNewParamsPhaseMagicTransit, RulesetNewParamsPhaseMagicTransitIDsManaged, RulesetNewParamsPhaseMagicTransitManaged: return true } return false } -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRule struct { - // The unique ID of the rule. - ID param.Field[string] `json:"id"` +type RulesetNewParamsRule struct { // The action to perform when the rule matches. - Action param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters] `json:"action_parameters"` + Action param.Field[RulesetNewParamsRulesAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters,required"` + Categories param.Field[interface{}] `json:"categories,required"` // An informative description of the rule. Description param.Field[string] `json:"description"` // Whether the rule should be executed. Enabled param.Field[bool] `json:"enabled"` // The expression defining which traffic will match the rule. Expression param.Field[string] `json:"expression"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` // An object configuring the rule's logging behavior. Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRule) implementsRulesetsRulesetUpdateParamsRuleUnion() { -} - -// The action to perform when the rule matches. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleAction string - -const ( - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts param.Field[[]int64] `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache param.Field[bool] `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl param.Field[bool] `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru param.Field[bool] `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout param.Field[int64] `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags param.Field[bool] `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] `json:"serve_stale"` -} - -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParameters) MarshalJSON() (data []byte, err error) { +func (r RulesetNewParamsRule) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode] `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default"` -} +func (r RulesetNewParamsRule) implementsRulesetsRulesetNewParamsRuleUnion() {} -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Satisfied by [rulesets.BlockRuleParam], [rulesets.ChallengeRuleParam], +// [rulesets.CompressResponseRuleParam], [rulesets.ExecuteRuleParam], +// [rulesets.JsChallengeRuleParam], [rulesets.LogRuleParam], +// [rulesets.ManagedChallengeRuleParam], [rulesets.RedirectRuleParam], +// [rulesets.RewriteRuleParam], [rulesets.RouteRuleParam], +// [rulesets.ScoreRuleParam], [rulesets.ServeErrorRuleParam], +// [rulesets.SetConfigRuleParam], [rulesets.SkipRuleParam], +// [rulesets.SetCacheSettingsRuleParam], [RulesetNewParamsRule]. +type RulesetNewParamsRuleUnion interface { + implementsRulesetsRulesetNewParamsRuleUnion() } -// Determines which browser ttl mode to use. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string +// The action to perform when the rule matches. +type RulesetNewParamsRulesAction string const ( - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" + RulesetNewParamsRulesActionBlock RulesetNewParamsRulesAction = "block" + RulesetNewParamsRulesActionChallenge RulesetNewParamsRulesAction = "challenge" + RulesetNewParamsRulesActionCompressResponse RulesetNewParamsRulesAction = "compress_response" + RulesetNewParamsRulesActionExecute RulesetNewParamsRulesAction = "execute" + RulesetNewParamsRulesActionJsChallenge RulesetNewParamsRulesAction = "js_challenge" + RulesetNewParamsRulesActionLog RulesetNewParamsRulesAction = "log" + RulesetNewParamsRulesActionManagedChallenge RulesetNewParamsRulesAction = "managed_challenge" + RulesetNewParamsRulesActionRedirect RulesetNewParamsRulesAction = "redirect" + RulesetNewParamsRulesActionRewrite RulesetNewParamsRulesAction = "rewrite" + RulesetNewParamsRulesActionRoute RulesetNewParamsRulesAction = "route" + RulesetNewParamsRulesActionScore RulesetNewParamsRulesAction = "score" + RulesetNewParamsRulesActionServeError RulesetNewParamsRulesAction = "serve_error" + RulesetNewParamsRulesActionSetConfig RulesetNewParamsRulesAction = "set_config" + RulesetNewParamsRulesActionSkip RulesetNewParamsRulesAction = "skip" + RulesetNewParamsRulesActionSetCacheSettings RulesetNewParamsRulesAction = "set_cache_settings" ) -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { +func (r RulesetNewParamsRulesAction) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: + case RulesetNewParamsRulesActionBlock, RulesetNewParamsRulesActionChallenge, RulesetNewParamsRulesActionCompressResponse, RulesetNewParamsRulesActionExecute, RulesetNewParamsRulesActionJsChallenge, RulesetNewParamsRulesActionLog, RulesetNewParamsRulesActionManagedChallenge, RulesetNewParamsRulesActionRedirect, RulesetNewParamsRulesActionRewrite, RulesetNewParamsRulesActionRoute, RulesetNewParamsRulesActionScore, RulesetNewParamsRulesActionServeError, RulesetNewParamsRulesActionSetConfig, RulesetNewParamsRulesActionSkip, RulesetNewParamsRulesActionSetCacheSettings: return true } return false } -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType param.Field[bool] `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor param.Field[bool] `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder param.Field[bool] `json:"ignore_query_strings_order"` -} - -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Customize which components of the request are included or excluded from the -// cache key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] `json:"cookie"` - // The header names and values to include in building the cache key. - Header param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] `json:"user"` +// A response object. +type RulesetNewResponseEnvelope struct { + // A list of error messages. + Errors []RulesetNewResponseEnvelopeErrors `json:"errors,required"` + // A list of warning messages. + Messages []RulesetNewResponseEnvelopeMessages `json:"messages,required"` + // A ruleset object. + Result RulesetNewResponse `json:"result,required"` + // Whether the API call was successful. + Success RulesetNewResponseEnvelopeSuccess `json:"success,required"` + JSON rulesetNewResponseEnvelopeJSON `json:"-"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [RulesetNewResponseEnvelope] +type rulesetNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// The cookies to include in building the cache key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Include these cookies' names and their values. - Include param.Field[[]string] `json:"include"` +func (r *RulesetNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r rulesetNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// The header names and values to include in building the cache key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence param.Field[[]string] `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin param.Field[bool] `json:"exclude_origin"` - // Include these headers' names and their values. - Include param.Field[[]string] `json:"include"` +// A message. +type RulesetNewResponseEnvelopeErrors struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source RulesetNewResponseEnvelopeErrorsSource `json:"source"` + JSON rulesetNewResponseEnvelopeErrorsJSON `json:"-"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct +// [RulesetNewResponseEnvelopeErrors] +type rulesetNewResponseEnvelopeErrorsJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// Whether to use the original host or the resolved host in the cache key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved param.Field[bool] `json:"resolved"` +func (r *RulesetNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r rulesetNewResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw } -// Use the presence or absence of parameters in the query string to build the cache -// key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] `json:"include"` +// The source of this message. +type RulesetNewResponseEnvelopeErrorsSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON rulesetNewResponseEnvelopeErrorsSourceJSON `json:"-"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetNewResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the +// struct [RulesetNewResponseEnvelopeErrorsSource] +type rulesetNewResponseEnvelopeErrorsSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List param.Field[[]string] `json:"list"` +func (r *RulesetNewResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r rulesetNewResponseEnvelopeErrorsSourceJSON) RawJSON() string { + return r.raw } -// build the cache key using a list of query string parameters that ARE in the -// request. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All param.Field[bool] `json:"all"` - // A list of query string parameters used to build the cache key. - List param.Field[[]string] `json:"list"` +// A message. +type RulesetNewResponseEnvelopeMessages struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source RulesetNewResponseEnvelopeMessagesSource `json:"source"` + JSON rulesetNewResponseEnvelopeMessagesJSON `json:"-"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct +// [RulesetNewResponseEnvelopeMessages] +type rulesetNewResponseEnvelopeMessagesJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// Characteristics of the request user agent used in building the cache key. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType param.Field[bool] `json:"device_type"` - // Use the user agents's country in the cache key. - Geo param.Field[bool] `json:"geo"` - // Use the user agent's language in the cache key. - Lang param.Field[bool] `json:"lang"` +func (r *RulesetNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r rulesetNewResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw } -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible param.Field[bool] `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize param.Field[int64] `json:"min_file_size,required"` +// The source of this message. +type RulesetNewResponseEnvelopeMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON rulesetNewResponseEnvelopeMessagesSourceJSON `json:"-"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// rulesetNewResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the +// struct [RulesetNewResponseEnvelopeMessagesSource] +type rulesetNewResponseEnvelopeMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default param.Field[int64] `json:"default,required"` - // edge ttl options - Mode param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode] `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL param.Field[[]RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] `json:"status_code_ttl,required"` +func (r *RulesetNewResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r rulesetNewResponseEnvelopeMessagesSourceJSON) RawJSON() string { + return r.raw } -// edge ttl options -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string +// Whether the API call was successful. +type RulesetNewResponseEnvelopeSuccess bool const ( - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" + RulesetNewResponseEnvelopeSuccessTrue RulesetNewResponseEnvelopeSuccess = true ) -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { +func (r RulesetNewResponseEnvelopeSuccess) IsKnown() bool { switch r { - case RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: + case RulesetNewResponseEnvelopeSuccessTrue: return true } return false } -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value param.Field[int64] `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange param.Field[RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue param.Field[int64] `json:"status_code_value"` +type RulesetUpdateParams struct { + // The list of rules in the ruleset. + Rules param.Field[[]RulesetUpdateParamsRuleUnion] `json:"rules,required"` + // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + AccountID param.Field[string] `path:"account_id"` + // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + ZoneID param.Field[string] `path:"zone_id"` + // An informative description of the ruleset. + Description param.Field[string] `json:"description"` + // The kind of the ruleset. + Kind param.Field[RulesetUpdateParamsKind] `json:"kind"` + // The human-readable name of the ruleset. + Name param.Field[string] `json:"name"` + // The phase of the ruleset. + Phase param.Field[RulesetUpdateParamsPhase] `json:"phase"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) MarshalJSON() (data []byte, err error) { +func (r RulesetUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The range of status codes used to apply the selected mode. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From param.Field[int64] `json:"from,required"` - // response status code upper bound - To param.Field[int64] `json:"to,required"` +type RulesetUpdateParamsRule struct { + // The action to perform when the rule matches. + Action param.Field[RulesetUpdateParamsRulesAction] `json:"action"` + ActionParameters param.Field[interface{}] `json:"action_parameters,required"` + Categories param.Field[interface{}] `json:"categories,required"` + // An informative description of the rule. + Description param.Field[string] `json:"description"` + // Whether the rule should be executed. + Enabled param.Field[bool] `json:"enabled"` + // The expression defining which traffic will match the rule. + Expression param.Field[string] `json:"expression"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // An object configuring the rule's logging behavior. + Logging param.Field[LoggingParam] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` } -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) MarshalJSON() (data []byte, err error) { +func (r RulesetUpdateParamsRule) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating param.Field[bool] `json:"disable_stale_while_updating,required"` -} +func (r RulesetUpdateParamsRule) implementsRulesetsRulesetUpdateParamsRuleUnion() {} -func (r RulesetUpdateParamsRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Satisfied by [rulesets.BlockRuleParam], [rulesets.ChallengeRuleParam], +// [rulesets.CompressResponseRuleParam], [rulesets.ExecuteRuleParam], +// [rulesets.JsChallengeRuleParam], [rulesets.LogRuleParam], +// [rulesets.ManagedChallengeRuleParam], [rulesets.RedirectRuleParam], +// [rulesets.RewriteRuleParam], [rulesets.RouteRuleParam], +// [rulesets.ScoreRuleParam], [rulesets.ServeErrorRuleParam], +// [rulesets.SetConfigRuleParam], [rulesets.SkipRuleParam], +// [rulesets.SetCacheSettingsRuleParam], [RulesetUpdateParamsRule]. +type RulesetUpdateParamsRuleUnion interface { + implementsRulesetsRulesetUpdateParamsRuleUnion() } // The action to perform when the rule matches. diff --git a/rulesets/version.go b/rulesets/version.go index 4a423804a5a..ebf4a913dce 100644 --- a/rulesets/version.go +++ b/rulesets/version.go @@ -266,19 +266,12 @@ func (r VersionGetResponseRule) AsUnion() VersionGetResponseRulesUnion { return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.VersionGetResponseRulesRulesetsChallengeRule], -// [rulesets.VersionGetResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.VersionGetResponseRulesRulesetsJsChallengeRule], [rulesets.LogRule], -// [rulesets.VersionGetResponseRulesRulesetsManagedChallengeRule], -// [rulesets.VersionGetResponseRulesRulesetsRedirectRule], -// [rulesets.VersionGetResponseRulesRulesetsRewriteRule], -// [rulesets.VersionGetResponseRulesRulesetsRouteRule], -// [rulesets.VersionGetResponseRulesRulesetsScoreRule], -// [rulesets.VersionGetResponseRulesRulesetsServeErrorRule], -// [rulesets.VersionGetResponseRulesRulesetsSetConfigRule], [rulesets.SkipRule] or -// [rulesets.VersionGetResponseRulesRulesetsSetCacheSettingsRule]. +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. type VersionGetResponseRulesUnion interface { implementsRulesetsVersionGetResponseRule() } @@ -294,12 +287,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsChallengeRule{}), + Type: reflect.TypeOf(ChallengeRule{}), DiscriminatorValue: "challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsCompressResponseRule{}), + Type: reflect.TypeOf(CompressResponseRule{}), DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ @@ -309,7 +302,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsJsChallengeRule{}), + Type: reflect.TypeOf(JsChallengeRule{}), DiscriminatorValue: "js_challenge", }, apijson.UnionVariant{ @@ -319,37 +312,37 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsManagedChallengeRule{}), + Type: reflect.TypeOf(ManagedChallengeRule{}), DiscriminatorValue: "managed_challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRedirectRule{}), + Type: reflect.TypeOf(RedirectRule{}), DiscriminatorValue: "redirect", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRule{}), + Type: reflect.TypeOf(RewriteRule{}), DiscriminatorValue: "rewrite", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRouteRule{}), + Type: reflect.TypeOf(RouteRule{}), DiscriminatorValue: "route", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsScoreRule{}), + Type: reflect.TypeOf(ScoreRule{}), DiscriminatorValue: "score", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsServeErrorRule{}), + Type: reflect.TypeOf(ServeErrorRule{}), DiscriminatorValue: "serve_error", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsSetConfigRule{}), + Type: reflect.TypeOf(SetConfigRule{}), DiscriminatorValue: "set_config", }, apijson.UnionVariant{ @@ -359,2410 +352,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsSetCacheSettingsRule{}), + Type: reflect.TypeOf(SetCacheSettingsRule{}), DiscriminatorValue: "set_cache_settings", }, ) } -type VersionGetResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata for -// the struct [VersionGetResponseRulesRulesetsChallengeRule] -type versionGetResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsChallengeRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsChallengeRuleAction string - -const ( - VersionGetResponseRulesRulesetsChallengeRuleActionChallenge VersionGetResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r VersionGetResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct [VersionGetResponseRulesRulesetsCompressResponseRule] -type versionGetResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsCompressResponseRule) implementsRulesetsVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsCompressResponseRuleAction string - -const ( - VersionGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse VersionGetResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r VersionGetResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON versionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsCompressResponseRuleActionParameters] -type versionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON versionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type versionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, VersionGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsJsChallengeRuleJSON contains the JSON metadata -// for the struct [VersionGetResponseRulesRulesetsJsChallengeRule] -type versionGetResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsJsChallengeRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsJsChallengeRuleAction string - -const ( - VersionGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge VersionGetResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r VersionGetResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct [VersionGetResponseRulesRulesetsManagedChallengeRule] -type versionGetResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsManagedChallengeRule) implementsRulesetsVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - VersionGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge VersionGetResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r VersionGetResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata for -// the struct [VersionGetResponseRulesRulesetsRedirectRule] -type versionGetResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRedirectRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsRedirectRuleAction string - -const ( - VersionGetResponseRulesRulesetsRedirectRuleActionRedirect VersionGetResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r VersionGetResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParameters] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsVersionGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type VersionGetResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata for -// the struct [VersionGetResponseRulesRulesetsRewriteRule] -type versionGetResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsRewriteRuleAction string - -const ( - VersionGetResponseRulesRulesetsRewriteRuleActionRewrite VersionGetResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r VersionGetResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI VersionGetResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParameters] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, VersionGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURI] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsVersionGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type VersionGetResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for the -// struct [VersionGetResponseRulesRulesetsRouteRule] -type versionGetResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsRouteRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsRouteRuleAction string - -const ( - VersionGetResponseRulesRulesetsRouteRuleActionRoute VersionGetResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r VersionGetResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin VersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni VersionGetResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON versionGetResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRouteRuleActionParametersJSON contains the JSON -// metadata for the struct -// [VersionGetResponseRulesRulesetsRouteRuleActionParameters] -type versionGetResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type VersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON versionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin] -type versionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type VersionGetResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON versionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsRouteRuleActionParametersSni] -type versionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type VersionGetResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for the -// struct [VersionGetResponseRulesRulesetsScoreRule] -type versionGetResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsScoreRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsScoreRuleAction string - -const ( - VersionGetResponseRulesRulesetsScoreRuleActionScore VersionGetResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r VersionGetResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON versionGetResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsScoreRuleActionParametersJSON contains the JSON -// metadata for the struct -// [VersionGetResponseRulesRulesetsScoreRuleActionParameters] -type versionGetResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type VersionGetResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsServeErrorRuleJSON contains the JSON metadata for -// the struct [VersionGetResponseRulesRulesetsServeErrorRule] -type versionGetResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsServeErrorRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsServeErrorRuleAction string - -const ( - VersionGetResponseRulesRulesetsServeErrorRuleActionServeError VersionGetResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r VersionGetResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON versionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsServeErrorRuleActionParameters] -type versionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, VersionGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata for -// the struct [VersionGetResponseRulesRulesetsSetConfigRule] -type versionGetResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsSetConfigRule) implementsRulesetsVersionGetResponseRule() {} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsSetConfigRuleAction string - -const ( - VersionGetResponseRulesRulesetsSetConfigRuleActionSetConfig VersionGetResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r VersionGetResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify VersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON versionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetConfigRuleActionParameters] -type versionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type VersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON versionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type versionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, VersionGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type VersionGetResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionGetResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct [VersionGetResponseRulesRulesetsSetCacheSettingsRule] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionGetResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsVersionGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings VersionGetResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r VersionGetResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON contains -// the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - // The action to perform when the rule matches. type VersionGetResponseRulesAction string diff --git a/rulesets/versionbytag.go b/rulesets/versionbytag.go index b3694361296..360a4800a83 100644 --- a/rulesets/versionbytag.go +++ b/rulesets/versionbytag.go @@ -205,21 +205,12 @@ func (r VersionByTagGetResponseRule) AsUnion() VersionByTagGetResponseRulesUnion return r.union } -// Union satisfied by [rulesets.BlockRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsChallengeRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsCompressResponseRule], -// [rulesets.ExecuteRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsJsChallengeRule], -// [rulesets.LogRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsManagedChallengeRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsRedirectRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsRouteRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsScoreRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsServeErrorRule], -// [rulesets.VersionByTagGetResponseRulesRulesetsSetConfigRule], -// [rulesets.SkipRule] or -// [rulesets.VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule]. +// Union satisfied by [rulesets.BlockRule], [rulesets.ChallengeRule], +// [rulesets.CompressResponseRule], [rulesets.ExecuteRule], +// [rulesets.JsChallengeRule], [rulesets.LogRule], [rulesets.ManagedChallengeRule], +// [rulesets.RedirectRule], [rulesets.RewriteRule], [rulesets.RouteRule], +// [rulesets.ScoreRule], [rulesets.ServeErrorRule], [rulesets.SetConfigRule], +// [rulesets.SkipRule] or [rulesets.SetCacheSettingsRule]. type VersionByTagGetResponseRulesUnion interface { implementsRulesetsVersionByTagGetResponseRule() } @@ -235,12 +226,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsChallengeRule{}), + Type: reflect.TypeOf(ChallengeRule{}), DiscriminatorValue: "challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsCompressResponseRule{}), + Type: reflect.TypeOf(CompressResponseRule{}), DiscriminatorValue: "compress_response", }, apijson.UnionVariant{ @@ -250,7 +241,7 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsJsChallengeRule{}), + Type: reflect.TypeOf(JsChallengeRule{}), DiscriminatorValue: "js_challenge", }, apijson.UnionVariant{ @@ -260,37 +251,37 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsManagedChallengeRule{}), + Type: reflect.TypeOf(ManagedChallengeRule{}), DiscriminatorValue: "managed_challenge", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRedirectRule{}), + Type: reflect.TypeOf(RedirectRule{}), DiscriminatorValue: "redirect", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRule{}), + Type: reflect.TypeOf(RewriteRule{}), DiscriminatorValue: "rewrite", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRouteRule{}), + Type: reflect.TypeOf(RouteRule{}), DiscriminatorValue: "route", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsScoreRule{}), + Type: reflect.TypeOf(ScoreRule{}), DiscriminatorValue: "score", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsServeErrorRule{}), + Type: reflect.TypeOf(ServeErrorRule{}), DiscriminatorValue: "serve_error", }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsSetConfigRule{}), + Type: reflect.TypeOf(SetConfigRule{}), DiscriminatorValue: "set_config", }, apijson.UnionVariant{ @@ -300,2421 +291,12 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule{}), + Type: reflect.TypeOf(SetCacheSettingsRule{}), DiscriminatorValue: "set_cache_settings", }, ) } -type VersionByTagGetResponseRulesRulesetsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsChallengeRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsChallengeRuleJSON contains the JSON metadata -// for the struct [VersionByTagGetResponseRulesRulesetsChallengeRule] -type versionByTagGetResponseRulesRulesetsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsChallengeRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsChallengeRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsChallengeRuleActionChallenge VersionByTagGetResponseRulesRulesetsChallengeRuleAction = "challenge" -) - -func (r VersionByTagGetResponseRulesRulesetsChallengeRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsChallengeRuleActionChallenge: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsCompressResponseRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsCompressResponseRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsCompressResponseRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsCompressResponseRuleJSON contains the JSON -// metadata for the struct -// [VersionByTagGetResponseRulesRulesetsCompressResponseRule] -type versionByTagGetResponseRulesRulesetsCompressResponseRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsCompressResponseRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsCompressResponseRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsCompressResponseRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsCompressResponseRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse VersionByTagGetResponseRulesRulesetsCompressResponseRuleAction = "compress_response" -) - -func (r VersionByTagGetResponseRulesRulesetsCompressResponseRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionCompressResponse: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParameters struct { - // Custom order for compression algorithms. - Algorithms []VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm `json:"algorithms"` - JSON versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParameters] -type versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON struct { - Algorithms apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Compression algorithm to enable. -type VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm struct { - // Name of compression algorithm to enable. - Name VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName `json:"name"` - JSON versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm] -type versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithm) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmJSON) RawJSON() string { - return r.raw -} - -// Name of compression algorithm to enable. -type VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName string - -const ( - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "none" - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "auto" - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "default" - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "gzip" - VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName = "brotli" -) - -func (r VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsName) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameNone, VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameAuto, VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameDefault, VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameGzip, VersionByTagGetResponseRulesRulesetsCompressResponseRuleActionParametersAlgorithmsNameBrotli: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsJsChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsJsChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsJsChallengeRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsJsChallengeRuleJSON contains the JSON -// metadata for the struct [VersionByTagGetResponseRulesRulesetsJsChallengeRule] -type versionByTagGetResponseRulesRulesetsJsChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsJsChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsJsChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsJsChallengeRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsJsChallengeRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge VersionByTagGetResponseRulesRulesetsJsChallengeRuleAction = "js_challenge" -) - -func (r VersionByTagGetResponseRulesRulesetsJsChallengeRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsJsChallengeRuleActionJsChallenge: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsManagedChallengeRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsManagedChallengeRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters interface{} `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsManagedChallengeRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsManagedChallengeRuleJSON contains the JSON -// metadata for the struct -// [VersionByTagGetResponseRulesRulesetsManagedChallengeRule] -type versionByTagGetResponseRulesRulesetsManagedChallengeRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsManagedChallengeRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsManagedChallengeRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsManagedChallengeRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsManagedChallengeRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge VersionByTagGetResponseRulesRulesetsManagedChallengeRuleAction = "managed_challenge" -) - -func (r VersionByTagGetResponseRulesRulesetsManagedChallengeRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsManagedChallengeRuleActionManagedChallenge: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsRedirectRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsRedirectRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsRedirectRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleJSON contains the JSON metadata -// for the struct [VersionByTagGetResponseRulesRulesetsRedirectRule] -type versionByTagGetResponseRulesRulesetsRedirectRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRedirectRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsRedirectRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsRedirectRuleActionRedirect VersionByTagGetResponseRulesRulesetsRedirectRuleAction = "redirect" -) - -func (r VersionByTagGetResponseRulesRulesetsRedirectRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRedirectRuleActionRedirect: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParameters struct { - // Serve a redirect based on a bulk list lookup. - FromList VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromList `json:"from_list"` - // Serve a redirect based on the request properties. - FromValue VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValue `json:"from_value"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParameters] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersJSON struct { - FromList apijson.Field - FromValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on a bulk list lookup. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromList struct { - // Expression that evaluates to the list lookup key. - Key string `json:"key"` - // The name of the list to match against. - Name string `json:"name"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromList] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON struct { - Key apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromList) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromListJSON) RawJSON() string { - return r.raw -} - -// Serve a redirect based on the request properties. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValue struct { - // Keep the query string of the original request. - PreserveQueryString bool `json:"preserve_query_string"` - // The status code to be used for the redirect. - StatusCode VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode `json:"status_code"` - // The URL to redirect the request to. - TargetURL VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL `json:"target_url"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValue] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON struct { - PreserveQueryString apijson.Field - StatusCode apijson.Field - TargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueJSON) RawJSON() string { - return r.raw -} - -// The status code to be used for the redirect. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode float64 - -const ( - VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301 VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 301 - VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302 VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 302 - VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303 VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 303 - VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307 VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 307 - VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308 VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode = 308 -) - -func (r VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode301, VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode302, VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode303, VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode307, VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueStatusCode308: - return true - } - return false -} - -// The URL to redirect the request to. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL struct { - // The URL to redirect the request to. - Value string `json:"value"` - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON `json:"-"` - union VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLJSON) RawJSON() string { - return r.raw -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL) AsUnion() VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion { - return r.union -} - -// The URL to redirect the request to. -// -// Union satisfied by -// [rulesets.VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -// or -// [rulesets.VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect]. -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion interface { - implementsRulesetsVersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect{}), - }, - ) -} - -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect struct { - // The URL to redirect the request to. - Value string `json:"value"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect) implementsRulesetsVersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect struct { - // An expression to evaluate to get the URL to redirect the request to. - Expression string `json:"expression"` - JSON versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect] -type versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirectJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect) implementsRulesetsVersionByTagGetResponseRulesRulesetsRedirectRuleActionParametersFromValueTargetURL() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsRewriteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsRewriteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleJSON contains the JSON metadata -// for the struct [VersionByTagGetResponseRulesRulesetsRewriteRule] -type versionByTagGetResponseRulesRulesetsRewriteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsRewriteRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsRewriteRuleActionRewrite VersionByTagGetResponseRulesRulesetsRewriteRuleAction = "rewrite" -) - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRewriteRuleActionRewrite: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParameters struct { - // Map of request headers to modify. - Headers map[string]VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader `json:"headers"` - // URI to rewrite the request to. - URI VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURI `json:"uri"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParameters] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersJSON struct { - Headers apijson.Field - URI apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Remove the header from the request. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader struct { - Operation VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value"` - // Expression for the header value. - Expression string `json:"expression"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON `json:"-"` - union VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeaderJSON) RawJSON() string { - return r.raw -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader) AsUnion() VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion { - return r.union -} - -// Remove the header from the request. -// -// Union satisfied by -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader], -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -// or -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader]. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion interface { - implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader{}), - }, - ) -} - -// Remove the header from the request. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader struct { - Operation VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation `json:"operation,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON struct { - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeader) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation string - -const ( - VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation = "remove" -) - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperation) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersRemoveHeaderOperationRemove: - return true - } - return false -} - -// Set a request header with a static value. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader struct { - Operation VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation `json:"operation,required"` - // Static value for the header. - Value string `json:"value,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON struct { - Operation apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeader) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation string - -const ( - VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation = "set" -) - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperation) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersStaticHeaderOperationSet: - return true - } - return false -} - -// Set a request header with a dynamic value. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader struct { - // Expression for the header value. - Expression string `json:"expression,required"` - Operation VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation `json:"operation,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON struct { - Expression apijson.Field - Operation apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeader) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeader() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation string - -const ( - VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation = "set" -) - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperation) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersDynamicHeaderOperationSet: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation string - -const ( - VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "remove" - VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation = "set" -) - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperation) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationRemove, VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersHeadersOperationSet: - return true - } - return false -} - -// URI to rewrite the request to. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURI struct { - // Path portion rewrite. - Path VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath `json:"path"` - // Query portion rewrite. - Query VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery `json:"query"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURI] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON struct { - Path apijson.Field - Query apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURI) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIJSON) RawJSON() string { - return r.raw -} - -// Path portion rewrite. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON `json:"-"` - union VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathJSON) RawJSON() string { - return r.raw -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath) AsUnion() VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion { - return r.union -} - -// Path portion rewrite. -// -// Union satisfied by -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -// or -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue]. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion interface { - implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue{}), - }, - ) -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathStaticValue) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPathDynamicValue) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIPath() { -} - -// Query portion rewrite. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery struct { - // Predefined replacement value. - Value string `json:"value"` - // Expression to evaluate for the replacement value. - Expression string `json:"expression"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON `json:"-"` - union VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON struct { - Value apijson.Field - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryJSON) RawJSON() string { - return r.raw -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery) AsUnion() VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion { - return r.union -} - -// Query portion rewrite. -// -// Union satisfied by -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -// or -// [rulesets.VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue]. -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion interface { - implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue{}), - }, - ) -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue struct { - // Predefined replacement value. - Value string `json:"value,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryStaticValue) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue struct { - // Expression to evaluate for the replacement value. - Expression string `json:"expression,required"` - JSON versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue] -type versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON struct { - Expression apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValueJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQueryDynamicValue) implementsRulesetsVersionByTagGetResponseRulesRulesetsRewriteRuleActionParametersURIQuery() { -} - -type VersionByTagGetResponseRulesRulesetsRouteRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsRouteRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsRouteRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsRouteRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRouteRuleJSON contains the JSON metadata for -// the struct [VersionByTagGetResponseRulesRulesetsRouteRule] -type versionByTagGetResponseRulesRulesetsRouteRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRouteRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRouteRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsRouteRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsRouteRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsRouteRuleActionRoute VersionByTagGetResponseRulesRulesetsRouteRuleAction = "route" -) - -func (r VersionByTagGetResponseRulesRulesetsRouteRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsRouteRuleActionRoute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsRouteRuleActionParameters struct { - // Rewrite the HTTP Host header. - HostHeader string `json:"host_header"` - // Override the IP/TCP destination. - Origin VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersOrigin `json:"origin"` - // Override the Server Name Indication (SNI). - Sni VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersSni `json:"sni"` - JSON versionByTagGetResponseRulesRulesetsRouteRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRouteRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRouteRuleActionParameters] -type versionByTagGetResponseRulesRulesetsRouteRuleActionParametersJSON struct { - HostHeader apijson.Field - Origin apijson.Field - Sni apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRouteRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRouteRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Override the IP/TCP destination. -type VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersOrigin struct { - // Override the resolved hostname. - Host string `json:"host"` - // Override the destination port. - Port float64 `json:"port"` - JSON versionByTagGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersOrigin] -type versionByTagGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON struct { - Host apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersOrigin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRouteRuleActionParametersOriginJSON) RawJSON() string { - return r.raw -} - -// Override the Server Name Indication (SNI). -type VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersSni struct { - // The SNI override. - Value string `json:"value,required"` - JSON versionByTagGetResponseRulesRulesetsRouteRuleActionParametersSniJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsRouteRuleActionParametersSniJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersSni] -type versionByTagGetResponseRulesRulesetsRouteRuleActionParametersSniJSON struct { - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsRouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsRouteRuleActionParametersSniJSON) RawJSON() string { - return r.raw -} - -type VersionByTagGetResponseRulesRulesetsScoreRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsScoreRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsScoreRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsScoreRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsScoreRuleJSON contains the JSON metadata for -// the struct [VersionByTagGetResponseRulesRulesetsScoreRule] -type versionByTagGetResponseRulesRulesetsScoreRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsScoreRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsScoreRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsScoreRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsScoreRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsScoreRuleActionScore VersionByTagGetResponseRulesRulesetsScoreRuleAction = "score" -) - -func (r VersionByTagGetResponseRulesRulesetsScoreRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsScoreRuleActionScore: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsScoreRuleActionParameters struct { - // Increment contains the delta to change the score and can be either positive or - // negative. - Increment int64 `json:"increment"` - JSON versionByTagGetResponseRulesRulesetsScoreRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsScoreRuleActionParametersJSON contains the -// JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsScoreRuleActionParameters] -type versionByTagGetResponseRulesRulesetsScoreRuleActionParametersJSON struct { - Increment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsScoreRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsScoreRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -type VersionByTagGetResponseRulesRulesetsServeErrorRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsServeErrorRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsServeErrorRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsServeErrorRuleJSON contains the JSON -// metadata for the struct [VersionByTagGetResponseRulesRulesetsServeErrorRule] -type versionByTagGetResponseRulesRulesetsServeErrorRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsServeErrorRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsServeErrorRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsServeErrorRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsServeErrorRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsServeErrorRuleActionServeError VersionByTagGetResponseRulesRulesetsServeErrorRuleAction = "serve_error" -) - -func (r VersionByTagGetResponseRulesRulesetsServeErrorRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsServeErrorRuleActionServeError: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParameters struct { - // Error response content. - Content string `json:"content"` - // Content-type header to set with the response. - ContentType VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType `json:"content_type"` - // The status code to use for the error. - StatusCode float64 `json:"status_code"` - JSON versionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParameters] -type versionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersJSON struct { - Content apijson.Field - ContentType apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Content-type header to set with the response. -type VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType string - -const ( - VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "application/json" - VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/xml" - VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/plain" - VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType = "text/html" -) - -func (r VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentType) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeApplicationJson, VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextXml, VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextPlain, VersionByTagGetResponseRulesRulesetsServeErrorRuleActionParametersContentTypeTextHTML: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsSetConfigRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsSetConfigRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsSetConfigRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetConfigRuleJSON contains the JSON metadata -// for the struct [VersionByTagGetResponseRulesRulesetsSetConfigRule] -type versionByTagGetResponseRulesRulesetsSetConfigRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetConfigRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetConfigRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsSetConfigRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionSetConfig VersionByTagGetResponseRulesRulesetsSetConfigRuleAction = "set_config" -) - -func (r VersionByTagGetResponseRulesRulesetsSetConfigRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetConfigRuleActionSetConfig: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParameters struct { - // Turn on or off Automatic HTTPS Rewrites. - AutomaticHTTPSRewrites bool `json:"automatic_https_rewrites"` - // Select which file extensions to minify automatically. - Autominify VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify `json:"autominify"` - // Turn on or off Browser Integrity Check. - Bic bool `json:"bic"` - // Turn off all active Cloudflare Apps. - DisableApps bool `json:"disable_apps"` - // Turn off Zaraz. - DisableZaraz bool `json:"disable_zaraz"` - // Turn on or off Email Obfuscation. - EmailObfuscation bool `json:"email_obfuscation"` - // Turn on or off the Hotlink Protection. - HotlinkProtection bool `json:"hotlink_protection"` - // Turn on or off Mirage. - Mirage bool `json:"mirage"` - // Turn on or off Opportunistic Encryption. - OpportunisticEncryption bool `json:"opportunistic_encryption"` - // Configure the Polish level. - Polish VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish `json:"polish"` - // Turn on or off Rocket Loader - RocketLoader bool `json:"rocket_loader"` - // Configure the Security Level. - SecurityLevel VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel `json:"security_level"` - // Turn on or off Server Side Excludes. - ServerSideExcludes bool `json:"server_side_excludes"` - // Configure the SSL level. - SSL VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL `json:"ssl"` - // Turn on or off Signed Exchanges (SXG). - Sxg bool `json:"sxg"` - JSON versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersJSON contains -// the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParameters] -type versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersJSON struct { - AutomaticHTTPSRewrites apijson.Field - Autominify apijson.Field - Bic apijson.Field - DisableApps apijson.Field - DisableZaraz apijson.Field - EmailObfuscation apijson.Field - HotlinkProtection apijson.Field - Mirage apijson.Field - OpportunisticEncryption apijson.Field - Polish apijson.Field - RocketLoader apijson.Field - SecurityLevel apijson.Field - ServerSideExcludes apijson.Field - SSL apijson.Field - Sxg apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Select which file extensions to minify automatically. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify struct { - // Minify CSS files. - Css bool `json:"css"` - // Minify HTML files. - HTML bool `json:"html"` - // Minify JS files. - Js bool `json:"js"` - JSON versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify] -type versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersAutominifyJSON) RawJSON() string { - return r.raw -} - -// Configure the Polish level. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish string - -const ( - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "off" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossless" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish = "lossy" -) - -func (r VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolish) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishOff, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossless, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersPolishLossy: - return true - } - return false -} - -// Configure the Security Level. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel string - -const ( - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "off" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "essentially_off" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "low" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "medium" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "high" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel = "under_attack" -) - -func (r VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevel) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelOff, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelEssentiallyOff, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelLow, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelMedium, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelHigh, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSecurityLevelUnderAttack: - return true - } - return false -} - -// Configure the SSL level. -type VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL string - -const ( - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "off" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "flexible" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "full" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "strict" - VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL = "origin_pull" -) - -func (r VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSL) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOff, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFlexible, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLFull, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLStrict, VersionByTagGetResponseRulesRulesetsSetConfigRuleActionParametersSSLOriginPull: - return true - } - return false -} - -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule struct { - // The timestamp of when the rule was last modified. - LastUpdated time.Time `json:"last_updated,required" format:"date-time"` - // The version of the rule. - Version string `json:"version,required"` - // The unique ID of the rule. - ID string `json:"id"` - // The action to perform when the rule matches. - Action VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleAction `json:"action"` - // The parameters configuring the rule's action. - ActionParameters VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters `json:"action_parameters"` - // The categories of the rule. - Categories []string `json:"categories"` - // An informative description of the rule. - Description string `json:"description"` - // Whether the rule should be executed. - Enabled bool `json:"enabled"` - // The expression defining which traffic will match the rule. - Expression string `json:"expression"` - // An object configuring the rule's logging behavior. - Logging Logging `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref string `json:"ref"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleJSON contains the JSON -// metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleJSON struct { - LastUpdated apijson.Field - Version apijson.Field - ID apijson.Field - Action apijson.Field - ActionParameters apijson.Field - Categories apijson.Field - Description apijson.Field - Enabled apijson.Field - Expression apijson.Field - Logging apijson.Field - Ref apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleJSON) RawJSON() string { - return r.raw -} - -func (r VersionByTagGetResponseRulesRulesetsSetCacheSettingsRule) implementsRulesetsVersionByTagGetResponseRule() { -} - -// The action to perform when the rule matches. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleAction string - -const ( - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleAction = "set_cache_settings" -) - -func (r VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleAction) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionSetCacheSettings: - return true - } - return false -} - -// The parameters configuring the rule's action. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters struct { - // List of additional ports that caching can be enabled on. - AdditionalCacheablePorts []int64 `json:"additional_cacheable_ports"` - // Specify how long client browsers should cache the response. Cloudflare cache - // purge will not purge content cached on client browsers, so high browser TTLs may - // lead to stale content. - BrowserTTL VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL `json:"browser_ttl"` - // Mark whether the request’s response from origin is eligible for caching. Caching - // itself will still depend on the cache-control header and your other caching - // configurations. - Cache bool `json:"cache"` - // Define which components of the request are included or excluded from the cache - // key Cloudflare uses to store the response in cache. - CacheKey VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey `json:"cache_key"` - // Mark whether the request's response from origin is eligible for Cache Reserve - // (requires a Cache Reserve add-on plan). - CacheReserve VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve `json:"cache_reserve"` - // TTL (Time to Live) specifies the maximum time to cache a resource in the - // Cloudflare edge network. - EdgeTTL VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL `json:"edge_ttl"` - // When enabled, Cloudflare will aim to strictly adhere to RFC 7234. - OriginCacheControl bool `json:"origin_cache_control"` - // Generate Cloudflare error pages from issues sent from the origin server. When - // on, error pages will trigger for issues from the origin - OriginErrorPagePassthru bool `json:"origin_error_page_passthru"` - // Define a timeout value between two successive read operations to your origin - // server. Historically, the timeout value between two read options from Cloudflare - // to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 - // errors because of timeouts from an origin server, try increasing this timeout - // value. - ReadTimeout int64 `json:"read_timeout"` - // Specify whether or not Cloudflare should respect strong ETag (entity tag) - // headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. - RespectStrongEtags bool `json:"respect_strong_etags"` - // Define if Cloudflare should serve stale content while getting the latest content - // from the origin. If on, Cloudflare will not serve stale content while getting - // the latest content from the origin. - ServeStale VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale `json:"serve_stale"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON struct { - AdditionalCacheablePorts apijson.Field - BrowserTTL apijson.Field - Cache apijson.Field - CacheKey apijson.Field - CacheReserve apijson.Field - EdgeTTL apijson.Field - OriginCacheControl apijson.Field - OriginErrorPagePassthru apijson.Field - ReadTimeout apijson.Field - RespectStrongEtags apijson.Field - ServeStale apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParameters) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersJSON) RawJSON() string { - return r.raw -} - -// Specify how long client browsers should cache the response. Cloudflare cache -// purge will not purge content cached on client browsers, so high browser TTLs may -// lead to stale content. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL struct { - // Determines which browser ttl mode to use. - Mode VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode `json:"mode,required"` - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON struct { - Mode apijson.Field - Default apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLJSON) RawJSON() string { - return r.raw -} - -// Determines which browser ttl mode to use. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode string - -const ( - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "respect_origin" - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "bypass_by_default" - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode = "override_origin" -) - -func (r VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLMode) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeRespectOrigin, VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeBypassByDefault, VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersBrowserTTLModeOverrideOrigin: - return true - } - return false -} - -// Define which components of the request are included or excluded from the cache -// key Cloudflare uses to store the response in cache. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey struct { - // Separate cached content based on the visitor’s device type - CacheByDeviceType bool `json:"cache_by_device_type"` - // Protect from web cache deception attacks while allowing static assets to be - // cached - CacheDeceptionArmor bool `json:"cache_deception_armor"` - // Customize which components of the request are included or excluded from the - // cache key. - CustomKey VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey `json:"custom_key"` - // Treat requests with the same query parameters the same, regardless of the order - // those query parameters are in. A value of true ignores the query strings' order. - IgnoreQueryStringsOrder bool `json:"ignore_query_strings_order"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON struct { - CacheByDeviceType apijson.Field - CacheDeceptionArmor apijson.Field - CustomKey apijson.Field - IgnoreQueryStringsOrder apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyJSON) RawJSON() string { - return r.raw -} - -// Customize which components of the request are included or excluded from the -// cache key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey struct { - // The cookies to include in building the cache key. - Cookie VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie `json:"cookie"` - // The header names and values to include in building the cache key. - Header VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader `json:"header"` - // Whether to use the original host or the resolved host in the cache key. - Host VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost `json:"host"` - // Use the presence or absence of parameters in the query string to build the cache - // key. - QueryString VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString `json:"query_string"` - // Characteristics of the request user agent used in building the cache key. - User VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser `json:"user"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON struct { - Cookie apijson.Field - Header apijson.Field - Host apijson.Field - QueryString apijson.Field - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyJSON) RawJSON() string { - return r.raw -} - -// The cookies to include in building the cache key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie struct { - // Checks for the presence of these cookie names. The presence of these cookies is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Include these cookies' names and their values. - Include []string `json:"include"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON struct { - CheckPresence apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieJSON) RawJSON() string { - return r.raw -} - -// The header names and values to include in building the cache key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader struct { - // Checks for the presence of these header names. The presence of these headers is - // used in building the cache key. - CheckPresence []string `json:"check_presence"` - // Whether or not to include the origin header. A value of true will exclude the - // origin header in the cache key. - ExcludeOrigin bool `json:"exclude_origin"` - // Include these headers' names and their values. - Include []string `json:"include"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON struct { - CheckPresence apijson.Field - ExcludeOrigin apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderJSON) RawJSON() string { - return r.raw -} - -// Whether to use the original host or the resolved host in the cache key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost struct { - // Use the resolved host in the cache key. A value of true will use the resolved - // host, while a value or false will use the original host. - Resolved bool `json:"resolved"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON struct { - Resolved apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostJSON) RawJSON() string { - return r.raw -} - -// Use the presence or absence of parameters in the query string to build the cache -// key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString struct { - // build the cache key using all query string parameters EXCECPT these excluded - // parameters - Exclude VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude `json:"exclude"` - // build the cache key using a list of query string parameters that ARE in the - // request. - Include VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude `json:"include"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON struct { - Exclude apijson.Field - Include apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringJSON) RawJSON() string { - return r.raw -} - -// build the cache key using all query string parameters EXCECPT these excluded -// parameters -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude struct { - // Exclude all query string parameters from use in building the cache key. - All bool `json:"all"` - // A list of query string parameters NOT used to build the cache key. All - // parameters present in the request but missing in this list will be used to build - // the cache key. - List []string `json:"list"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExcludeJSON) RawJSON() string { - return r.raw -} - -// build the cache key using a list of query string parameters that ARE in the -// request. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude struct { - // Use all query string parameters in the cache key. - All bool `json:"all"` - // A list of query string parameters used to build the cache key. - List []string `json:"list"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON struct { - All apijson.Field - List apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIncludeJSON) RawJSON() string { - return r.raw -} - -// Characteristics of the request user agent used in building the cache key. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser struct { - // Use the user agent's device type in the cache key. - DeviceType bool `json:"device_type"` - // Use the user agents's country in the cache key. - Geo bool `json:"geo"` - // Use the user agent's language in the cache key. - Lang bool `json:"lang"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON struct { - DeviceType apijson.Field - Geo apijson.Field - Lang apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUserJSON) RawJSON() string { - return r.raw -} - -// Mark whether the request's response from origin is eligible for Cache Reserve -// (requires a Cache Reserve add-on plan). -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve struct { - // Determines whether cache reserve is enabled. If this is true and a request meets - // eligibility criteria, Cloudflare will write the resource to cache reserve. - Eligible bool `json:"eligible,required"` - // The minimum file size eligible for store in cache reserve. - MinFileSize int64 `json:"min_file_size,required"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON struct { - Eligible apijson.Field - MinFileSize apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserve) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersCacheReserveJSON) RawJSON() string { - return r.raw -} - -// TTL (Time to Live) specifies the maximum time to cache a resource in the -// Cloudflare edge network. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL struct { - // The TTL (in seconds) if you choose override_origin mode. - Default int64 `json:"default,required"` - // edge ttl options - Mode VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode `json:"mode,required"` - // List of single status codes, or status code ranges to apply the selected mode - StatusCodeTTL []VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL `json:"status_code_ttl,required"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON struct { - Default apijson.Field - Mode apijson.Field - StatusCodeTTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLJSON) RawJSON() string { - return r.raw -} - -// edge ttl options -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode string - -const ( - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "respect_origin" - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "bypass_by_default" - VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode = "override_origin" -) - -func (r VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLMode) IsKnown() bool { - switch r { - case VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeRespectOrigin, VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeBypassByDefault, VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLModeOverrideOrigin: - return true - } - return false -} - -// Specify how long Cloudflare should cache the response based on the status code -// from the origin. Can be a single status code or a range or status codes -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL struct { - // Time to cache a response (in seconds). A value of 0 is equivalent to setting the - // Cache-Control header with the value "no-cache". A value of -1 is equivalent to - // setting Cache-Control header with the value of "no-store". - Value int64 `json:"value,required"` - // The range of status codes used to apply the selected mode. - StatusCodeRange VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange `json:"status_code_range"` - // Set the ttl for responses with this specific status code - StatusCodeValue int64 `json:"status_code_value"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON struct { - Value apijson.Field - StatusCodeRange apijson.Field - StatusCodeValue apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLJSON) RawJSON() string { - return r.raw -} - -// The range of status codes used to apply the selected mode. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange struct { - // response status code lower bound - From int64 `json:"from,required"` - // response status code upper bound - To int64 `json:"to,required"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON struct { - From apijson.Field - To apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeJSON) RawJSON() string { - return r.raw -} - -// Define if Cloudflare should serve stale content while getting the latest content -// from the origin. If on, Cloudflare will not serve stale content while getting -// the latest content from the origin. -type VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale struct { - // Defines whether Cloudflare should serve stale content while updating. If true, - // Cloudflare will not serve stale content while getting the latest content from - // the origin. - DisableStaleWhileUpdating bool `json:"disable_stale_while_updating,required"` - JSON versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON `json:"-"` -} - -// versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON -// contains the JSON metadata for the struct -// [VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale] -type versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON struct { - DisableStaleWhileUpdating apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *VersionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStale) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r versionByTagGetResponseRulesRulesetsSetCacheSettingsRuleActionParametersServeStaleJSON) RawJSON() string { - return r.raw -} - // The action to perform when the rule matches. type VersionByTagGetResponseRulesAction string diff --git a/warp_connector/warpconnector.go b/warp_connector/warpconnector.go index a3de6e84c2b..a2c94489b4b 100644 --- a/warp_connector/warpconnector.go +++ b/warp_connector/warpconnector.go @@ -132,8 +132,7 @@ func (r *WARPConnectorService) Token(ctx context.Context, tunnelID string, query type WARPConnectorNewResponse struct { // Cloudflare account ID AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -229,7 +228,7 @@ ID string `json:"id"` // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections []WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -283,6 +282,53 @@ func (r warpConnectorNewResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string func (r WARPConnectorNewResponseTunnelWARPConnectorTunnel) implementsWARPConnectorWARPConnectorNewResponse() {} +type WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection struct { +// UUID of the Cloudflare Tunnel connection. +ID string `json:"id"` +// UUID of the cloudflared instance. +ClientID interface{} `json:"client_id"` +// The cloudflared version used to establish this connection. +ClientVersion string `json:"client_version"` +// The Cloudflare data center used for this connection. +ColoName string `json:"colo_name"` +// Cloudflare continues to track connections for several minutes after they +// disconnect. This is an optimization to improve latency and reliability of +// reconnecting. If `true`, the connection has disconnected but is still being +// tracked. If `false`, the connection is actively serving traffic. +IsPendingReconnect bool `json:"is_pending_reconnect"` +// Timestamp of when the connection was established. +OpenedAt time.Time `json:"opened_at" format:"date-time"` +// The public IP address of the host running cloudflared. +OriginIP string `json:"origin_ip"` +// UUID of the Cloudflare Tunnel connection. +UUID string `json:"uuid"` +JSON warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON contains the +// JSON metadata for the struct +// [WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection] +type warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON struct { +ID apijson.Field +ClientID apijson.Field +ClientVersion apijson.Field +ColoName apijson.Field +IsPendingReconnect apijson.Field +OpenedAt apijson.Field +OriginIP apijson.Field +UUID apijson.Field +raw string +ExtraFields map[string]apijson.Field +} + +func (r *WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { + return r.raw +} + // The type of tunnel. type WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType string @@ -325,8 +371,7 @@ func (r zero_trust.WARPConnectorNewResponseTunType) IsKnown() (bool) { type WARPConnectorListResponse struct { // Cloudflare account ID AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -422,7 +467,7 @@ ID string `json:"id"` // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections []WARPConnectorListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -476,6 +521,53 @@ func (r warpConnectorListResponseTunnelWARPConnectorTunnelJSON) RawJSON() (strin func (r WARPConnectorListResponseTunnelWARPConnectorTunnel) implementsWARPConnectorWARPConnectorListResponse() {} +type WARPConnectorListResponseTunnelWARPConnectorTunnelConnection struct { +// UUID of the Cloudflare Tunnel connection. +ID string `json:"id"` +// UUID of the cloudflared instance. +ClientID interface{} `json:"client_id"` +// The cloudflared version used to establish this connection. +ClientVersion string `json:"client_version"` +// The Cloudflare data center used for this connection. +ColoName string `json:"colo_name"` +// Cloudflare continues to track connections for several minutes after they +// disconnect. This is an optimization to improve latency and reliability of +// reconnecting. If `true`, the connection has disconnected but is still being +// tracked. If `false`, the connection is actively serving traffic. +IsPendingReconnect bool `json:"is_pending_reconnect"` +// Timestamp of when the connection was established. +OpenedAt time.Time `json:"opened_at" format:"date-time"` +// The public IP address of the host running cloudflared. +OriginIP string `json:"origin_ip"` +// UUID of the Cloudflare Tunnel connection. +UUID string `json:"uuid"` +JSON warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON contains the +// JSON metadata for the struct +// [WARPConnectorListResponseTunnelWARPConnectorTunnelConnection] +type warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON struct { +ID apijson.Field +ClientID apijson.Field +ClientVersion apijson.Field +ColoName apijson.Field +IsPendingReconnect apijson.Field +OpenedAt apijson.Field +OriginIP apijson.Field +UUID apijson.Field +raw string +ExtraFields map[string]apijson.Field +} + +func (r *WARPConnectorListResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { + return r.raw +} + // The type of tunnel. type WARPConnectorListResponseTunnelWARPConnectorTunnelTunType string @@ -518,8 +610,7 @@ func (r zero_trust.WARPConnectorListResponseTunType) IsKnown() (bool) { type WARPConnectorDeleteResponse struct { // Cloudflare account ID AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -615,7 +706,7 @@ ID string `json:"id"` // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections []WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -669,6 +760,53 @@ func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON) RawJSON() (str func (r WARPConnectorDeleteResponseTunnelWARPConnectorTunnel) implementsWARPConnectorWARPConnectorDeleteResponse() {} +type WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection struct { +// UUID of the Cloudflare Tunnel connection. +ID string `json:"id"` +// UUID of the cloudflared instance. +ClientID interface{} `json:"client_id"` +// The cloudflared version used to establish this connection. +ClientVersion string `json:"client_version"` +// The Cloudflare data center used for this connection. +ColoName string `json:"colo_name"` +// Cloudflare continues to track connections for several minutes after they +// disconnect. This is an optimization to improve latency and reliability of +// reconnecting. If `true`, the connection has disconnected but is still being +// tracked. If `false`, the connection is actively serving traffic. +IsPendingReconnect bool `json:"is_pending_reconnect"` +// Timestamp of when the connection was established. +OpenedAt time.Time `json:"opened_at" format:"date-time"` +// The public IP address of the host running cloudflared. +OriginIP string `json:"origin_ip"` +// UUID of the Cloudflare Tunnel connection. +UUID string `json:"uuid"` +JSON warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON contains the +// JSON metadata for the struct +// [WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection] +type warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON struct { +ID apijson.Field +ClientID apijson.Field +ClientVersion apijson.Field +ColoName apijson.Field +IsPendingReconnect apijson.Field +OpenedAt apijson.Field +OriginIP apijson.Field +UUID apijson.Field +raw string +ExtraFields map[string]apijson.Field +} + +func (r *WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { + return r.raw +} + // The type of tunnel. type WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType string @@ -711,8 +849,7 @@ func (r zero_trust.WARPConnectorDeleteResponseTunType) IsKnown() (bool) { type WARPConnectorEditResponse struct { // Cloudflare account ID AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -808,7 +945,7 @@ ID string `json:"id"` // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections []WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -862,6 +999,53 @@ func (r warpConnectorEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() (strin func (r WARPConnectorEditResponseTunnelWARPConnectorTunnel) implementsWARPConnectorWARPConnectorEditResponse() {} +type WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection struct { +// UUID of the Cloudflare Tunnel connection. +ID string `json:"id"` +// UUID of the cloudflared instance. +ClientID interface{} `json:"client_id"` +// The cloudflared version used to establish this connection. +ClientVersion string `json:"client_version"` +// The Cloudflare data center used for this connection. +ColoName string `json:"colo_name"` +// Cloudflare continues to track connections for several minutes after they +// disconnect. This is an optimization to improve latency and reliability of +// reconnecting. If `true`, the connection has disconnected but is still being +// tracked. If `false`, the connection is actively serving traffic. +IsPendingReconnect bool `json:"is_pending_reconnect"` +// Timestamp of when the connection was established. +OpenedAt time.Time `json:"opened_at" format:"date-time"` +// The public IP address of the host running cloudflared. +OriginIP string `json:"origin_ip"` +// UUID of the Cloudflare Tunnel connection. +UUID string `json:"uuid"` +JSON warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON contains the +// JSON metadata for the struct +// [WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection] +type warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON struct { +ID apijson.Field +ClientID apijson.Field +ClientVersion apijson.Field +ColoName apijson.Field +IsPendingReconnect apijson.Field +OpenedAt apijson.Field +OriginIP apijson.Field +UUID apijson.Field +raw string +ExtraFields map[string]apijson.Field +} + +func (r *WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { + return r.raw +} + // The type of tunnel. type WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType string @@ -904,8 +1088,7 @@ func (r zero_trust.WARPConnectorEditResponseTunType) IsKnown() (bool) { type WARPConnectorGetResponse struct { // Cloudflare account ID AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -1001,7 +1184,7 @@ ID string `json:"id"` // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections zero_trust.Connection `json:"connections"` +Connections []WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -1055,6 +1238,53 @@ func (r warpConnectorGetResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string func (r WARPConnectorGetResponseTunnelWARPConnectorTunnel) implementsWARPConnectorWARPConnectorGetResponse() {} +type WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection struct { +// UUID of the Cloudflare Tunnel connection. +ID string `json:"id"` +// UUID of the cloudflared instance. +ClientID interface{} `json:"client_id"` +// The cloudflared version used to establish this connection. +ClientVersion string `json:"client_version"` +// The Cloudflare data center used for this connection. +ColoName string `json:"colo_name"` +// Cloudflare continues to track connections for several minutes after they +// disconnect. This is an optimization to improve latency and reliability of +// reconnecting. If `true`, the connection has disconnected but is still being +// tracked. If `false`, the connection is actively serving traffic. +IsPendingReconnect bool `json:"is_pending_reconnect"` +// Timestamp of when the connection was established. +OpenedAt time.Time `json:"opened_at" format:"date-time"` +// The public IP address of the host running cloudflared. +OriginIP string `json:"origin_ip"` +// UUID of the Cloudflare Tunnel connection. +UUID string `json:"uuid"` +JSON warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON contains the +// JSON metadata for the struct +// [WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection] +type warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON struct { +ID apijson.Field +ClientID apijson.Field +ClientVersion apijson.Field +ColoName apijson.Field +IsPendingReconnect apijson.Field +OpenedAt apijson.Field +OriginIP apijson.Field +UUID apijson.Field +raw string +ExtraFields map[string]apijson.Field +} + +func (r *WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { + return r.raw +} + // The type of tunnel. type WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType string diff --git a/workers_for_platforms/dispatchnamespacescript.go b/workers_for_platforms/dispatchnamespacescript.go index 79321b21f8b..d80c3ada18c 100644 --- a/workers_for_platforms/dispatchnamespacescript.go +++ b/workers_for_platforms/dispatchnamespacescript.go @@ -32,6 +32,8 @@ type DispatchNamespaceScriptService struct { Content *DispatchNamespaceScriptContentService Settings *DispatchNamespaceScriptSettingService Bindings *DispatchNamespaceScriptBindingService + Secrets *DispatchNamespaceScriptSecretService + Tags *DispatchNamespaceScriptTagService } // NewDispatchNamespaceScriptService generates a new service that applies the given @@ -43,6 +45,8 @@ func NewDispatchNamespaceScriptService(opts ...option.RequestOption) (r *Dispatc r.Content = NewDispatchNamespaceScriptContentService(opts...) r.Settings = NewDispatchNamespaceScriptSettingService(opts...) r.Bindings = NewDispatchNamespaceScriptBindingService(opts...) + r.Secrets = NewDispatchNamespaceScriptSecretService(opts...) + r.Tags = NewDispatchNamespaceScriptTagService(opts...) return } diff --git a/workers_for_platforms/dispatchnamespacescriptsecret.go b/workers_for_platforms/dispatchnamespacescriptsecret.go new file mode 100644 index 00000000000..d46fb698f18 --- /dev/null +++ b/workers_for_platforms/dispatchnamespacescriptsecret.go @@ -0,0 +1,228 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package workers_for_platforms + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/pagination" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +// DispatchNamespaceScriptSecretService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewDispatchNamespaceScriptSecretService] method instead. +type DispatchNamespaceScriptSecretService struct { + Options []option.RequestOption +} + +// NewDispatchNamespaceScriptSecretService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewDispatchNamespaceScriptSecretService(opts ...option.RequestOption) (r *DispatchNamespaceScriptSecretService) { + r = &DispatchNamespaceScriptSecretService{} + r.Options = opts + return +} + +// Put secrets to a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptSecretService) Update(ctx context.Context, dispatchNamespace string, scriptName string, params DispatchNamespaceScriptSecretUpdateParams, opts ...option.RequestOption) (res *DispatchNamespaceScriptSecretUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env DispatchNamespaceScriptSecretUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/secrets", params.AccountID, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Fetch secrets from a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptSecretService) List(ctx context.Context, dispatchNamespace string, scriptName string, query DispatchNamespaceScriptSecretListParams, opts ...option.RequestOption) (res *pagination.SinglePage[DispatchNamespaceScriptSecretListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/secrets", query.AccountID, dispatchNamespace, scriptName) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Fetch secrets from a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptSecretService) ListAutoPaging(ctx context.Context, dispatchNamespace string, scriptName string, query DispatchNamespaceScriptSecretListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[DispatchNamespaceScriptSecretListResponse] { + return pagination.NewSinglePageAutoPager(r.List(ctx, dispatchNamespace, scriptName, query, opts...)) +} + +type DispatchNamespaceScriptSecretUpdateResponse struct { + // The name of this secret, this is what will be to access it inside the Worker. + Name string `json:"name"` + // The type of secret to put. + Type DispatchNamespaceScriptSecretUpdateResponseType `json:"type"` + JSON dispatchNamespaceScriptSecretUpdateResponseJSON `json:"-"` +} + +// dispatchNamespaceScriptSecretUpdateResponseJSON contains the JSON metadata for +// the struct [DispatchNamespaceScriptSecretUpdateResponse] +type dispatchNamespaceScriptSecretUpdateResponseJSON struct { + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DispatchNamespaceScriptSecretUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r dispatchNamespaceScriptSecretUpdateResponseJSON) RawJSON() string { + return r.raw +} + +// The type of secret to put. +type DispatchNamespaceScriptSecretUpdateResponseType string + +const ( + DispatchNamespaceScriptSecretUpdateResponseTypeSecretText DispatchNamespaceScriptSecretUpdateResponseType = "secret_text" +) + +func (r DispatchNamespaceScriptSecretUpdateResponseType) IsKnown() bool { + switch r { + case DispatchNamespaceScriptSecretUpdateResponseTypeSecretText: + return true + } + return false +} + +type DispatchNamespaceScriptSecretListResponse struct { + // The name of this secret, this is what will be to access it inside the Worker. + Name string `json:"name"` + // The type of secret to put. + Type DispatchNamespaceScriptSecretListResponseType `json:"type"` + JSON dispatchNamespaceScriptSecretListResponseJSON `json:"-"` +} + +// dispatchNamespaceScriptSecretListResponseJSON contains the JSON metadata for the +// struct [DispatchNamespaceScriptSecretListResponse] +type dispatchNamespaceScriptSecretListResponseJSON struct { + Name apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DispatchNamespaceScriptSecretListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r dispatchNamespaceScriptSecretListResponseJSON) RawJSON() string { + return r.raw +} + +// The type of secret to put. +type DispatchNamespaceScriptSecretListResponseType string + +const ( + DispatchNamespaceScriptSecretListResponseTypeSecretText DispatchNamespaceScriptSecretListResponseType = "secret_text" +) + +func (r DispatchNamespaceScriptSecretListResponseType) IsKnown() bool { + switch r { + case DispatchNamespaceScriptSecretListResponseTypeSecretText: + return true + } + return false +} + +type DispatchNamespaceScriptSecretUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // The name of this secret, this is what will be to access it inside the Worker. + Name param.Field[string] `json:"name"` + // The value of the secret. + Text param.Field[string] `json:"text"` + // The type of secret to put. + Type param.Field[DispatchNamespaceScriptSecretUpdateParamsType] `json:"type"` +} + +func (r DispatchNamespaceScriptSecretUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of secret to put. +type DispatchNamespaceScriptSecretUpdateParamsType string + +const ( + DispatchNamespaceScriptSecretUpdateParamsTypeSecretText DispatchNamespaceScriptSecretUpdateParamsType = "secret_text" +) + +func (r DispatchNamespaceScriptSecretUpdateParamsType) IsKnown() bool { + switch r { + case DispatchNamespaceScriptSecretUpdateParamsTypeSecretText: + return true + } + return false +} + +type DispatchNamespaceScriptSecretUpdateResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DispatchNamespaceScriptSecretUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON dispatchNamespaceScriptSecretUpdateResponseEnvelopeJSON `json:"-"` +} + +// dispatchNamespaceScriptSecretUpdateResponseEnvelopeJSON contains the JSON +// metadata for the struct [DispatchNamespaceScriptSecretUpdateResponseEnvelope] +type dispatchNamespaceScriptSecretUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DispatchNamespaceScriptSecretUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r dispatchNamespaceScriptSecretUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccess bool + +const ( + DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccessTrue DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccess = true +) + +func (r DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case DispatchNamespaceScriptSecretUpdateResponseEnvelopeSuccessTrue: + return true + } + return false +} + +type DispatchNamespaceScriptSecretListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} diff --git a/workers_for_platforms/dispatchnamespacescriptsecret_test.go b/workers_for_platforms/dispatchnamespacescriptsecret_test.go new file mode 100644 index 00000000000..2ee9139e1c1 --- /dev/null +++ b/workers_for_platforms/dispatchnamespacescriptsecret_test.go @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package workers_for_platforms_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-go/v2" + "github.com/cloudflare/cloudflare-go/v2/internal/testutil" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/workers_for_platforms" +) + +func TestDispatchNamespaceScriptSecretUpdateWithOptionalParams(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Update( + context.TODO(), + "my-dispatch-namespace", + "this-is_my_script-01", + workers_for_platforms.DispatchNamespaceScriptSecretUpdateParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Name: cloudflare.F("MY_SECRET"), + Text: cloudflare.F("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"), + Type: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptSecretUpdateParamsTypeSecretText), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestDispatchNamespaceScriptSecretList(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.List( + context.TODO(), + "my-dispatch-namespace", + "this-is_my_script-01", + workers_for_platforms.DispatchNamespaceScriptSecretListParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/workers_for_platforms/dispatchnamespacescripttag.go b/workers_for_platforms/dispatchnamespacescripttag.go new file mode 100644 index 00000000000..b3c0772fec6 --- /dev/null +++ b/workers_for_platforms/dispatchnamespacescripttag.go @@ -0,0 +1,192 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package workers_for_platforms + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/pagination" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +// DispatchNamespaceScriptTagService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewDispatchNamespaceScriptTagService] method instead. +type DispatchNamespaceScriptTagService struct { + Options []option.RequestOption +} + +// NewDispatchNamespaceScriptTagService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewDispatchNamespaceScriptTagService(opts ...option.RequestOption) (r *DispatchNamespaceScriptTagService) { + r = &DispatchNamespaceScriptTagService{} + r.Options = opts + return +} + +// Put script tags for a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptTagService) Update(ctx context.Context, dispatchNamespace string, scriptName string, params DispatchNamespaceScriptTagUpdateParams, opts ...option.RequestOption) (res *[]string, err error) { + opts = append(r.Options[:], opts...) + var env DispatchNamespaceScriptTagUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/tags", params.AccountID, dispatchNamespace, scriptName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Fetch tags from a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptTagService) List(ctx context.Context, dispatchNamespace string, scriptName string, query DispatchNamespaceScriptTagListParams, opts ...option.RequestOption) (res *pagination.SinglePage[string], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/tags", query.AccountID, dispatchNamespace, scriptName) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Fetch tags from a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptTagService) ListAutoPaging(ctx context.Context, dispatchNamespace string, scriptName string, query DispatchNamespaceScriptTagListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[string] { + return pagination.NewSinglePageAutoPager(r.List(ctx, dispatchNamespace, scriptName, query, opts...)) +} + +// Delete script tag for a script uploaded to a Workers for Platforms namespace. +func (r *DispatchNamespaceScriptTagService) Delete(ctx context.Context, dispatchNamespace string, scriptName string, tag string, body DispatchNamespaceScriptTagDeleteParams, opts ...option.RequestOption) (res *DispatchNamespaceScriptTagDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env DispatchNamespaceScriptTagDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/tags/%s", body.AccountID, dispatchNamespace, scriptName, tag) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type DispatchNamespaceScriptTagDeleteResponse = interface{} + +type DispatchNamespaceScriptTagUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Tags to help you manage your Workers + Body []string `json:"body,required"` +} + +func (r DispatchNamespaceScriptTagUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type DispatchNamespaceScriptTagUpdateResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result []string `json:"result,required"` + // Whether the API call was successful + Success DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON dispatchNamespaceScriptTagUpdateResponseEnvelopeJSON `json:"-"` +} + +// dispatchNamespaceScriptTagUpdateResponseEnvelopeJSON contains the JSON metadata +// for the struct [DispatchNamespaceScriptTagUpdateResponseEnvelope] +type dispatchNamespaceScriptTagUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DispatchNamespaceScriptTagUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r dispatchNamespaceScriptTagUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccess bool + +const ( + DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccessTrue DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccess = true +) + +func (r DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case DispatchNamespaceScriptTagUpdateResponseEnvelopeSuccessTrue: + return true + } + return false +} + +type DispatchNamespaceScriptTagListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type DispatchNamespaceScriptTagDeleteParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type DispatchNamespaceScriptTagDeleteResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DispatchNamespaceScriptTagDeleteResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON dispatchNamespaceScriptTagDeleteResponseEnvelopeJSON `json:"-"` +} + +// dispatchNamespaceScriptTagDeleteResponseEnvelopeJSON contains the JSON metadata +// for the struct [DispatchNamespaceScriptTagDeleteResponseEnvelope] +type dispatchNamespaceScriptTagDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DispatchNamespaceScriptTagDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r dispatchNamespaceScriptTagDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccess bool + +const ( + DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccessTrue DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccess = true +) + +func (r DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case DispatchNamespaceScriptTagDeleteResponseEnvelopeSuccessTrue: + return true + } + return false +} diff --git a/workers_for_platforms/dispatchnamespacescripttag_test.go b/workers_for_platforms/dispatchnamespacescripttag_test.go new file mode 100644 index 00000000000..8e608129604 --- /dev/null +++ b/workers_for_platforms/dispatchnamespacescripttag_test.go @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package workers_for_platforms_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-go/v2" + "github.com/cloudflare/cloudflare-go/v2/internal/testutil" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/workers_for_platforms" +) + +func TestDispatchNamespaceScriptTagUpdate(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Update( + context.TODO(), + "my-dispatch-namespace", + "this-is_my_script-01", + workers_for_platforms.DispatchNamespaceScriptTagUpdateParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Body: []string{"my-tag", "my-tag", "my-tag"}, + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestDispatchNamespaceScriptTagList(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.List( + context.TODO(), + "my-dispatch-namespace", + "this-is_my_script-01", + workers_for_platforms.DispatchNamespaceScriptTagListParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestDispatchNamespaceScriptTagDelete(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Delete( + context.TODO(), + "my-dispatch-namespace", + "this-is_my_script-01", + "my-tag", + workers_for_platforms.DispatchNamespaceScriptTagDeleteParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zero_trust/tunnel.go b/zero_trust/tunnel.go index d9c6c69fb7a..4f87fe38a0d 100644 --- a/zero_trust/tunnel.go +++ b/zero_trust/tunnel.go @@ -122,7 +122,35 @@ func (r *TunnelService) Get(ctx context.Context, tunnelID string, query TunnelGe return } -type Connection []ConnectionItem +type Connection struct { + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON connectionJSON `json:"-"` +} + +// connectionJSON contains the JSON metadata for the struct [Connection] +type connectionJSON struct { + ColoName apijson.Field + IsPendingReconnect apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Connection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r connectionJSON) RawJSON() string { + return r.raw +} // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type Tunnel struct { @@ -131,7 +159,7 @@ type Tunnel struct { // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections Connection `json:"connections"` + Connections []TunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -200,6 +228,52 @@ func (r Tunnel) implementsZeroTrustTunnelListResponse() {} func (r Tunnel) implementsZeroTrustTunnelEditResponse() {} +type TunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON tunnelConnectionJSON `json:"-"` +} + +// tunnelConnectionJSON contains the JSON metadata for the struct +// [TunnelConnection] +type tunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r tunnelConnectionJSON) RawJSON() string { + return r.raw +} + // The type of tunnel. type TunnelTunType string @@ -224,7 +298,7 @@ type TunnelParam struct { // Cloudflare account ID AccountTag param.Field[string] `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections param.Field[ConnectionParam] `json:"connections"` + Connections param.Field[[]TunnelConnectionParam] `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt param.Field[time.Time] `json:"conns_active_at" format:"date-time"` @@ -256,11 +330,33 @@ func (r TunnelParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +type TunnelConnectionParam struct { + // UUID of the cloudflared instance. + ClientID param.Field[interface{}] `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion param.Field[string] `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName param.Field[string] `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect param.Field[bool] `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt param.Field[time.Time] `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP param.Field[string] `json:"origin_ip"` +} + +func (r TunnelConnectionParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type TunnelNewResponse struct { // UUID of the tunnel. ID string `json:"id,required"` // The tunnel connections between your origin and Cloudflare's edge. - Connections []TunnelNewResponseConnection `json:"connections,required"` + Connections []Connection `json:"connections,required"` // Timestamp of when the tunnel was created. CreatedAt time.Time `json:"created_at,required" format:"date-time"` // A user-friendly name for the tunnel. @@ -291,43 +387,11 @@ func (r tunnelNewResponseJSON) RawJSON() string { return r.raw } -type TunnelNewResponseConnection struct { - // The Cloudflare data center used for this connection. - ColoName string `json:"colo_name"` - // Cloudflare continues to track connections for several minutes after they - // disconnect. This is an optimization to improve latency and reliability of - // reconnecting. If `true`, the connection has disconnected but is still being - // tracked. If `false`, the connection is actively serving traffic. - IsPendingReconnect bool `json:"is_pending_reconnect"` - // UUID of the Cloudflare Tunnel connection. - UUID string `json:"uuid"` - JSON tunnelNewResponseConnectionJSON `json:"-"` -} - -// tunnelNewResponseConnectionJSON contains the JSON metadata for the struct -// [TunnelNewResponseConnection] -type tunnelNewResponseConnectionJSON struct { - ColoName apijson.Field - IsPendingReconnect apijson.Field - UUID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TunnelNewResponseConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r tunnelNewResponseConnectionJSON) RawJSON() string { - return r.raw -} - // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type TunnelListResponse struct { // Cloudflare account ID - AccountTag string `json:"account_tag"` - // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections Connection `json:"connections"` + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -423,7 +487,7 @@ type TunnelListResponseTunnelWARPConnectorTunnel struct { // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections Connection `json:"connections"` + Connections []TunnelListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -477,6 +541,52 @@ func (r tunnelListResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { func (r TunnelListResponseTunnelWARPConnectorTunnel) implementsZeroTrustTunnelListResponse() {} +type TunnelListResponseTunnelWARPConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON contains the JSON +// metadata for the struct [TunnelListResponseTunnelWARPConnectorTunnelConnection] +type tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TunnelListResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw +} + // The type of tunnel. type TunnelListResponseTunnelWARPConnectorTunnelTunType string @@ -519,7 +629,7 @@ type TunnelDeleteResponse struct { // UUID of the tunnel. ID string `json:"id,required"` // The tunnel connections between your origin and Cloudflare's edge. - Connections []TunnelDeleteResponseConnection `json:"connections,required"` + Connections []Connection `json:"connections,required"` // Timestamp of when the tunnel was created. CreatedAt time.Time `json:"created_at,required" format:"date-time"` // A user-friendly name for the tunnel. @@ -550,43 +660,11 @@ func (r tunnelDeleteResponseJSON) RawJSON() string { return r.raw } -type TunnelDeleteResponseConnection struct { - // The Cloudflare data center used for this connection. - ColoName string `json:"colo_name"` - // Cloudflare continues to track connections for several minutes after they - // disconnect. This is an optimization to improve latency and reliability of - // reconnecting. If `true`, the connection has disconnected but is still being - // tracked. If `false`, the connection is actively serving traffic. - IsPendingReconnect bool `json:"is_pending_reconnect"` - // UUID of the Cloudflare Tunnel connection. - UUID string `json:"uuid"` - JSON tunnelDeleteResponseConnectionJSON `json:"-"` -} - -// tunnelDeleteResponseConnectionJSON contains the JSON metadata for the struct -// [TunnelDeleteResponseConnection] -type tunnelDeleteResponseConnectionJSON struct { - ColoName apijson.Field - IsPendingReconnect apijson.Field - UUID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TunnelDeleteResponseConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r tunnelDeleteResponseConnectionJSON) RawJSON() string { - return r.raw -} - // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type TunnelEditResponse struct { // Cloudflare account ID - AccountTag string `json:"account_tag"` - // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections Connection `json:"connections"` + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -682,7 +760,7 @@ type TunnelEditResponseTunnelWARPConnectorTunnel struct { // Cloudflare account ID AccountTag string `json:"account_tag"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Connections Connection `json:"connections"` + Connections []TunnelEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` // Timestamp of when the tunnel established at least one connection to Cloudflare's // edge. If `null`, the tunnel is inactive. ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` @@ -736,6 +814,52 @@ func (r tunnelEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { func (r TunnelEditResponseTunnelWARPConnectorTunnel) implementsZeroTrustTunnelEditResponse() {} +type TunnelEditResponseTunnelWARPConnectorTunnelConnection struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` +} + +// tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON contains the JSON +// metadata for the struct [TunnelEditResponseTunnelWARPConnectorTunnelConnection] +type tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TunnelEditResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw +} + // The type of tunnel. type TunnelEditResponseTunnelWARPConnectorTunnelTunType string @@ -778,7 +902,7 @@ type TunnelGetResponse struct { // UUID of the tunnel. ID string `json:"id,required"` // The tunnel connections between your origin and Cloudflare's edge. - Connections []TunnelGetResponseConnection `json:"connections,required"` + Connections []Connection `json:"connections,required"` // Timestamp of when the tunnel was created. CreatedAt time.Time `json:"created_at,required" format:"date-time"` // A user-friendly name for the tunnel. @@ -809,37 +933,6 @@ func (r tunnelGetResponseJSON) RawJSON() string { return r.raw } -type TunnelGetResponseConnection struct { - // The Cloudflare data center used for this connection. - ColoName string `json:"colo_name"` - // Cloudflare continues to track connections for several minutes after they - // disconnect. This is an optimization to improve latency and reliability of - // reconnecting. If `true`, the connection has disconnected but is still being - // tracked. If `false`, the connection is actively serving traffic. - IsPendingReconnect bool `json:"is_pending_reconnect"` - // UUID of the Cloudflare Tunnel connection. - UUID string `json:"uuid"` - JSON tunnelGetResponseConnectionJSON `json:"-"` -} - -// tunnelGetResponseConnectionJSON contains the JSON metadata for the struct -// [TunnelGetResponseConnection] -type tunnelGetResponseConnectionJSON struct { - ColoName apijson.Field - IsPendingReconnect apijson.Field - UUID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TunnelGetResponseConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r tunnelGetResponseConnectionJSON) RawJSON() string { - return r.raw -} - type TunnelNewParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` diff --git a/zero_trust/tunnelconnection.go b/zero_trust/tunnelconnection.go index 3a7dd3ed667..fde63ebb808 100644 --- a/zero_trust/tunnelconnection.go +++ b/zero_trust/tunnelconnection.go @@ -73,7 +73,7 @@ type Client struct { // cloudflared with the Zero Trust dashboard. ConfigVersion int64 `json:"config_version"` // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - Conns Connection `json:"conns"` + Conns []ClientConn `json:"conns"` // Features enabled for the Cloudflare Tunnel. Features []string `json:"features"` // Timestamp of when the tunnel connection was started. @@ -104,6 +104,51 @@ func (r clientJSON) RawJSON() string { return r.raw } +type ClientConn struct { + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON clientConnJSON `json:"-"` +} + +// clientConnJSON contains the JSON metadata for the struct [ClientConn] +type clientConnJSON struct { + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ClientConn) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r clientConnJSON) RawJSON() string { + return r.raw +} + // Union satisfied by [zero_trust.TunnelConnectionDeleteResponseUnknown], // [zero_trust.TunnelConnectionDeleteResponseArray] or [shared.UnionString]. type TunnelConnectionDeleteResponseUnion interface {