From c4d9b66fdd16f72f20804861f79a0e9daf590535 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:38:59 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1595) --- api.md | 2 +- bot_management/botmanagement.go | 182 +- bot_management/botmanagement_test.go | 15 +- cache/cache.go | 113 +- cache/cache_test.go | 11 +- dns/record.go | 5959 +++++++++++++++-- dns/record_test.go | 174 +- images/v1.go | 48 +- images/v1_test.go | 9 +- internal/shared/union.go | 409 +- pcaps/pcap.go | 141 +- pcaps/pcap_test.go | 17 +- r2/sippy.go | 156 +- r2/sippy_test.go | 12 +- rulesets/rule.go | 1060 ++- rulesets/rule_test.go | 42 +- workers/ai.go | 351 +- workers/ai_test.go | 6 +- workers/script.go | 155 +- workers/script_test.go | 19 +- .../dispatchnamespacescript.go | 138 +- .../dispatchnamespacescript_test.go | 19 +- zero_trust/accessapplication.go | 1739 ++++- zero_trust/accessapplication_test.go | 84 +- zero_trust/identityprovider.go | 3312 ++++++++- zero_trust/identityprovider_test.go | 74 +- 26 files changed, 12089 insertions(+), 2158 deletions(-) diff --git a/api.md b/api.md index 2e5ba22d835..ce44d310804 100644 --- a/api.md +++ b/api.md @@ -4386,7 +4386,7 @@ Response Types: Methods: - client.ZeroTrust.Access.Applications.New(ctx context.Context, params zero_trust.AccessApplicationNewParams) (zero_trust.AccessApps, error) -- client.ZeroTrust.Access.Applications.Update(ctx context.Context, appID zero_trust.AccessApplicationUpdateParamsAppID, params zero_trust.AccessApplicationUpdateParams) (zero_trust.AccessApps, error) +- client.ZeroTrust.Access.Applications.Update(ctx context.Context, appID zero_trust.AccessApplicationUpdateParamsSelfHostedApplicationAppID, params zero_trust.AccessApplicationUpdateParams) (zero_trust.AccessApps, error) - client.ZeroTrust.Access.Applications.List(ctx context.Context, query zero_trust.AccessApplicationListParams) ([]zero_trust.AccessApps, error) - client.ZeroTrust.Access.Applications.Delete(ctx context.Context, appID zero_trust.AccessApplicationDeleteParamsAppID, body zero_trust.AccessApplicationDeleteParams) (zero_trust.AccessApplicationDeleteResponse, error) - client.ZeroTrust.Access.Applications.Get(ctx context.Context, appID zero_trust.AccessApplicationGetParamsAppID, query zero_trust.AccessApplicationGetParams) (zero_trust.AccessApps, error) diff --git a/bot_management/botmanagement.go b/bot_management/botmanagement.go index a8c1203682e..ccadef8667e 100644 --- a/bot_management/botmanagement.go +++ b/bot_management/botmanagement.go @@ -46,7 +46,7 @@ func NewBotManagementService(opts ...option.RequestOption) (r *BotManagementServ func (r *BotManagementService) Update(ctx context.Context, params BotManagementUpdateParams, opts ...option.RequestOption) (res *BotManagementUpdateResponse, err error) { opts = append(r.Options[:], opts...) var env BotManagementUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/bot_management", params.ZoneID) + path := fmt.Sprintf("zones/%s/bot_management", params.getZoneID()) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -631,89 +631,211 @@ func (r botManagementGetResponseBotManagementBmSubscriptionConfigJSON) RawJSON() func (r BotManagementGetResponseBotManagementBmSubscriptionConfig) implementsBotManagementBotManagementGetResponse() { } -type BotManagementUpdateParams struct { +// This interface is a union satisfied by one of the following: +// [BotManagementUpdateParamsBotManagementBotFightModeConfig], +// [BotManagementUpdateParamsBotManagementSbfmDefinitelyConfig], +// [BotManagementUpdateParamsBotManagementSbfmLikelyConfig], +// [BotManagementUpdateParamsBotManagementBmSubscriptionConfig]. +type BotManagementUpdateParams interface { + ImplementsBotManagementUpdateParams() + + getZoneID() param.Field[string] +} + +type BotManagementUpdateParamsBotManagementBotFightModeConfig struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // Automatically update to the newest bot detection models created by Cloudflare as - // they are released. - // [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) - AutoUpdateModel param.Field[bool] `json:"auto_update_model"` // Use lightweight, invisible JavaScript detections to improve Bot Management. // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). EnableJs param.Field[bool] `json:"enable_js"` // Whether to enable Bot Fight Mode. FightMode param.Field[bool] `json:"fight_mode"` +} + +func (r BotManagementUpdateParamsBotManagementBotFightModeConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r BotManagementUpdateParamsBotManagementBotFightModeConfig) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (BotManagementUpdateParamsBotManagementBotFightModeConfig) ImplementsBotManagementUpdateParams() { + +} + +type BotManagementUpdateParamsBotManagementSbfmDefinitelyConfig struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` // Whether to optimize Super Bot Fight Mode protections for Wordpress. OptimizeWordpress param.Field[bool] `json:"optimize_wordpress"` // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. - SbfmDefinitelyAutomated param.Field[BotManagementUpdateParamsSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + SbfmDefinitelyAutomated param.Field[BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + // static resources on your application need bot protection. Note: Static resource + // protection can also result in legitimate traffic being blocked. + SbfmStaticResourceProtection param.Field[bool] `json:"sbfm_static_resource_protection"` + // Super Bot Fight Mode (SBFM) action to take on verified bots requests. + SbfmVerifiedBots param.Field[BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBots] `json:"sbfm_verified_bots"` +} + +func (r BotManagementUpdateParamsBotManagementSbfmDefinitelyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r BotManagementUpdateParamsBotManagementSbfmDefinitelyConfig) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (BotManagementUpdateParamsBotManagementSbfmDefinitelyConfig) ImplementsBotManagementUpdateParams() { + +} + +// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. +type BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated string + +const ( + BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedAllow BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated = "allow" + BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedBlock BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated = "block" + BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated = "managed_challenge" +) + +func (r BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomated) IsKnown() bool { + switch r { + case BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmDefinitelyAutomatedManagedChallenge: + return true + } + return false +} + +// Super Bot Fight Mode (SBFM) action to take on verified bots requests. +type BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBots string + +const ( + BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBotsAllow BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBots = "allow" + BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBotsBlock BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBots = "block" +) + +func (r BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBots) IsKnown() bool { + switch r { + case BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBotsAllow, BotManagementUpdateParamsBotManagementSbfmDefinitelyConfigSbfmVerifiedBotsBlock: + return true + } + return false +} + +type BotManagementUpdateParamsBotManagementSbfmLikelyConfig struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to optimize Super Bot Fight Mode protections for Wordpress. + OptimizeWordpress param.Field[bool] `json:"optimize_wordpress"` + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + SbfmDefinitelyAutomated param.Field[BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` // Super Bot Fight Mode (SBFM) action to take on likely automated requests. - SbfmLikelyAutomated param.Field[BotManagementUpdateParamsSbfmLikelyAutomated] `json:"sbfm_likely_automated"` + SbfmLikelyAutomated param.Field[BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated] `json:"sbfm_likely_automated"` // Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if // static resources on your application need bot protection. Note: Static resource // protection can also result in legitimate traffic being blocked. SbfmStaticResourceProtection param.Field[bool] `json:"sbfm_static_resource_protection"` // Super Bot Fight Mode (SBFM) action to take on verified bots requests. - SbfmVerifiedBots param.Field[BotManagementUpdateParamsSbfmVerifiedBots] `json:"sbfm_verified_bots"` - // Whether to disable tracking the highest bot score for a session in the Bot - // Management cookie. - SuppressSessionScore param.Field[bool] `json:"suppress_session_score"` + SbfmVerifiedBots param.Field[BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBots] `json:"sbfm_verified_bots"` } -func (r BotManagementUpdateParams) MarshalJSON() (data []byte, err error) { +func (r BotManagementUpdateParamsBotManagementSbfmLikelyConfig) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +func (r BotManagementUpdateParamsBotManagementSbfmLikelyConfig) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (BotManagementUpdateParamsBotManagementSbfmLikelyConfig) ImplementsBotManagementUpdateParams() { + +} + // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. -type BotManagementUpdateParamsSbfmDefinitelyAutomated string +type BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated string const ( - BotManagementUpdateParamsSbfmDefinitelyAutomatedAllow BotManagementUpdateParamsSbfmDefinitelyAutomated = "allow" - BotManagementUpdateParamsSbfmDefinitelyAutomatedBlock BotManagementUpdateParamsSbfmDefinitelyAutomated = "block" - BotManagementUpdateParamsSbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsSbfmDefinitelyAutomated = "managed_challenge" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedAllow BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated = "allow" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedBlock BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated = "block" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated = "managed_challenge" ) -func (r BotManagementUpdateParamsSbfmDefinitelyAutomated) IsKnown() bool { +func (r BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomated) IsKnown() bool { switch r { - case BotManagementUpdateParamsSbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsSbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsSbfmDefinitelyAutomatedManagedChallenge: + case BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmDefinitelyAutomatedManagedChallenge: return true } return false } // Super Bot Fight Mode (SBFM) action to take on likely automated requests. -type BotManagementUpdateParamsSbfmLikelyAutomated string +type BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated string const ( - BotManagementUpdateParamsSbfmLikelyAutomatedAllow BotManagementUpdateParamsSbfmLikelyAutomated = "allow" - BotManagementUpdateParamsSbfmLikelyAutomatedBlock BotManagementUpdateParamsSbfmLikelyAutomated = "block" - BotManagementUpdateParamsSbfmLikelyAutomatedManagedChallenge BotManagementUpdateParamsSbfmLikelyAutomated = "managed_challenge" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedAllow BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated = "allow" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedBlock BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated = "block" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedManagedChallenge BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated = "managed_challenge" ) -func (r BotManagementUpdateParamsSbfmLikelyAutomated) IsKnown() bool { +func (r BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomated) IsKnown() bool { switch r { - case BotManagementUpdateParamsSbfmLikelyAutomatedAllow, BotManagementUpdateParamsSbfmLikelyAutomatedBlock, BotManagementUpdateParamsSbfmLikelyAutomatedManagedChallenge: + case BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedAllow, BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedBlock, BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmLikelyAutomatedManagedChallenge: return true } return false } // Super Bot Fight Mode (SBFM) action to take on verified bots requests. -type BotManagementUpdateParamsSbfmVerifiedBots string +type BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBots string const ( - BotManagementUpdateParamsSbfmVerifiedBotsAllow BotManagementUpdateParamsSbfmVerifiedBots = "allow" - BotManagementUpdateParamsSbfmVerifiedBotsBlock BotManagementUpdateParamsSbfmVerifiedBots = "block" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBotsAllow BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBots = "allow" + BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBotsBlock BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBots = "block" ) -func (r BotManagementUpdateParamsSbfmVerifiedBots) IsKnown() bool { +func (r BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBots) IsKnown() bool { switch r { - case BotManagementUpdateParamsSbfmVerifiedBotsAllow, BotManagementUpdateParamsSbfmVerifiedBotsBlock: + case BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBotsAllow, BotManagementUpdateParamsBotManagementSbfmLikelyConfigSbfmVerifiedBotsBlock: return true } return false } +type BotManagementUpdateParamsBotManagementBmSubscriptionConfig struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Automatically update to the newest bot detection models created by Cloudflare as + // they are released. + // [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + AutoUpdateModel param.Field[bool] `json:"auto_update_model"` + // Use lightweight, invisible JavaScript detections to improve Bot Management. + // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + EnableJs param.Field[bool] `json:"enable_js"` + // Whether to disable tracking the highest bot score for a session in the Bot + // Management cookie. + SuppressSessionScore param.Field[bool] `json:"suppress_session_score"` +} + +func (r BotManagementUpdateParamsBotManagementBmSubscriptionConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r BotManagementUpdateParamsBotManagementBmSubscriptionConfig) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (BotManagementUpdateParamsBotManagementBmSubscriptionConfig) ImplementsBotManagementUpdateParams() { + +} + type BotManagementUpdateResponseEnvelope struct { Errors []BotManagementUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []BotManagementUpdateResponseEnvelopeMessages `json:"messages,required"` diff --git a/bot_management/botmanagement_test.go b/bot_management/botmanagement_test.go index 9087b68942e..6037541dbc7 100644 --- a/bot_management/botmanagement_test.go +++ b/bot_management/botmanagement_test.go @@ -28,17 +28,10 @@ func TestBotManagementUpdateWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.BotManagement.Update(context.TODO(), bot_management.BotManagementUpdateParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - AutoUpdateModel: cloudflare.F(true), - EnableJs: cloudflare.F(true), - FightMode: cloudflare.F(true), - OptimizeWordpress: cloudflare.F(true), - SbfmDefinitelyAutomated: cloudflare.F(bot_management.BotManagementUpdateParamsSbfmDefinitelyAutomatedAllow), - SbfmLikelyAutomated: cloudflare.F(bot_management.BotManagementUpdateParamsSbfmLikelyAutomatedAllow), - SbfmStaticResourceProtection: cloudflare.F(true), - SbfmVerifiedBots: cloudflare.F(bot_management.BotManagementUpdateParamsSbfmVerifiedBotsAllow), - SuppressSessionScore: cloudflare.F(false), + _, err := client.BotManagement.Update(context.TODO(), bot_management.BotManagementUpdateParamsBotManagementBotFightModeConfig{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + EnableJs: cloudflare.F(true), + FightMode: cloudflare.F(true), }) if err != nil { var apierr *cloudflare.Error diff --git a/cache/cache.go b/cache/cache.go index b4a92648fc9..d68228c47f6 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -69,7 +69,7 @@ func NewCacheService(opts ...option.RequestOption) (r *CacheService) { func (r *CacheService) Purge(ctx context.Context, params CachePurgeParams, opts ...option.RequestOption) (res *CachePurgeResponse, err error) { opts = append(r.Options[:], opts...) var env CachePurgeResponseEnvelope - path := fmt.Sprintf("zones/%s/purge_cache", params.ZoneID) + path := fmt.Sprintf("zones/%s/purge_cache", params.getZoneID()) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -100,35 +100,118 @@ func (r cachePurgeResponseJSON) RawJSON() string { return r.raw } -type CachePurgeParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Files param.Field[[]CachePurgeParamsFile] `json:"files"` - Hosts param.Field[[]string] `json:"hosts"` - Prefixes param.Field[[]string] `json:"prefixes"` - PurgeEverything param.Field[bool] `json:"purge_everything"` - Tags param.Field[[]string] `json:"tags"` +// This interface is a union satisfied by one of the following: +// [CachePurgeParamsCachePurgeTags], [CachePurgeParamsCachePurgeHosts], +// [CachePurgeParamsCachePurgePrefixes], [CachePurgeParamsCachePurgeEverything], +// [CachePurgeParamsCachePurgeFiles]. +type CachePurgeParams interface { + ImplementsCachePurgeParams() + + getZoneID() param.Field[string] +} + +type CachePurgeParamsCachePurgeTags struct { + ZoneID param.Field[string] `path:"zone_id,required"` + Tags param.Field[[]string] `json:"tags"` +} + +func (r CachePurgeParamsCachePurgeTags) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CachePurgeParamsCachePurgeTags) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (CachePurgeParamsCachePurgeTags) ImplementsCachePurgeParams() { + +} + +type CachePurgeParamsCachePurgeHosts struct { + ZoneID param.Field[string] `path:"zone_id,required"` + Hosts param.Field[[]string] `json:"hosts"` } -func (r CachePurgeParams) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsCachePurgeHosts) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +func (r CachePurgeParamsCachePurgeHosts) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (CachePurgeParamsCachePurgeHosts) ImplementsCachePurgeParams() { + +} + +type CachePurgeParamsCachePurgePrefixes struct { + ZoneID param.Field[string] `path:"zone_id,required"` + Prefixes param.Field[[]string] `json:"prefixes"` +} + +func (r CachePurgeParamsCachePurgePrefixes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CachePurgeParamsCachePurgePrefixes) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (CachePurgeParamsCachePurgePrefixes) ImplementsCachePurgeParams() { + +} + +type CachePurgeParamsCachePurgeEverything struct { + ZoneID param.Field[string] `path:"zone_id,required"` + PurgeEverything param.Field[bool] `json:"purge_everything"` +} + +func (r CachePurgeParamsCachePurgeEverything) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CachePurgeParamsCachePurgeEverything) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (CachePurgeParamsCachePurgeEverything) ImplementsCachePurgeParams() { + +} + +type CachePurgeParamsCachePurgeFiles struct { + ZoneID param.Field[string] `path:"zone_id,required"` + Files param.Field[[]CachePurgeParamsCachePurgeFilesFile] `json:"files"` +} + +func (r CachePurgeParamsCachePurgeFiles) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CachePurgeParamsCachePurgeFiles) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (CachePurgeParamsCachePurgeFiles) ImplementsCachePurgeParams() { + +} + // Satisfied by [shared.UnionString], -// [cache.CachePurgeParamsFilesCachePurgeURLAndHeaders]. -type CachePurgeParamsFile interface { - ImplementsCacheCachePurgeParamsFile() +// [cache.CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders]. +type CachePurgeParamsCachePurgeFilesFile interface { + ImplementsCacheCachePurgeParamsCachePurgeFilesFile() } -type CachePurgeParamsFilesCachePurgeURLAndHeaders struct { +type CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders struct { Headers param.Field[interface{}] `json:"headers"` URL param.Field[string] `json:"url"` } -func (r CachePurgeParamsFilesCachePurgeURLAndHeaders) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsFilesCachePurgeURLAndHeaders) ImplementsCacheCachePurgeParamsFile() {} +func (r CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders) ImplementsCacheCachePurgeParamsCachePurgeFilesFile() { +} type CachePurgeResponseEnvelope struct { Errors []CachePurgeResponseEnvelopeErrors `json:"errors,required"` diff --git a/cache/cache_test.go b/cache/cache_test.go index 1f586280550..046335c679b 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -10,7 +10,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/cache" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" ) @@ -29,13 +28,9 @@ func TestCachePurgeWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Cache.Purge(context.TODO(), cache.CachePurgeParams{ - ZoneID: cloudflare.F("string"), - Files: cloudflare.F([]cache.CachePurgeParamsFile{shared.UnionString("http://www.example.com/css/styles.css"), shared.UnionString("http://www.example.com/css/styles.css"), shared.UnionString("http://www.example.com/css/styles.css")}), - Hosts: cloudflare.F([]string{"www.example.com", "images.example.com"}), - Prefixes: cloudflare.F([]string{"www.example.com/foo", "images.example.com/bar/baz"}), - PurgeEverything: cloudflare.F(true), - Tags: cloudflare.F([]string{"some-tag", "another-tag"}), + _, err := client.Cache.Purge(context.TODO(), cache.CachePurgeParamsCachePurgeTags{ + ZoneID: cloudflare.F("string"), + Tags: cloudflare.F([]string{"some-tag", "another-tag"}), }) if err != nil { var apierr *cloudflare.Error diff --git a/dns/record.go b/dns/record.go index 49338d9b1a8..aeb7715125a 100644 --- a/dns/record.go +++ b/dns/record.go @@ -47,7 +47,7 @@ func NewRecordService(opts ...option.RequestOption) (r *RecordService) { func (r *RecordService) New(ctx context.Context, params RecordNewParams, opts ...option.RequestOption) (res *DNSRecord, err error) { opts = append(r.Options[:], opts...) var env RecordNewResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records", params.ZoneID) + path := fmt.Sprintf("zones/%s/dns_records", params.getZoneID()) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -65,7 +65,7 @@ func (r *RecordService) New(ctx context.Context, params RecordNewParams, opts .. func (r *RecordService) Update(ctx context.Context, dnsRecordID string, params RecordUpdateParams, opts ...option.RequestOption) (res *DNSRecord, err error) { opts = append(r.Options[:], opts...) var env RecordUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records/%s", params.ZoneID, dnsRecordID) + path := fmt.Sprintf("zones/%s/dns_records/%s", params.getZoneID(), dnsRecordID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -119,7 +119,7 @@ func (r *RecordService) Delete(ctx context.Context, dnsRecordID string, body Rec func (r *RecordService) Edit(ctx context.Context, dnsRecordID string, params RecordEditParams, opts ...option.RequestOption) (res *DNSRecord, err error) { opts = append(r.Options[:], opts...) var env RecordEditResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records/%s", params.ZoneID, dnsRecordID) + path := fmt.Sprintf("zones/%s/dns_records/%s", params.getZoneID(), dnsRecordID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return @@ -3833,23 +3833,35 @@ func (r recordScanResponseJSON) RawJSON() string { return r.raw } -type RecordNewParams struct { +// This interface is a union satisfied by one of the following: +// [RecordNewParamsDNSRecordsARecord], [RecordNewParamsDNSRecordsAAAARecord], +// [RecordNewParamsDNSRecordsCAARecord], [RecordNewParamsDNSRecordsCERTRecord], +// [RecordNewParamsDNSRecordsCNAMERecord], [RecordNewParamsDNSRecordsDNSKEYRecord], +// [RecordNewParamsDNSRecordsDSRecord], [RecordNewParamsDNSRecordsHTTPSRecord], +// [RecordNewParamsDNSRecordsLOCRecord], [RecordNewParamsDNSRecordsMXRecord], +// [RecordNewParamsDNSRecordsNAPTRRecord], [RecordNewParamsDNSRecordsNSRecord], +// [RecordNewParamsDNSRecordsPTRRecord], [RecordNewParamsDNSRecordsSMIMEARecord], +// [RecordNewParamsDNSRecordsSRVRecord], [RecordNewParamsDNSRecordsSSHFPRecord], +// [RecordNewParamsDNSRecordsSVCBRecord], [RecordNewParamsDNSRecordsTLSARecord], +// [RecordNewParamsDNSRecordsTXTRecord], [RecordNewParamsDNSRecordsURIRecord]. +type RecordNewParams interface { + ImplementsRecordNewParams() + + getZoneID() param.Field[string] +} + +type RecordNewParamsDNSRecordsARecord struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` // DNS record name (or @ for the zone apex) in Punycode. Name param.Field[string] `json:"name,required"` // Record type. - Type param.Field[RecordNewParamsType] `json:"type,required"` + Type param.Field[RecordNewParamsDNSRecordsARecordType] `json:"type,required"` // Comments or notes about the DNS record. This field has no effect on DNS // responses. Comment param.Field[string] `json:"comment"` - // Formatted URI content. See 'data' to set URI properties. - Content param.Field[interface{}] `json:"content"` - Data param.Field[RecordNewParamsData] `json:"data"` - Meta param.Field[RecordNewParamsMeta] `json:"meta"` - // Required for MX, SRV and URI records; unused by other record types. Records with - // lower priorities are preferred. - Priority param.Field[float64] `json:"priority"` // Whether the record is receiving the performance and security benefits of // Cloudflare. Proxied param.Field[bool] `json:"proxied"` @@ -3858,383 +3870,4533 @@ type RecordNewParams struct { // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. - TTL param.Field[RecordNewParamsTTL] `json:"ttl"` + TTL param.Field[RecordNewParamsDNSRecordsARecordTTL] `json:"ttl"` } -func (r RecordNewParams) MarshalJSON() (data []byte, err error) { +func (r RecordNewParamsDNSRecordsARecord) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +func (r RecordNewParamsDNSRecordsARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsARecord) ImplementsRecordNewParams() { + +} + // Record type. -type RecordNewParamsType string +type RecordNewParamsDNSRecordsARecordType string const ( - RecordNewParamsTypeURI RecordNewParamsType = "URI" - RecordNewParamsTypeTXT RecordNewParamsType = "TXT" - RecordNewParamsTypeTLSA RecordNewParamsType = "TLSA" - RecordNewParamsTypeSVCB RecordNewParamsType = "SVCB" - RecordNewParamsTypeSSHFP RecordNewParamsType = "SSHFP" - RecordNewParamsTypeSRV RecordNewParamsType = "SRV" - RecordNewParamsTypeSMIMEA RecordNewParamsType = "SMIMEA" - RecordNewParamsTypePTR RecordNewParamsType = "PTR" - RecordNewParamsTypeNS RecordNewParamsType = "NS" - RecordNewParamsTypeNAPTR RecordNewParamsType = "NAPTR" - RecordNewParamsTypeMX RecordNewParamsType = "MX" - RecordNewParamsTypeLOC RecordNewParamsType = "LOC" - RecordNewParamsTypeHTTPS RecordNewParamsType = "HTTPS" - RecordNewParamsTypeDS RecordNewParamsType = "DS" - RecordNewParamsTypeDNSKEY RecordNewParamsType = "DNSKEY" - RecordNewParamsTypeCNAME RecordNewParamsType = "CNAME" - RecordNewParamsTypeCERT RecordNewParamsType = "CERT" - RecordNewParamsTypeCAA RecordNewParamsType = "CAA" - RecordNewParamsTypeAAAA RecordNewParamsType = "AAAA" - RecordNewParamsTypeA RecordNewParamsType = "A" + RecordNewParamsDNSRecordsARecordTypeA RecordNewParamsDNSRecordsARecordType = "A" ) -func (r RecordNewParamsType) IsKnown() bool { +func (r RecordNewParamsDNSRecordsARecordType) IsKnown() bool { switch r { - case RecordNewParamsTypeURI, RecordNewParamsTypeTXT, RecordNewParamsTypeTLSA, RecordNewParamsTypeSVCB, RecordNewParamsTypeSSHFP, RecordNewParamsTypeSRV, RecordNewParamsTypeSMIMEA, RecordNewParamsTypePTR, RecordNewParamsTypeNS, RecordNewParamsTypeNAPTR, RecordNewParamsTypeMX, RecordNewParamsTypeLOC, RecordNewParamsTypeHTTPS, RecordNewParamsTypeDS, RecordNewParamsTypeDNSKEY, RecordNewParamsTypeCNAME, RecordNewParamsTypeCERT, RecordNewParamsTypeCAA, RecordNewParamsTypeAAAA, RecordNewParamsTypeA: + case RecordNewParamsDNSRecordsARecordTypeA: return true } return false } -type RecordNewParamsData struct { - // algorithm. - Algorithm param.Field[float64] `json:"algorithm"` - // Altitude of location in meters. - Altitude param.Field[float64] `json:"altitude"` - // certificate. - Certificate param.Field[string] `json:"certificate"` - // The record content. - Content param.Field[string] `json:"content"` - // Digest. - Digest param.Field[string] `json:"digest"` - // Digest Type. - DigestType param.Field[float64] `json:"digest_type"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // Flags. - Flags param.Field[interface{}] `json:"flags"` - // Key Tag. - KeyTag param.Field[float64] `json:"key_tag"` - // Degrees of latitude. - LatDegrees param.Field[float64] `json:"lat_degrees"` - // Latitude direction. - LatDirection param.Field[RecordNewParamsDataLatDirection] `json:"lat_direction"` - // Minutes of latitude. - LatMinutes param.Field[float64] `json:"lat_minutes"` - // Seconds of latitude. - LatSeconds param.Field[float64] `json:"lat_seconds"` - // Degrees of longitude. - LongDegrees param.Field[float64] `json:"long_degrees"` - // Longitude direction. - LongDirection param.Field[RecordNewParamsDataLongDirection] `json:"long_direction"` - // Minutes of longitude. - LongMinutes param.Field[float64] `json:"long_minutes"` - // Seconds of longitude. - LongSeconds param.Field[float64] `json:"long_seconds"` - // Matching Type. - MatchingType param.Field[float64] `json:"matching_type"` - // A valid hostname. Deprecated in favor of the regular 'name' outside the data - // map. This data map field represents the remainder of the full 'name' after the - // service and protocol. - Name param.Field[string] `json:"name" format:"hostname"` - // Order. - Order param.Field[float64] `json:"order"` - // The port of the service. - Port param.Field[float64] `json:"port"` - // Horizontal precision of location. - PrecisionHorz param.Field[float64] `json:"precision_horz"` - // Vertical precision of location. - PrecisionVert param.Field[float64] `json:"precision_vert"` - // Preference. - Preference param.Field[float64] `json:"preference"` - // priority. - Priority param.Field[float64] `json:"priority"` - // A valid protocol, prefixed with an underscore. Deprecated in favor of the - // regular 'name' outside the data map. This data map field normally represents the - // second label of that 'name'. - Proto param.Field[string] `json:"proto"` - // Protocol. - Protocol param.Field[float64] `json:"protocol"` - // Public Key. - PublicKey param.Field[string] `json:"public_key"` - // Regex. - Regex param.Field[string] `json:"regex"` - // Replacement. - Replacement param.Field[string] `json:"replacement"` - // Selector. - Selector param.Field[float64] `json:"selector"` - // A service type, prefixed with an underscore. Deprecated in favor of the regular - // 'name' outside the data map. This data map field normally represents the first - // label of that 'name'. - Service param.Field[string] `json:"service"` - // Size of location in meters. - Size param.Field[float64] `json:"size"` - // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). - Tag param.Field[string] `json:"tag"` - // target. - Target param.Field[string] `json:"target"` - // type. - Type param.Field[float64] `json:"type"` - // Usage. - Usage param.Field[float64] `json:"usage"` - // value. - Value param.Field[string] `json:"value"` - // The record weight. - Weight param.Field[float64] `json:"weight"` -} - -func (r RecordNewParamsData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsARecordTTLNumber]. +type RecordNewParamsDNSRecordsARecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsARecordTTL() } -// Latitude direction. -type RecordNewParamsDataLatDirection string +type RecordNewParamsDNSRecordsARecordTTLNumber float64 const ( - RecordNewParamsDataLatDirectionN RecordNewParamsDataLatDirection = "N" - RecordNewParamsDataLatDirectionS RecordNewParamsDataLatDirection = "S" + RecordNewParamsDNSRecordsARecordTTLNumber1 RecordNewParamsDNSRecordsARecordTTLNumber = 1 ) -func (r RecordNewParamsDataLatDirection) IsKnown() bool { +func (r RecordNewParamsDNSRecordsARecordTTLNumber) IsKnown() bool { switch r { - case RecordNewParamsDataLatDirectionN, RecordNewParamsDataLatDirectionS: + case RecordNewParamsDNSRecordsARecordTTLNumber1: return true } return false } -// Longitude direction. -type RecordNewParamsDataLongDirection string +type RecordNewParamsDNSRecordsAAAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsAAAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsAAAARecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsAAAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsAAAARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsAAAARecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsAAAARecordType string const ( - RecordNewParamsDataLongDirectionE RecordNewParamsDataLongDirection = "E" - RecordNewParamsDataLongDirectionW RecordNewParamsDataLongDirection = "W" + RecordNewParamsDNSRecordsAAAARecordTypeAAAA RecordNewParamsDNSRecordsAAAARecordType = "AAAA" ) -func (r RecordNewParamsDataLongDirection) IsKnown() bool { +func (r RecordNewParamsDNSRecordsAAAARecordType) IsKnown() bool { switch r { - case RecordNewParamsDataLongDirectionE, RecordNewParamsDataLongDirectionW: + case RecordNewParamsDNSRecordsAAAARecordTypeAAAA: return true } return false } -type RecordNewParamsMeta struct { - // Will exist if Cloudflare automatically added this DNS record during initial - // setup. - AutoAdded param.Field[bool] `json:"auto_added"` - // Where the record originated from. - Source param.Field[string] `json:"source"` -} - -func (r RecordNewParamsMeta) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. // -// Satisfied by [shared.UnionFloat], [dns.RecordNewParamsTTLNumber]. -type RecordNewParamsTTL interface { - ImplementsDNSRecordNewParamsTTL() +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsAAAARecordTTLNumber]. +type RecordNewParamsDNSRecordsAAAARecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsAAAARecordTTL() } -type RecordNewParamsTTLNumber float64 +type RecordNewParamsDNSRecordsAAAARecordTTLNumber float64 const ( - RecordNewParamsTTLNumber1 RecordNewParamsTTLNumber = 1 + RecordNewParamsDNSRecordsAAAARecordTTLNumber1 RecordNewParamsDNSRecordsAAAARecordTTLNumber = 1 ) -func (r RecordNewParamsTTLNumber) IsKnown() bool { +func (r RecordNewParamsDNSRecordsAAAARecordTTLNumber) IsKnown() bool { switch r { - case RecordNewParamsTTLNumber1: + case RecordNewParamsDNSRecordsAAAARecordTTLNumber1: return true } return false } -type RecordNewResponseEnvelope struct { - Errors []RecordNewResponseEnvelopeErrors `json:"errors,required"` - Messages []RecordNewResponseEnvelopeMessages `json:"messages,required"` - Result DNSRecord `json:"result,required"` - // Whether the API call was successful - Success RecordNewResponseEnvelopeSuccess `json:"success,required"` - JSON recordNewResponseEnvelopeJSON `json:"-"` -} - -// recordNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [RecordNewResponseEnvelope] -type recordNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field +type RecordNewParamsDNSRecordsCAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CAA record. + Data param.Field[RecordNewParamsDNSRecordsCAARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsCAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsCAARecordTTL] `json:"ttl"` } -func (r *RecordNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RecordNewParamsDNSRecordsCAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r recordNewResponseEnvelopeJSON) RawJSON() string { - return r.raw +func (r RecordNewParamsDNSRecordsCAARecord) getZoneID() param.Field[string] { + return r.ZoneID } -type RecordNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON recordNewResponseEnvelopeErrorsJSON `json:"-"` -} +func (RecordNewParamsDNSRecordsCAARecord) ImplementsRecordNewParams() { -// recordNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [RecordNewResponseEnvelopeErrors] -type recordNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field } -func (r *RecordNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// Components of a CAA record. +type RecordNewParamsDNSRecordsCAARecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` } -func (r recordNewResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw +func (r RecordNewParamsDNSRecordsCAARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RecordNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON recordNewResponseEnvelopeMessagesJSON `json:"-"` -} +// Record type. +type RecordNewParamsDNSRecordsCAARecordType string -// recordNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct -// [RecordNewResponseEnvelopeMessages] -type recordNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +const ( + RecordNewParamsDNSRecordsCAARecordTypeCAA RecordNewParamsDNSRecordsCAARecordType = "CAA" +) -func (r *RecordNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RecordNewParamsDNSRecordsCAARecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsCAARecordTypeCAA: + return true + } + return false } -func (r recordNewResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsCAARecordTTLNumber]. +type RecordNewParamsDNSRecordsCAARecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsCAARecordTTL() } -// Whether the API call was successful -type RecordNewResponseEnvelopeSuccess bool +type RecordNewParamsDNSRecordsCAARecordTTLNumber float64 const ( - RecordNewResponseEnvelopeSuccessTrue RecordNewResponseEnvelopeSuccess = true + RecordNewParamsDNSRecordsCAARecordTTLNumber1 RecordNewParamsDNSRecordsCAARecordTTLNumber = 1 ) -func (r RecordNewResponseEnvelopeSuccess) IsKnown() bool { +func (r RecordNewParamsDNSRecordsCAARecordTTLNumber) IsKnown() bool { switch r { - case RecordNewResponseEnvelopeSuccessTrue: + case RecordNewParamsDNSRecordsCAARecordTTLNumber1: return true } return false } -type RecordUpdateParams struct { +type RecordNewParamsDNSRecordsCERTRecord struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CERT record. + Data param.Field[RecordNewParamsDNSRecordsCERTRecordData] `json:"data,required"` // DNS record name (or @ for the zone apex) in Punycode. Name param.Field[string] `json:"name,required"` // Record type. - Type param.Field[RecordUpdateParamsType] `json:"type,required"` + Type param.Field[RecordNewParamsDNSRecordsCERTRecordType] `json:"type,required"` // Comments or notes about the DNS record. This field has no effect on DNS // responses. Comment param.Field[string] `json:"comment"` - // Formatted URI content. See 'data' to set URI properties. - Content param.Field[interface{}] `json:"content"` - Data param.Field[RecordUpdateParamsData] `json:"data"` - Meta param.Field[RecordUpdateParamsMeta] `json:"meta"` - // Required for MX, SRV and URI records; unused by other record types. Records with - // lower priorities are preferred. - Priority param.Field[float64] `json:"priority"` - // Whether the record is receiving the performance and security benefits of - // Cloudflare. - Proxied param.Field[bool] `json:"proxied"` // Custom tags for the DNS record. This field has no effect on DNS responses. Tags param.Field[[]string] `json:"tags"` // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. - TTL param.Field[RecordUpdateParamsTTL] `json:"ttl"` + TTL param.Field[RecordNewParamsDNSRecordsCERTRecordTTL] `json:"ttl"` } -func (r RecordUpdateParams) MarshalJSON() (data []byte, err error) { +func (r RecordNewParamsDNSRecordsCERTRecord) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Record type. -type RecordUpdateParamsType string +func (r RecordNewParamsDNSRecordsCERTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} -const ( - RecordUpdateParamsTypeURI RecordUpdateParamsType = "URI" - RecordUpdateParamsTypeTXT RecordUpdateParamsType = "TXT" - RecordUpdateParamsTypeTLSA RecordUpdateParamsType = "TLSA" - RecordUpdateParamsTypeSVCB RecordUpdateParamsType = "SVCB" - RecordUpdateParamsTypeSSHFP RecordUpdateParamsType = "SSHFP" - RecordUpdateParamsTypeSRV RecordUpdateParamsType = "SRV" - RecordUpdateParamsTypeSMIMEA RecordUpdateParamsType = "SMIMEA" - RecordUpdateParamsTypePTR RecordUpdateParamsType = "PTR" - RecordUpdateParamsTypeNS RecordUpdateParamsType = "NS" - RecordUpdateParamsTypeNAPTR RecordUpdateParamsType = "NAPTR" - RecordUpdateParamsTypeMX RecordUpdateParamsType = "MX" - RecordUpdateParamsTypeLOC RecordUpdateParamsType = "LOC" - RecordUpdateParamsTypeHTTPS RecordUpdateParamsType = "HTTPS" - RecordUpdateParamsTypeDS RecordUpdateParamsType = "DS" - RecordUpdateParamsTypeDNSKEY RecordUpdateParamsType = "DNSKEY" - RecordUpdateParamsTypeCNAME RecordUpdateParamsType = "CNAME" - RecordUpdateParamsTypeCERT RecordUpdateParamsType = "CERT" - RecordUpdateParamsTypeCAA RecordUpdateParamsType = "CAA" - RecordUpdateParamsTypeAAAA RecordUpdateParamsType = "AAAA" - RecordUpdateParamsTypeA RecordUpdateParamsType = "A" -) +func (RecordNewParamsDNSRecordsCERTRecord) ImplementsRecordNewParams() { -func (r RecordUpdateParamsType) IsKnown() bool { - switch r { - case RecordUpdateParamsTypeURI, RecordUpdateParamsTypeTXT, RecordUpdateParamsTypeTLSA, RecordUpdateParamsTypeSVCB, RecordUpdateParamsTypeSSHFP, RecordUpdateParamsTypeSRV, RecordUpdateParamsTypeSMIMEA, RecordUpdateParamsTypePTR, RecordUpdateParamsTypeNS, RecordUpdateParamsTypeNAPTR, RecordUpdateParamsTypeMX, RecordUpdateParamsTypeLOC, RecordUpdateParamsTypeHTTPS, RecordUpdateParamsTypeDS, RecordUpdateParamsTypeDNSKEY, RecordUpdateParamsTypeCNAME, RecordUpdateParamsTypeCERT, RecordUpdateParamsTypeCAA, RecordUpdateParamsTypeAAAA, RecordUpdateParamsTypeA: - return true - } - return false } -type RecordUpdateParamsData struct { - // algorithm. +// Components of a CERT record. +type RecordNewParamsDNSRecordsCERTRecordData struct { + // Algorithm. Algorithm param.Field[float64] `json:"algorithm"` - // Altitude of location in meters. - Altitude param.Field[float64] `json:"altitude"` - // certificate. + // Certificate. Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r RecordNewParamsDNSRecordsCERTRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsCERTRecordType string + +const ( + RecordNewParamsDNSRecordsCERTRecordTypeCERT RecordNewParamsDNSRecordsCERTRecordType = "CERT" +) + +func (r RecordNewParamsDNSRecordsCERTRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsCERTRecordTypeCERT: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsCERTRecordTTLNumber]. +type RecordNewParamsDNSRecordsCERTRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsCERTRecordTTL() +} + +type RecordNewParamsDNSRecordsCERTRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsCERTRecordTTLNumber1 RecordNewParamsDNSRecordsCERTRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsCERTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsCERTRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsCNAMERecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsCNAMERecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsCNAMERecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsCNAMERecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsCNAMERecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsCNAMERecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsCNAMERecordType string + +const ( + RecordNewParamsDNSRecordsCNAMERecordTypeCNAME RecordNewParamsDNSRecordsCNAMERecordType = "CNAME" +) + +func (r RecordNewParamsDNSRecordsCNAMERecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsCNAMERecordTypeCNAME: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsCNAMERecordTTLNumber]. +type RecordNewParamsDNSRecordsCNAMERecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsCNAMERecordTTL() +} + +type RecordNewParamsDNSRecordsCNAMERecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsCNAMERecordTTLNumber1 RecordNewParamsDNSRecordsCNAMERecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsCNAMERecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsCNAMERecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsDNSKEYRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DNSKEY record. + Data param.Field[RecordNewParamsDNSRecordsDNSKEYRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsDNSKEYRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsDNSKEYRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsDNSKEYRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsDNSKEYRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsDNSKEYRecord) ImplementsRecordNewParams() { + +} + +// Components of a DNSKEY record. +type RecordNewParamsDNSRecordsDNSKEYRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r RecordNewParamsDNSRecordsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsDNSKEYRecordType string + +const ( + RecordNewParamsDNSRecordsDNSKEYRecordTypeDNSKEY RecordNewParamsDNSRecordsDNSKEYRecordType = "DNSKEY" +) + +func (r RecordNewParamsDNSRecordsDNSKEYRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsDNSKEYRecordTypeDNSKEY: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber]. +type RecordNewParamsDNSRecordsDNSKEYRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsDNSKEYRecordTTL() +} + +type RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber1 RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsDNSKEYRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsDSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DS record. + Data param.Field[RecordNewParamsDNSRecordsDSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsDSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsDSRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsDSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsDSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsDSRecord) ImplementsRecordNewParams() { + +} + +// Components of a DS record. +type RecordNewParamsDNSRecordsDSRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Digest. + Digest param.Field[string] `json:"digest"` + // Digest Type. + DigestType param.Field[float64] `json:"digest_type"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r RecordNewParamsDNSRecordsDSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsDSRecordType string + +const ( + RecordNewParamsDNSRecordsDSRecordTypeDS RecordNewParamsDNSRecordsDSRecordType = "DS" +) + +func (r RecordNewParamsDNSRecordsDSRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsDSRecordTypeDS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsDSRecordTTLNumber]. +type RecordNewParamsDNSRecordsDSRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsDSRecordTTL() +} + +type RecordNewParamsDNSRecordsDSRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsDSRecordTTLNumber1 RecordNewParamsDNSRecordsDSRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsDSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsDSRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsHTTPSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a HTTPS record. + Data param.Field[RecordNewParamsDNSRecordsHTTPSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsHTTPSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsHTTPSRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsHTTPSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsHTTPSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsHTTPSRecord) ImplementsRecordNewParams() { + +} + +// Components of a HTTPS record. +type RecordNewParamsDNSRecordsHTTPSRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r RecordNewParamsDNSRecordsHTTPSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsHTTPSRecordType string + +const ( + RecordNewParamsDNSRecordsHTTPSRecordTypeHTTPS RecordNewParamsDNSRecordsHTTPSRecordType = "HTTPS" +) + +func (r RecordNewParamsDNSRecordsHTTPSRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsHTTPSRecordTypeHTTPS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsHTTPSRecordTTLNumber]. +type RecordNewParamsDNSRecordsHTTPSRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsHTTPSRecordTTL() +} + +type RecordNewParamsDNSRecordsHTTPSRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsHTTPSRecordTTLNumber1 RecordNewParamsDNSRecordsHTTPSRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsHTTPSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsHTTPSRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsLOCRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a LOC record. + Data param.Field[RecordNewParamsDNSRecordsLOCRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsLOCRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsLOCRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsLOCRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsLOCRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsLOCRecord) ImplementsRecordNewParams() { + +} + +// Components of a LOC record. +type RecordNewParamsDNSRecordsLOCRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` + // Degrees of latitude. + LatDegrees param.Field[float64] `json:"lat_degrees"` + // Latitude direction. + LatDirection param.Field[RecordNewParamsDNSRecordsLOCRecordDataLatDirection] `json:"lat_direction"` + // Minutes of latitude. + LatMinutes param.Field[float64] `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds param.Field[float64] `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees param.Field[float64] `json:"long_degrees"` + // Longitude direction. + LongDirection param.Field[RecordNewParamsDNSRecordsLOCRecordDataLongDirection] `json:"long_direction"` + // Minutes of longitude. + LongMinutes param.Field[float64] `json:"long_minutes"` + // Seconds of longitude. + LongSeconds param.Field[float64] `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz param.Field[float64] `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r RecordNewParamsDNSRecordsLOCRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type RecordNewParamsDNSRecordsLOCRecordDataLatDirection string + +const ( + RecordNewParamsDNSRecordsLOCRecordDataLatDirectionN RecordNewParamsDNSRecordsLOCRecordDataLatDirection = "N" + RecordNewParamsDNSRecordsLOCRecordDataLatDirectionS RecordNewParamsDNSRecordsLOCRecordDataLatDirection = "S" +) + +func (r RecordNewParamsDNSRecordsLOCRecordDataLatDirection) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsLOCRecordDataLatDirectionN, RecordNewParamsDNSRecordsLOCRecordDataLatDirectionS: + return true + } + return false +} + +// Longitude direction. +type RecordNewParamsDNSRecordsLOCRecordDataLongDirection string + +const ( + RecordNewParamsDNSRecordsLOCRecordDataLongDirectionE RecordNewParamsDNSRecordsLOCRecordDataLongDirection = "E" + RecordNewParamsDNSRecordsLOCRecordDataLongDirectionW RecordNewParamsDNSRecordsLOCRecordDataLongDirection = "W" +) + +func (r RecordNewParamsDNSRecordsLOCRecordDataLongDirection) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsLOCRecordDataLongDirectionE, RecordNewParamsDNSRecordsLOCRecordDataLongDirectionW: + return true + } + return false +} + +// Record type. +type RecordNewParamsDNSRecordsLOCRecordType string + +const ( + RecordNewParamsDNSRecordsLOCRecordTypeLOC RecordNewParamsDNSRecordsLOCRecordType = "LOC" +) + +func (r RecordNewParamsDNSRecordsLOCRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsLOCRecordTypeLOC: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsLOCRecordTTLNumber]. +type RecordNewParamsDNSRecordsLOCRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsLOCRecordTTL() +} + +type RecordNewParamsDNSRecordsLOCRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsLOCRecordTTLNumber1 RecordNewParamsDNSRecordsLOCRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsLOCRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsLOCRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsMXRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsMXRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsMXRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsMXRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsMXRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsMXRecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsMXRecordType string + +const ( + RecordNewParamsDNSRecordsMXRecordTypeMX RecordNewParamsDNSRecordsMXRecordType = "MX" +) + +func (r RecordNewParamsDNSRecordsMXRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsMXRecordTypeMX: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsMXRecordTTLNumber]. +type RecordNewParamsDNSRecordsMXRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsMXRecordTTL() +} + +type RecordNewParamsDNSRecordsMXRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsMXRecordTTLNumber1 RecordNewParamsDNSRecordsMXRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsMXRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsMXRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsNAPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a NAPTR record. + Data param.Field[RecordNewParamsDNSRecordsNAPTRRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsNAPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsNAPTRRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsNAPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsNAPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsNAPTRRecord) ImplementsRecordNewParams() { + +} + +// Components of a NAPTR record. +type RecordNewParamsDNSRecordsNAPTRRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` + // Preference. + Preference param.Field[float64] `json:"preference"` + // Regex. + Regex param.Field[string] `json:"regex"` + // Replacement. + Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r RecordNewParamsDNSRecordsNAPTRRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsNAPTRRecordType string + +const ( + RecordNewParamsDNSRecordsNAPTRRecordTypeNAPTR RecordNewParamsDNSRecordsNAPTRRecordType = "NAPTR" +) + +func (r RecordNewParamsDNSRecordsNAPTRRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsNAPTRRecordTypeNAPTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsNAPTRRecordTTLNumber]. +type RecordNewParamsDNSRecordsNAPTRRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsNAPTRRecordTTL() +} + +type RecordNewParamsDNSRecordsNAPTRRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsNAPTRRecordTTLNumber1 RecordNewParamsDNSRecordsNAPTRRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsNAPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsNAPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsNSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsNSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsNSRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsNSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsNSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsNSRecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsNSRecordType string + +const ( + RecordNewParamsDNSRecordsNSRecordTypeNS RecordNewParamsDNSRecordsNSRecordType = "NS" +) + +func (r RecordNewParamsDNSRecordsNSRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsNSRecordTypeNS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsNSRecordTTLNumber]. +type RecordNewParamsDNSRecordsNSRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsNSRecordTTL() +} + +type RecordNewParamsDNSRecordsNSRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsNSRecordTTLNumber1 RecordNewParamsDNSRecordsNSRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsNSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsNSRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsPTRRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsPTRRecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsPTRRecordType string + +const ( + RecordNewParamsDNSRecordsPTRRecordTypePTR RecordNewParamsDNSRecordsPTRRecordType = "PTR" +) + +func (r RecordNewParamsDNSRecordsPTRRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsPTRRecordTypePTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsPTRRecordTTLNumber]. +type RecordNewParamsDNSRecordsPTRRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsPTRRecordTTL() +} + +type RecordNewParamsDNSRecordsPTRRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsPTRRecordTTLNumber1 RecordNewParamsDNSRecordsPTRRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsSMIMEARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SMIMEA record. + Data param.Field[RecordNewParamsDNSRecordsSMIMEARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsSMIMEARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsSMIMEARecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsSMIMEARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsSMIMEARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsSMIMEARecord) ImplementsRecordNewParams() { + +} + +// Components of a SMIMEA record. +type RecordNewParamsDNSRecordsSMIMEARecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r RecordNewParamsDNSRecordsSMIMEARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsSMIMEARecordType string + +const ( + RecordNewParamsDNSRecordsSMIMEARecordTypeSMIMEA RecordNewParamsDNSRecordsSMIMEARecordType = "SMIMEA" +) + +func (r RecordNewParamsDNSRecordsSMIMEARecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSMIMEARecordTypeSMIMEA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsSMIMEARecordTTLNumber]. +type RecordNewParamsDNSRecordsSMIMEARecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsSMIMEARecordTTL() +} + +type RecordNewParamsDNSRecordsSMIMEARecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsSMIMEARecordTTLNumber1 RecordNewParamsDNSRecordsSMIMEARecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsSMIMEARecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSMIMEARecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsSRVRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SRV record. + Data param.Field[RecordNewParamsDNSRecordsSRVRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsSRVRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsSRVRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsSRVRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsSRVRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsSRVRecord) ImplementsRecordNewParams() { + +} + +// Components of a SRV record. +type RecordNewParamsDNSRecordsSRVRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r RecordNewParamsDNSRecordsSRVRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsSRVRecordType string + +const ( + RecordNewParamsDNSRecordsSRVRecordTypeSRV RecordNewParamsDNSRecordsSRVRecordType = "SRV" +) + +func (r RecordNewParamsDNSRecordsSRVRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSRVRecordTypeSRV: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsSRVRecordTTLNumber]. +type RecordNewParamsDNSRecordsSRVRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsSRVRecordTTL() +} + +type RecordNewParamsDNSRecordsSRVRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsSRVRecordTTLNumber1 RecordNewParamsDNSRecordsSRVRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsSRVRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSRVRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsSSHFPRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SSHFP record. + Data param.Field[RecordNewParamsDNSRecordsSSHFPRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsSSHFPRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsSSHFPRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsSSHFPRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsSSHFPRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsSSHFPRecord) ImplementsRecordNewParams() { + +} + +// Components of a SSHFP record. +type RecordNewParamsDNSRecordsSSHFPRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r RecordNewParamsDNSRecordsSSHFPRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsSSHFPRecordType string + +const ( + RecordNewParamsDNSRecordsSSHFPRecordTypeSSHFP RecordNewParamsDNSRecordsSSHFPRecordType = "SSHFP" +) + +func (r RecordNewParamsDNSRecordsSSHFPRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSSHFPRecordTypeSSHFP: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsSSHFPRecordTTLNumber]. +type RecordNewParamsDNSRecordsSSHFPRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsSSHFPRecordTTL() +} + +type RecordNewParamsDNSRecordsSSHFPRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsSSHFPRecordTTLNumber1 RecordNewParamsDNSRecordsSSHFPRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsSSHFPRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSSHFPRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsSVCBRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SVCB record. + Data param.Field[RecordNewParamsDNSRecordsSVCBRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsSVCBRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsSVCBRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsSVCBRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsSVCBRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsSVCBRecord) ImplementsRecordNewParams() { + +} + +// Components of a SVCB record. +type RecordNewParamsDNSRecordsSVCBRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r RecordNewParamsDNSRecordsSVCBRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsSVCBRecordType string + +const ( + RecordNewParamsDNSRecordsSVCBRecordTypeSVCB RecordNewParamsDNSRecordsSVCBRecordType = "SVCB" +) + +func (r RecordNewParamsDNSRecordsSVCBRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSVCBRecordTypeSVCB: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsSVCBRecordTTLNumber]. +type RecordNewParamsDNSRecordsSVCBRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsSVCBRecordTTL() +} + +type RecordNewParamsDNSRecordsSVCBRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsSVCBRecordTTLNumber1 RecordNewParamsDNSRecordsSVCBRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsSVCBRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsSVCBRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsTLSARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a TLSA record. + Data param.Field[RecordNewParamsDNSRecordsTLSARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsTLSARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsTLSARecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsTLSARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsTLSARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsTLSARecord) ImplementsRecordNewParams() { + +} + +// Components of a TLSA record. +type RecordNewParamsDNSRecordsTLSARecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r RecordNewParamsDNSRecordsTLSARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsTLSARecordType string + +const ( + RecordNewParamsDNSRecordsTLSARecordTypeTLSA RecordNewParamsDNSRecordsTLSARecordType = "TLSA" +) + +func (r RecordNewParamsDNSRecordsTLSARecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsTLSARecordTypeTLSA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsTLSARecordTTLNumber]. +type RecordNewParamsDNSRecordsTLSARecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsTLSARecordTTL() +} + +type RecordNewParamsDNSRecordsTLSARecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsTLSARecordTTLNumber1 RecordNewParamsDNSRecordsTLSARecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsTLSARecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsTLSARecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsTXTRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsTXTRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsTXTRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsTXTRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsTXTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsTXTRecord) ImplementsRecordNewParams() { + +} + +// Record type. +type RecordNewParamsDNSRecordsTXTRecordType string + +const ( + RecordNewParamsDNSRecordsTXTRecordTypeTXT RecordNewParamsDNSRecordsTXTRecordType = "TXT" +) + +func (r RecordNewParamsDNSRecordsTXTRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsTXTRecordTypeTXT: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsTXTRecordTTLNumber]. +type RecordNewParamsDNSRecordsTXTRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsTXTRecordTTL() +} + +type RecordNewParamsDNSRecordsTXTRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsTXTRecordTTLNumber1 RecordNewParamsDNSRecordsTXTRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsTXTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsTXTRecordTTLNumber1: + return true + } + return false +} + +type RecordNewParamsDNSRecordsURIRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a URI record. + Data param.Field[RecordNewParamsDNSRecordsURIRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[RecordNewParamsDNSRecordsURIRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordNewParamsDNSRecordsURIRecordTTL] `json:"ttl"` +} + +func (r RecordNewParamsDNSRecordsURIRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordNewParamsDNSRecordsURIRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordNewParamsDNSRecordsURIRecord) ImplementsRecordNewParams() { + +} + +// Components of a URI record. +type RecordNewParamsDNSRecordsURIRecordData struct { + // The record content. + Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r RecordNewParamsDNSRecordsURIRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordNewParamsDNSRecordsURIRecordType string + +const ( + RecordNewParamsDNSRecordsURIRecordTypeURI RecordNewParamsDNSRecordsURIRecordType = "URI" +) + +func (r RecordNewParamsDNSRecordsURIRecordType) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsURIRecordTypeURI: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordNewParamsDNSRecordsURIRecordTTLNumber]. +type RecordNewParamsDNSRecordsURIRecordTTL interface { + ImplementsDNSRecordNewParamsDNSRecordsURIRecordTTL() +} + +type RecordNewParamsDNSRecordsURIRecordTTLNumber float64 + +const ( + RecordNewParamsDNSRecordsURIRecordTTLNumber1 RecordNewParamsDNSRecordsURIRecordTTLNumber = 1 +) + +func (r RecordNewParamsDNSRecordsURIRecordTTLNumber) IsKnown() bool { + switch r { + case RecordNewParamsDNSRecordsURIRecordTTLNumber1: + return true + } + return false +} + +type RecordNewResponseEnvelope struct { + Errors []RecordNewResponseEnvelopeErrors `json:"errors,required"` + Messages []RecordNewResponseEnvelopeMessages `json:"messages,required"` + Result DNSRecord `json:"result,required"` + // Whether the API call was successful + Success RecordNewResponseEnvelopeSuccess `json:"success,required"` + JSON recordNewResponseEnvelopeJSON `json:"-"` +} + +// recordNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [RecordNewResponseEnvelope] +type recordNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type RecordNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON recordNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// recordNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct +// [RecordNewResponseEnvelopeErrors] +type recordNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordNewResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw +} + +type RecordNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON recordNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// recordNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct +// [RecordNewResponseEnvelopeMessages] +type recordNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordNewResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type RecordNewResponseEnvelopeSuccess bool + +const ( + RecordNewResponseEnvelopeSuccessTrue RecordNewResponseEnvelopeSuccess = true +) + +func (r RecordNewResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case RecordNewResponseEnvelopeSuccessTrue: + return true + } + return false +} + +// This interface is a union satisfied by one of the following: +// [RecordUpdateParamsDNSRecordsARecord], [RecordUpdateParamsDNSRecordsAAAARecord], +// [RecordUpdateParamsDNSRecordsCAARecord], +// [RecordUpdateParamsDNSRecordsCERTRecord], +// [RecordUpdateParamsDNSRecordsCNAMERecord], +// [RecordUpdateParamsDNSRecordsDNSKEYRecord], +// [RecordUpdateParamsDNSRecordsDSRecord], +// [RecordUpdateParamsDNSRecordsHTTPSRecord], +// [RecordUpdateParamsDNSRecordsLOCRecord], [RecordUpdateParamsDNSRecordsMXRecord], +// [RecordUpdateParamsDNSRecordsNAPTRRecord], +// [RecordUpdateParamsDNSRecordsNSRecord], [RecordUpdateParamsDNSRecordsPTRRecord], +// [RecordUpdateParamsDNSRecordsSMIMEARecord], +// [RecordUpdateParamsDNSRecordsSRVRecord], +// [RecordUpdateParamsDNSRecordsSSHFPRecord], +// [RecordUpdateParamsDNSRecordsSVCBRecord], +// [RecordUpdateParamsDNSRecordsTLSARecord], +// [RecordUpdateParamsDNSRecordsTXTRecord], +// [RecordUpdateParamsDNSRecordsURIRecord]. +type RecordUpdateParams interface { + ImplementsRecordUpdateParams() + + getZoneID() param.Field[string] +} + +type RecordUpdateParamsDNSRecordsARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsARecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsARecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsARecordType string + +const ( + RecordUpdateParamsDNSRecordsARecordTypeA RecordUpdateParamsDNSRecordsARecordType = "A" +) + +func (r RecordUpdateParamsDNSRecordsARecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsARecordTypeA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsARecordTTLNumber]. +type RecordUpdateParamsDNSRecordsARecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsARecordTTL() +} + +type RecordUpdateParamsDNSRecordsARecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsARecordTTLNumber1 RecordUpdateParamsDNSRecordsARecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsARecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsARecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsAAAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsAAAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsAAAARecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsAAAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsAAAARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsAAAARecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsAAAARecordType string + +const ( + RecordUpdateParamsDNSRecordsAAAARecordTypeAAAA RecordUpdateParamsDNSRecordsAAAARecordType = "AAAA" +) + +func (r RecordUpdateParamsDNSRecordsAAAARecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsAAAARecordTypeAAAA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsAAAARecordTTLNumber]. +type RecordUpdateParamsDNSRecordsAAAARecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsAAAARecordTTL() +} + +type RecordUpdateParamsDNSRecordsAAAARecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsAAAARecordTTLNumber1 RecordUpdateParamsDNSRecordsAAAARecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsAAAARecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsAAAARecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsCAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CAA record. + Data param.Field[RecordUpdateParamsDNSRecordsCAARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsCAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsCAARecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsCAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsCAARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsCAARecord) ImplementsRecordUpdateParams() { + +} + +// Components of a CAA record. +type RecordUpdateParamsDNSRecordsCAARecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` +} + +func (r RecordUpdateParamsDNSRecordsCAARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsCAARecordType string + +const ( + RecordUpdateParamsDNSRecordsCAARecordTypeCAA RecordUpdateParamsDNSRecordsCAARecordType = "CAA" +) + +func (r RecordUpdateParamsDNSRecordsCAARecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCAARecordTypeCAA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsCAARecordTTLNumber]. +type RecordUpdateParamsDNSRecordsCAARecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsCAARecordTTL() +} + +type RecordUpdateParamsDNSRecordsCAARecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsCAARecordTTLNumber1 RecordUpdateParamsDNSRecordsCAARecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsCAARecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCAARecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsCERTRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CERT record. + Data param.Field[RecordUpdateParamsDNSRecordsCERTRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsCERTRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsCERTRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsCERTRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsCERTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsCERTRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a CERT record. +type RecordUpdateParamsDNSRecordsCERTRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r RecordUpdateParamsDNSRecordsCERTRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsCERTRecordType string + +const ( + RecordUpdateParamsDNSRecordsCERTRecordTypeCERT RecordUpdateParamsDNSRecordsCERTRecordType = "CERT" +) + +func (r RecordUpdateParamsDNSRecordsCERTRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCERTRecordTypeCERT: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsCERTRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsCERTRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsCERTRecordTTL() +} + +type RecordUpdateParamsDNSRecordsCERTRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsCERTRecordTTLNumber1 RecordUpdateParamsDNSRecordsCERTRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsCERTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCERTRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsCNAMERecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsCNAMERecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsCNAMERecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsCNAMERecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsCNAMERecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsCNAMERecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsCNAMERecordType string + +const ( + RecordUpdateParamsDNSRecordsCNAMERecordTypeCNAME RecordUpdateParamsDNSRecordsCNAMERecordType = "CNAME" +) + +func (r RecordUpdateParamsDNSRecordsCNAMERecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCNAMERecordTypeCNAME: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber]. +type RecordUpdateParamsDNSRecordsCNAMERecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsCNAMERecordTTL() +} + +type RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber1 RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsCNAMERecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsDNSKEYRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DNSKEY record. + Data param.Field[RecordUpdateParamsDNSRecordsDNSKEYRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsDNSKEYRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsDNSKEYRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsDNSKEYRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsDNSKEYRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsDNSKEYRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a DNSKEY record. +type RecordUpdateParamsDNSRecordsDNSKEYRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r RecordUpdateParamsDNSRecordsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsDNSKEYRecordType string + +const ( + RecordUpdateParamsDNSRecordsDNSKEYRecordTypeDNSKEY RecordUpdateParamsDNSRecordsDNSKEYRecordType = "DNSKEY" +) + +func (r RecordUpdateParamsDNSRecordsDNSKEYRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsDNSKEYRecordTypeDNSKEY: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsDNSKEYRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsDNSKEYRecordTTL() +} + +type RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber1 RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsDNSKEYRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsDSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DS record. + Data param.Field[RecordUpdateParamsDNSRecordsDSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsDSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsDSRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsDSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsDSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsDSRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a DS record. +type RecordUpdateParamsDNSRecordsDSRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Digest. + Digest param.Field[string] `json:"digest"` + // Digest Type. + DigestType param.Field[float64] `json:"digest_type"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r RecordUpdateParamsDNSRecordsDSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsDSRecordType string + +const ( + RecordUpdateParamsDNSRecordsDSRecordTypeDS RecordUpdateParamsDNSRecordsDSRecordType = "DS" +) + +func (r RecordUpdateParamsDNSRecordsDSRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsDSRecordTypeDS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsDSRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsDSRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsDSRecordTTL() +} + +type RecordUpdateParamsDNSRecordsDSRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsDSRecordTTLNumber1 RecordUpdateParamsDNSRecordsDSRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsDSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsDSRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsHTTPSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a HTTPS record. + Data param.Field[RecordUpdateParamsDNSRecordsHTTPSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsHTTPSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsHTTPSRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsHTTPSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsHTTPSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsHTTPSRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a HTTPS record. +type RecordUpdateParamsDNSRecordsHTTPSRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r RecordUpdateParamsDNSRecordsHTTPSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsHTTPSRecordType string + +const ( + RecordUpdateParamsDNSRecordsHTTPSRecordTypeHTTPS RecordUpdateParamsDNSRecordsHTTPSRecordType = "HTTPS" +) + +func (r RecordUpdateParamsDNSRecordsHTTPSRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsHTTPSRecordTypeHTTPS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsHTTPSRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsHTTPSRecordTTL() +} + +type RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber1 RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsHTTPSRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsLOCRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a LOC record. + Data param.Field[RecordUpdateParamsDNSRecordsLOCRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsLOCRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsLOCRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsLOCRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsLOCRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsLOCRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a LOC record. +type RecordUpdateParamsDNSRecordsLOCRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` + // Degrees of latitude. + LatDegrees param.Field[float64] `json:"lat_degrees"` + // Latitude direction. + LatDirection param.Field[RecordUpdateParamsDNSRecordsLOCRecordDataLatDirection] `json:"lat_direction"` + // Minutes of latitude. + LatMinutes param.Field[float64] `json:"lat_minutes"` + // Seconds of latitude. + LatSeconds param.Field[float64] `json:"lat_seconds"` + // Degrees of longitude. + LongDegrees param.Field[float64] `json:"long_degrees"` + // Longitude direction. + LongDirection param.Field[RecordUpdateParamsDNSRecordsLOCRecordDataLongDirection] `json:"long_direction"` + // Minutes of longitude. + LongMinutes param.Field[float64] `json:"long_minutes"` + // Seconds of longitude. + LongSeconds param.Field[float64] `json:"long_seconds"` + // Horizontal precision of location. + PrecisionHorz param.Field[float64] `json:"precision_horz"` + // Vertical precision of location. + PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r RecordUpdateParamsDNSRecordsLOCRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type RecordUpdateParamsDNSRecordsLOCRecordDataLatDirection string + +const ( + RecordUpdateParamsDNSRecordsLOCRecordDataLatDirectionN RecordUpdateParamsDNSRecordsLOCRecordDataLatDirection = "N" + RecordUpdateParamsDNSRecordsLOCRecordDataLatDirectionS RecordUpdateParamsDNSRecordsLOCRecordDataLatDirection = "S" +) + +func (r RecordUpdateParamsDNSRecordsLOCRecordDataLatDirection) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsLOCRecordDataLatDirectionN, RecordUpdateParamsDNSRecordsLOCRecordDataLatDirectionS: + return true + } + return false +} + +// Longitude direction. +type RecordUpdateParamsDNSRecordsLOCRecordDataLongDirection string + +const ( + RecordUpdateParamsDNSRecordsLOCRecordDataLongDirectionE RecordUpdateParamsDNSRecordsLOCRecordDataLongDirection = "E" + RecordUpdateParamsDNSRecordsLOCRecordDataLongDirectionW RecordUpdateParamsDNSRecordsLOCRecordDataLongDirection = "W" +) + +func (r RecordUpdateParamsDNSRecordsLOCRecordDataLongDirection) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsLOCRecordDataLongDirectionE, RecordUpdateParamsDNSRecordsLOCRecordDataLongDirectionW: + return true + } + return false +} + +// Record type. +type RecordUpdateParamsDNSRecordsLOCRecordType string + +const ( + RecordUpdateParamsDNSRecordsLOCRecordTypeLOC RecordUpdateParamsDNSRecordsLOCRecordType = "LOC" +) + +func (r RecordUpdateParamsDNSRecordsLOCRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsLOCRecordTypeLOC: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsLOCRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsLOCRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsLOCRecordTTL() +} + +type RecordUpdateParamsDNSRecordsLOCRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsLOCRecordTTLNumber1 RecordUpdateParamsDNSRecordsLOCRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsLOCRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsLOCRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsMXRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsMXRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsMXRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsMXRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsMXRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsMXRecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsMXRecordType string + +const ( + RecordUpdateParamsDNSRecordsMXRecordTypeMX RecordUpdateParamsDNSRecordsMXRecordType = "MX" +) + +func (r RecordUpdateParamsDNSRecordsMXRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsMXRecordTypeMX: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsMXRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsMXRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsMXRecordTTL() +} + +type RecordUpdateParamsDNSRecordsMXRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsMXRecordTTLNumber1 RecordUpdateParamsDNSRecordsMXRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsMXRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsMXRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsNAPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a NAPTR record. + Data param.Field[RecordUpdateParamsDNSRecordsNAPTRRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsNAPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsNAPTRRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsNAPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsNAPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsNAPTRRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a NAPTR record. +type RecordUpdateParamsDNSRecordsNAPTRRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` + // Preference. + Preference param.Field[float64] `json:"preference"` + // Regex. + Regex param.Field[string] `json:"regex"` + // Replacement. + Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r RecordUpdateParamsDNSRecordsNAPTRRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsNAPTRRecordType string + +const ( + RecordUpdateParamsDNSRecordsNAPTRRecordTypeNAPTR RecordUpdateParamsDNSRecordsNAPTRRecordType = "NAPTR" +) + +func (r RecordUpdateParamsDNSRecordsNAPTRRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsNAPTRRecordTypeNAPTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsNAPTRRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsNAPTRRecordTTL() +} + +type RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber1 RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsNAPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsNSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsNSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsNSRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsNSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsNSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsNSRecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsNSRecordType string + +const ( + RecordUpdateParamsDNSRecordsNSRecordTypeNS RecordUpdateParamsDNSRecordsNSRecordType = "NS" +) + +func (r RecordUpdateParamsDNSRecordsNSRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsNSRecordTypeNS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsNSRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsNSRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsNSRecordTTL() +} + +type RecordUpdateParamsDNSRecordsNSRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsNSRecordTTLNumber1 RecordUpdateParamsDNSRecordsNSRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsNSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsNSRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsPTRRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsPTRRecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsPTRRecordType string + +const ( + RecordUpdateParamsDNSRecordsPTRRecordTypePTR RecordUpdateParamsDNSRecordsPTRRecordType = "PTR" +) + +func (r RecordUpdateParamsDNSRecordsPTRRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsPTRRecordTypePTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsPTRRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsPTRRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsPTRRecordTTL() +} + +type RecordUpdateParamsDNSRecordsPTRRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsPTRRecordTTLNumber1 RecordUpdateParamsDNSRecordsPTRRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsSMIMEARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SMIMEA record. + Data param.Field[RecordUpdateParamsDNSRecordsSMIMEARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsSMIMEARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsSMIMEARecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsSMIMEARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsSMIMEARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsSMIMEARecord) ImplementsRecordUpdateParams() { + +} + +// Components of a SMIMEA record. +type RecordUpdateParamsDNSRecordsSMIMEARecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r RecordUpdateParamsDNSRecordsSMIMEARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsSMIMEARecordType string + +const ( + RecordUpdateParamsDNSRecordsSMIMEARecordTypeSMIMEA RecordUpdateParamsDNSRecordsSMIMEARecordType = "SMIMEA" +) + +func (r RecordUpdateParamsDNSRecordsSMIMEARecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSMIMEARecordTypeSMIMEA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber]. +type RecordUpdateParamsDNSRecordsSMIMEARecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsSMIMEARecordTTL() +} + +type RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber1 RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSMIMEARecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsSRVRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SRV record. + Data param.Field[RecordUpdateParamsDNSRecordsSRVRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsSRVRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsSRVRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsSRVRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsSRVRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsSRVRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a SRV record. +type RecordUpdateParamsDNSRecordsSRVRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r RecordUpdateParamsDNSRecordsSRVRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsSRVRecordType string + +const ( + RecordUpdateParamsDNSRecordsSRVRecordTypeSRV RecordUpdateParamsDNSRecordsSRVRecordType = "SRV" +) + +func (r RecordUpdateParamsDNSRecordsSRVRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSRVRecordTypeSRV: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsSRVRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsSRVRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsSRVRecordTTL() +} + +type RecordUpdateParamsDNSRecordsSRVRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsSRVRecordTTLNumber1 RecordUpdateParamsDNSRecordsSRVRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsSRVRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSRVRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsSSHFPRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SSHFP record. + Data param.Field[RecordUpdateParamsDNSRecordsSSHFPRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsSSHFPRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsSSHFPRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsSSHFPRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsSSHFPRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsSSHFPRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a SSHFP record. +type RecordUpdateParamsDNSRecordsSSHFPRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r RecordUpdateParamsDNSRecordsSSHFPRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsSSHFPRecordType string + +const ( + RecordUpdateParamsDNSRecordsSSHFPRecordTypeSSHFP RecordUpdateParamsDNSRecordsSSHFPRecordType = "SSHFP" +) + +func (r RecordUpdateParamsDNSRecordsSSHFPRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSSHFPRecordTypeSSHFP: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsSSHFPRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsSSHFPRecordTTL() +} + +type RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber1 RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSSHFPRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsSVCBRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SVCB record. + Data param.Field[RecordUpdateParamsDNSRecordsSVCBRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsSVCBRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsSVCBRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsSVCBRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsSVCBRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsSVCBRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a SVCB record. +type RecordUpdateParamsDNSRecordsSVCBRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r RecordUpdateParamsDNSRecordsSVCBRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsSVCBRecordType string + +const ( + RecordUpdateParamsDNSRecordsSVCBRecordTypeSVCB RecordUpdateParamsDNSRecordsSVCBRecordType = "SVCB" +) + +func (r RecordUpdateParamsDNSRecordsSVCBRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSVCBRecordTypeSVCB: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsSVCBRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsSVCBRecordTTL() +} + +type RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber1 RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsSVCBRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsTLSARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a TLSA record. + Data param.Field[RecordUpdateParamsDNSRecordsTLSARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsTLSARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsTLSARecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsTLSARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsTLSARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsTLSARecord) ImplementsRecordUpdateParams() { + +} + +// Components of a TLSA record. +type RecordUpdateParamsDNSRecordsTLSARecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} + +func (r RecordUpdateParamsDNSRecordsTLSARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsTLSARecordType string + +const ( + RecordUpdateParamsDNSRecordsTLSARecordTypeTLSA RecordUpdateParamsDNSRecordsTLSARecordType = "TLSA" +) + +func (r RecordUpdateParamsDNSRecordsTLSARecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsTLSARecordTypeTLSA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsTLSARecordTTLNumber]. +type RecordUpdateParamsDNSRecordsTLSARecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsTLSARecordTTL() +} + +type RecordUpdateParamsDNSRecordsTLSARecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsTLSARecordTTLNumber1 RecordUpdateParamsDNSRecordsTLSARecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsTLSARecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsTLSARecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsTXTRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsTXTRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsTXTRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsTXTRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsTXTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsTXTRecord) ImplementsRecordUpdateParams() { + +} + +// Record type. +type RecordUpdateParamsDNSRecordsTXTRecordType string + +const ( + RecordUpdateParamsDNSRecordsTXTRecordTypeTXT RecordUpdateParamsDNSRecordsTXTRecordType = "TXT" +) + +func (r RecordUpdateParamsDNSRecordsTXTRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsTXTRecordTypeTXT: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsTXTRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsTXTRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsTXTRecordTTL() +} + +type RecordUpdateParamsDNSRecordsTXTRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsTXTRecordTTLNumber1 RecordUpdateParamsDNSRecordsTXTRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsTXTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsTXTRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateParamsDNSRecordsURIRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a URI record. + Data param.Field[RecordUpdateParamsDNSRecordsURIRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[RecordUpdateParamsDNSRecordsURIRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordUpdateParamsDNSRecordsURIRecordTTL] `json:"ttl"` +} + +func (r RecordUpdateParamsDNSRecordsURIRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordUpdateParamsDNSRecordsURIRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordUpdateParamsDNSRecordsURIRecord) ImplementsRecordUpdateParams() { + +} + +// Components of a URI record. +type RecordUpdateParamsDNSRecordsURIRecordData struct { // The record content. Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r RecordUpdateParamsDNSRecordsURIRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordUpdateParamsDNSRecordsURIRecordType string + +const ( + RecordUpdateParamsDNSRecordsURIRecordTypeURI RecordUpdateParamsDNSRecordsURIRecordType = "URI" +) + +func (r RecordUpdateParamsDNSRecordsURIRecordType) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsURIRecordTypeURI: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordUpdateParamsDNSRecordsURIRecordTTLNumber]. +type RecordUpdateParamsDNSRecordsURIRecordTTL interface { + ImplementsDNSRecordUpdateParamsDNSRecordsURIRecordTTL() +} + +type RecordUpdateParamsDNSRecordsURIRecordTTLNumber float64 + +const ( + RecordUpdateParamsDNSRecordsURIRecordTTLNumber1 RecordUpdateParamsDNSRecordsURIRecordTTLNumber = 1 +) + +func (r RecordUpdateParamsDNSRecordsURIRecordTTLNumber) IsKnown() bool { + switch r { + case RecordUpdateParamsDNSRecordsURIRecordTTLNumber1: + return true + } + return false +} + +type RecordUpdateResponseEnvelope struct { + Errors []RecordUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []RecordUpdateResponseEnvelopeMessages `json:"messages,required"` + Result DNSRecord `json:"result,required"` + // Whether the API call was successful + Success RecordUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON recordUpdateResponseEnvelopeJSON `json:"-"` +} + +// recordUpdateResponseEnvelopeJSON contains the JSON metadata for the struct +// [RecordUpdateResponseEnvelope] +type recordUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type RecordUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON recordUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// recordUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for the struct +// [RecordUpdateResponseEnvelopeErrors] +type recordUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordUpdateResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw +} + +type RecordUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON recordUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// recordUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [RecordUpdateResponseEnvelopeMessages] +type recordUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordUpdateResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type RecordUpdateResponseEnvelopeSuccess bool + +const ( + RecordUpdateResponseEnvelopeSuccessTrue RecordUpdateResponseEnvelopeSuccess = true +) + +func (r RecordUpdateResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case RecordUpdateResponseEnvelopeSuccessTrue: + return true + } + return false +} + +type RecordListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Comment param.Field[RecordListParamsComment] `query:"comment"` + // DNS record content. + Content param.Field[string] `query:"content"` + // Direction to order DNS records in. + Direction param.Field[RecordListParamsDirection] `query:"direction"` + // Whether to match all search requirements or at least one (any). If set to `all`, + // acts like a logical AND between filters. If set to `any`, acts like a logical OR + // instead. Note that the interaction between tag filters is controlled by the + // `tag-match` parameter instead. + Match param.Field[RecordListParamsMatch] `query:"match"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `query:"name"` + // Field to order DNS records by. + Order param.Field[RecordListParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of DNS records per page. + PerPage param.Field[float64] `query:"per_page"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `query:"proxied"` + // Allows searching in multiple properties of a DNS record simultaneously. This + // parameter is intended for human users, not automation. Its exact behavior is + // intentionally left unspecified and is subject to change in the future. This + // parameter works independently of the `match` setting. For automated searches, + // please use the other available parameters. + Search param.Field[string] `query:"search"` + Tag param.Field[RecordListParamsTag] `query:"tag"` + // Whether to match all tag search requirements or at least one (any). If set to + // `all`, acts like a logical AND between tag filters. If set to `any`, acts like a + // logical OR instead. Note that the regular `match` parameter is still used to + // combine the resulting condition with other filters that aren't related to tags. + TagMatch param.Field[RecordListParamsTagMatch] `query:"tag_match"` + // Record type. + Type param.Field[RecordListParamsType] `query:"type"` +} + +// URLQuery serializes [RecordListParams]'s query parameters as `url.Values`. +func (r RecordListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type RecordListParamsComment struct { + // If this parameter is present, only records _without_ a comment are returned. + Absent param.Field[string] `query:"absent"` + // Substring of the DNS record comment. Comment filters are case-insensitive. + Contains param.Field[string] `query:"contains"` + // Suffix of the DNS record comment. Comment filters are case-insensitive. + Endswith param.Field[string] `query:"endswith"` + // Exact value of the DNS record comment. Comment filters are case-insensitive. + Exact param.Field[string] `query:"exact"` + // If this parameter is present, only records _with_ a comment are returned. + Present param.Field[string] `query:"present"` + // Prefix of the DNS record comment. Comment filters are case-insensitive. + Startswith param.Field[string] `query:"startswith"` +} + +// URLQuery serializes [RecordListParamsComment]'s query parameters as +// `url.Values`. +func (r RecordListParamsComment) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order DNS records in. +type RecordListParamsDirection string + +const ( + RecordListParamsDirectionAsc RecordListParamsDirection = "asc" + RecordListParamsDirectionDesc RecordListParamsDirection = "desc" +) + +func (r RecordListParamsDirection) IsKnown() bool { + switch r { + case RecordListParamsDirectionAsc, RecordListParamsDirectionDesc: + return true + } + return false +} + +// Whether to match all search requirements or at least one (any). If set to `all`, +// acts like a logical AND between filters. If set to `any`, acts like a logical OR +// instead. Note that the interaction between tag filters is controlled by the +// `tag-match` parameter instead. +type RecordListParamsMatch string + +const ( + RecordListParamsMatchAny RecordListParamsMatch = "any" + RecordListParamsMatchAll RecordListParamsMatch = "all" +) + +func (r RecordListParamsMatch) IsKnown() bool { + switch r { + case RecordListParamsMatchAny, RecordListParamsMatchAll: + return true + } + return false +} + +// Field to order DNS records by. +type RecordListParamsOrder string + +const ( + RecordListParamsOrderType RecordListParamsOrder = "type" + RecordListParamsOrderName RecordListParamsOrder = "name" + RecordListParamsOrderContent RecordListParamsOrder = "content" + RecordListParamsOrderTTL RecordListParamsOrder = "ttl" + RecordListParamsOrderProxied RecordListParamsOrder = "proxied" +) + +func (r RecordListParamsOrder) IsKnown() bool { + switch r { + case RecordListParamsOrderType, RecordListParamsOrderName, RecordListParamsOrderContent, RecordListParamsOrderTTL, RecordListParamsOrderProxied: + return true + } + return false +} + +type RecordListParamsTag struct { + // Name of a tag which must _not_ be present on the DNS record. Tag filters are + // case-insensitive. + Absent param.Field[string] `query:"absent"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value contains + // ``. Tag filters are case-insensitive. + Contains param.Field[string] `query:"contains"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value ends with + // ``. Tag filters are case-insensitive. + Endswith param.Field[string] `query:"endswith"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value is ``. Tag + // filters are case-insensitive. + Exact param.Field[string] `query:"exact"` + // Name of a tag which must be present on the DNS record. Tag filters are + // case-insensitive. + Present param.Field[string] `query:"present"` + // A tag and value, of the form `:`. The API will only return + // DNS records that have a tag named `` whose value starts with + // ``. Tag filters are case-insensitive. + Startswith param.Field[string] `query:"startswith"` +} + +// URLQuery serializes [RecordListParamsTag]'s query parameters as `url.Values`. +func (r RecordListParamsTag) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Whether to match all tag search requirements or at least one (any). If set to +// `all`, acts like a logical AND between tag filters. If set to `any`, acts like a +// logical OR instead. Note that the regular `match` parameter is still used to +// combine the resulting condition with other filters that aren't related to tags. +type RecordListParamsTagMatch string + +const ( + RecordListParamsTagMatchAny RecordListParamsTagMatch = "any" + RecordListParamsTagMatchAll RecordListParamsTagMatch = "all" +) + +func (r RecordListParamsTagMatch) IsKnown() bool { + switch r { + case RecordListParamsTagMatchAny, RecordListParamsTagMatchAll: + return true + } + return false +} + +// Record type. +type RecordListParamsType string + +const ( + RecordListParamsTypeA RecordListParamsType = "A" + RecordListParamsTypeAAAA RecordListParamsType = "AAAA" + RecordListParamsTypeCAA RecordListParamsType = "CAA" + RecordListParamsTypeCERT RecordListParamsType = "CERT" + RecordListParamsTypeCNAME RecordListParamsType = "CNAME" + RecordListParamsTypeDNSKEY RecordListParamsType = "DNSKEY" + RecordListParamsTypeDS RecordListParamsType = "DS" + RecordListParamsTypeHTTPS RecordListParamsType = "HTTPS" + RecordListParamsTypeLOC RecordListParamsType = "LOC" + RecordListParamsTypeMX RecordListParamsType = "MX" + RecordListParamsTypeNAPTR RecordListParamsType = "NAPTR" + RecordListParamsTypeNS RecordListParamsType = "NS" + RecordListParamsTypePTR RecordListParamsType = "PTR" + RecordListParamsTypeSMIMEA RecordListParamsType = "SMIMEA" + RecordListParamsTypeSRV RecordListParamsType = "SRV" + RecordListParamsTypeSSHFP RecordListParamsType = "SSHFP" + RecordListParamsTypeSVCB RecordListParamsType = "SVCB" + RecordListParamsTypeTLSA RecordListParamsType = "TLSA" + RecordListParamsTypeTXT RecordListParamsType = "TXT" + RecordListParamsTypeURI RecordListParamsType = "URI" +) + +func (r RecordListParamsType) IsKnown() bool { + switch r { + case RecordListParamsTypeA, RecordListParamsTypeAAAA, RecordListParamsTypeCAA, RecordListParamsTypeCERT, RecordListParamsTypeCNAME, RecordListParamsTypeDNSKEY, RecordListParamsTypeDS, RecordListParamsTypeHTTPS, RecordListParamsTypeLOC, RecordListParamsTypeMX, RecordListParamsTypeNAPTR, RecordListParamsTypeNS, RecordListParamsTypePTR, RecordListParamsTypeSMIMEA, RecordListParamsTypeSRV, RecordListParamsTypeSSHFP, RecordListParamsTypeSVCB, RecordListParamsTypeTLSA, RecordListParamsTypeTXT, RecordListParamsTypeURI: + return true + } + return false +} + +type RecordDeleteParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type RecordDeleteResponseEnvelope struct { + Result RecordDeleteResponse `json:"result"` + JSON recordDeleteResponseEnvelopeJSON `json:"-"` +} + +// recordDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [RecordDeleteResponseEnvelope] +type recordDeleteResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// This interface is a union satisfied by one of the following: +// [RecordEditParamsDNSRecordsARecord], [RecordEditParamsDNSRecordsAAAARecord], +// [RecordEditParamsDNSRecordsCAARecord], [RecordEditParamsDNSRecordsCERTRecord], +// [RecordEditParamsDNSRecordsCNAMERecord], +// [RecordEditParamsDNSRecordsDNSKEYRecord], [RecordEditParamsDNSRecordsDSRecord], +// [RecordEditParamsDNSRecordsHTTPSRecord], [RecordEditParamsDNSRecordsLOCRecord], +// [RecordEditParamsDNSRecordsMXRecord], [RecordEditParamsDNSRecordsNAPTRRecord], +// [RecordEditParamsDNSRecordsNSRecord], [RecordEditParamsDNSRecordsPTRRecord], +// [RecordEditParamsDNSRecordsSMIMEARecord], [RecordEditParamsDNSRecordsSRVRecord], +// [RecordEditParamsDNSRecordsSSHFPRecord], [RecordEditParamsDNSRecordsSVCBRecord], +// [RecordEditParamsDNSRecordsTLSARecord], [RecordEditParamsDNSRecordsTXTRecord], +// [RecordEditParamsDNSRecordsURIRecord]. +type RecordEditParams interface { + ImplementsRecordEditParams() + + getZoneID() param.Field[string] +} + +type RecordEditParamsDNSRecordsARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv4 address. + Content param.Field[string] `json:"content,required" format:"ipv4"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsARecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsARecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsARecordType string + +const ( + RecordEditParamsDNSRecordsARecordTypeA RecordEditParamsDNSRecordsARecordType = "A" +) + +func (r RecordEditParamsDNSRecordsARecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsARecordTypeA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsARecordTTLNumber]. +type RecordEditParamsDNSRecordsARecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsARecordTTL() +} + +type RecordEditParamsDNSRecordsARecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsARecordTTLNumber1 RecordEditParamsDNSRecordsARecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsARecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsARecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsAAAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid IPv6 address. + Content param.Field[string] `json:"content,required" format:"ipv6"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsAAAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsAAAARecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsAAAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsAAAARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsAAAARecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsAAAARecordType string + +const ( + RecordEditParamsDNSRecordsAAAARecordTypeAAAA RecordEditParamsDNSRecordsAAAARecordType = "AAAA" +) + +func (r RecordEditParamsDNSRecordsAAAARecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsAAAARecordTypeAAAA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsAAAARecordTTLNumber]. +type RecordEditParamsDNSRecordsAAAARecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsAAAARecordTTL() +} + +type RecordEditParamsDNSRecordsAAAARecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsAAAARecordTTLNumber1 RecordEditParamsDNSRecordsAAAARecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsAAAARecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsAAAARecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsCAARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CAA record. + Data param.Field[RecordEditParamsDNSRecordsCAARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsCAARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsCAARecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsCAARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsCAARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsCAARecord) ImplementsRecordEditParams() { + +} + +// Components of a CAA record. +type RecordEditParamsDNSRecordsCAARecordData struct { + // Flags for the CAA record. + Flags param.Field[float64] `json:"flags"` + // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + Tag param.Field[string] `json:"tag"` + // Value of the record. This field's semantics depend on the chosen tag. + Value param.Field[string] `json:"value"` +} + +func (r RecordEditParamsDNSRecordsCAARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsCAARecordType string + +const ( + RecordEditParamsDNSRecordsCAARecordTypeCAA RecordEditParamsDNSRecordsCAARecordType = "CAA" +) + +func (r RecordEditParamsDNSRecordsCAARecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCAARecordTypeCAA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsCAARecordTTLNumber]. +type RecordEditParamsDNSRecordsCAARecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsCAARecordTTL() +} + +type RecordEditParamsDNSRecordsCAARecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsCAARecordTTLNumber1 RecordEditParamsDNSRecordsCAARecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsCAARecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCAARecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsCERTRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a CERT record. + Data param.Field[RecordEditParamsDNSRecordsCERTRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsCERTRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsCERTRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsCERTRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsCERTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsCERTRecord) ImplementsRecordEditParams() { + +} + +// Components of a CERT record. +type RecordEditParamsDNSRecordsCERTRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Key Tag. + KeyTag param.Field[float64] `json:"key_tag"` + // Type. + Type param.Field[float64] `json:"type"` +} + +func (r RecordEditParamsDNSRecordsCERTRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsCERTRecordType string + +const ( + RecordEditParamsDNSRecordsCERTRecordTypeCERT RecordEditParamsDNSRecordsCERTRecordType = "CERT" +) + +func (r RecordEditParamsDNSRecordsCERTRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCERTRecordTypeCERT: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsCERTRecordTTLNumber]. +type RecordEditParamsDNSRecordsCERTRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsCERTRecordTTL() +} + +type RecordEditParamsDNSRecordsCERTRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsCERTRecordTTLNumber1 RecordEditParamsDNSRecordsCERTRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsCERTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCERTRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsCNAMERecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid hostname. Must not match the record's name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsCNAMERecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsCNAMERecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsCNAMERecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsCNAMERecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsCNAMERecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsCNAMERecordType string + +const ( + RecordEditParamsDNSRecordsCNAMERecordTypeCNAME RecordEditParamsDNSRecordsCNAMERecordType = "CNAME" +) + +func (r RecordEditParamsDNSRecordsCNAMERecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCNAMERecordTypeCNAME: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsCNAMERecordTTLNumber]. +type RecordEditParamsDNSRecordsCNAMERecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsCNAMERecordTTL() +} + +type RecordEditParamsDNSRecordsCNAMERecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsCNAMERecordTTLNumber1 RecordEditParamsDNSRecordsCNAMERecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsCNAMERecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsCNAMERecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsDNSKEYRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DNSKEY record. + Data param.Field[RecordEditParamsDNSRecordsDNSKEYRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsDNSKEYRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsDNSKEYRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsDNSKEYRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsDNSKEYRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsDNSKEYRecord) ImplementsRecordEditParams() { + +} + +// Components of a DNSKEY record. +type RecordEditParamsDNSRecordsDNSKEYRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // Flags. + Flags param.Field[float64] `json:"flags"` + // Protocol. + Protocol param.Field[float64] `json:"protocol"` + // Public Key. + PublicKey param.Field[string] `json:"public_key"` +} + +func (r RecordEditParamsDNSRecordsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsDNSKEYRecordType string + +const ( + RecordEditParamsDNSRecordsDNSKEYRecordTypeDNSKEY RecordEditParamsDNSRecordsDNSKEYRecordType = "DNSKEY" +) + +func (r RecordEditParamsDNSRecordsDNSKEYRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsDNSKEYRecordTypeDNSKEY: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber]. +type RecordEditParamsDNSRecordsDNSKEYRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsDNSKEYRecordTTL() +} + +type RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber1 RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsDNSKEYRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsDSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a DS record. + Data param.Field[RecordEditParamsDNSRecordsDSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsDSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsDSRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsDSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsDSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsDSRecord) ImplementsRecordEditParams() { + +} + +// Components of a DS record. +type RecordEditParamsDNSRecordsDSRecordData struct { + // Algorithm. + Algorithm param.Field[float64] `json:"algorithm"` // Digest. Digest param.Field[string] `json:"digest"` // Digest Type. DigestType param.Field[float64] `json:"digest_type"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // Flags. - Flags param.Field[interface{}] `json:"flags"` // Key Tag. KeyTag param.Field[float64] `json:"key_tag"` +} + +func (r RecordEditParamsDNSRecordsDSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsDSRecordType string + +const ( + RecordEditParamsDNSRecordsDSRecordTypeDS RecordEditParamsDNSRecordsDSRecordType = "DS" +) + +func (r RecordEditParamsDNSRecordsDSRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsDSRecordTypeDS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsDSRecordTTLNumber]. +type RecordEditParamsDNSRecordsDSRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsDSRecordTTL() +} + +type RecordEditParamsDNSRecordsDSRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsDSRecordTTLNumber1 RecordEditParamsDNSRecordsDSRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsDSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsDSRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsHTTPSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a HTTPS record. + Data param.Field[RecordEditParamsDNSRecordsHTTPSRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsHTTPSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsHTTPSRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsHTTPSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsHTTPSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsHTTPSRecord) ImplementsRecordEditParams() { + +} + +// Components of a HTTPS record. +type RecordEditParamsDNSRecordsHTTPSRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r RecordEditParamsDNSRecordsHTTPSRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsHTTPSRecordType string + +const ( + RecordEditParamsDNSRecordsHTTPSRecordTypeHTTPS RecordEditParamsDNSRecordsHTTPSRecordType = "HTTPS" +) + +func (r RecordEditParamsDNSRecordsHTTPSRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsHTTPSRecordTypeHTTPS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsHTTPSRecordTTLNumber]. +type RecordEditParamsDNSRecordsHTTPSRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsHTTPSRecordTTL() +} + +type RecordEditParamsDNSRecordsHTTPSRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsHTTPSRecordTTLNumber1 RecordEditParamsDNSRecordsHTTPSRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsHTTPSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsHTTPSRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsLOCRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a LOC record. + Data param.Field[RecordEditParamsDNSRecordsLOCRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsLOCRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsLOCRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsLOCRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsLOCRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsLOCRecord) ImplementsRecordEditParams() { + +} + +// Components of a LOC record. +type RecordEditParamsDNSRecordsLOCRecordData struct { + // Altitude of location in meters. + Altitude param.Field[float64] `json:"altitude"` // Degrees of latitude. LatDegrees param.Field[float64] `json:"lat_degrees"` // Latitude direction. - LatDirection param.Field[RecordUpdateParamsDataLatDirection] `json:"lat_direction"` + LatDirection param.Field[RecordEditParamsDNSRecordsLOCRecordDataLatDirection] `json:"lat_direction"` // Minutes of latitude. LatMinutes param.Field[float64] `json:"lat_minutes"` // Seconds of latitude. @@ -4242,680 +8404,999 @@ type RecordUpdateParamsData struct { // Degrees of longitude. LongDegrees param.Field[float64] `json:"long_degrees"` // Longitude direction. - LongDirection param.Field[RecordUpdateParamsDataLongDirection] `json:"long_direction"` + LongDirection param.Field[RecordEditParamsDNSRecordsLOCRecordDataLongDirection] `json:"long_direction"` // Minutes of longitude. LongMinutes param.Field[float64] `json:"long_minutes"` // Seconds of longitude. LongSeconds param.Field[float64] `json:"long_seconds"` - // Matching Type. - MatchingType param.Field[float64] `json:"matching_type"` - // A valid hostname. Deprecated in favor of the regular 'name' outside the data - // map. This data map field represents the remainder of the full 'name' after the - // service and protocol. - Name param.Field[string] `json:"name" format:"hostname"` - // Order. - Order param.Field[float64] `json:"order"` - // The port of the service. - Port param.Field[float64] `json:"port"` // Horizontal precision of location. PrecisionHorz param.Field[float64] `json:"precision_horz"` // Vertical precision of location. PrecisionVert param.Field[float64] `json:"precision_vert"` + // Size of location in meters. + Size param.Field[float64] `json:"size"` +} + +func (r RecordEditParamsDNSRecordsLOCRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Latitude direction. +type RecordEditParamsDNSRecordsLOCRecordDataLatDirection string + +const ( + RecordEditParamsDNSRecordsLOCRecordDataLatDirectionN RecordEditParamsDNSRecordsLOCRecordDataLatDirection = "N" + RecordEditParamsDNSRecordsLOCRecordDataLatDirectionS RecordEditParamsDNSRecordsLOCRecordDataLatDirection = "S" +) + +func (r RecordEditParamsDNSRecordsLOCRecordDataLatDirection) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsLOCRecordDataLatDirectionN, RecordEditParamsDNSRecordsLOCRecordDataLatDirectionS: + return true + } + return false +} + +// Longitude direction. +type RecordEditParamsDNSRecordsLOCRecordDataLongDirection string + +const ( + RecordEditParamsDNSRecordsLOCRecordDataLongDirectionE RecordEditParamsDNSRecordsLOCRecordDataLongDirection = "E" + RecordEditParamsDNSRecordsLOCRecordDataLongDirectionW RecordEditParamsDNSRecordsLOCRecordDataLongDirection = "W" +) + +func (r RecordEditParamsDNSRecordsLOCRecordDataLongDirection) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsLOCRecordDataLongDirectionE, RecordEditParamsDNSRecordsLOCRecordDataLongDirectionW: + return true + } + return false +} + +// Record type. +type RecordEditParamsDNSRecordsLOCRecordType string + +const ( + RecordEditParamsDNSRecordsLOCRecordTypeLOC RecordEditParamsDNSRecordsLOCRecordType = "LOC" +) + +func (r RecordEditParamsDNSRecordsLOCRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsLOCRecordTypeLOC: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsLOCRecordTTLNumber]. +type RecordEditParamsDNSRecordsLOCRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsLOCRecordTTL() +} + +type RecordEditParamsDNSRecordsLOCRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsLOCRecordTTLNumber1 RecordEditParamsDNSRecordsLOCRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsLOCRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsLOCRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsMXRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid mail server hostname. + Content param.Field[string] `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsMXRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsMXRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsMXRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsMXRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsMXRecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsMXRecordType string + +const ( + RecordEditParamsDNSRecordsMXRecordTypeMX RecordEditParamsDNSRecordsMXRecordType = "MX" +) + +func (r RecordEditParamsDNSRecordsMXRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsMXRecordTypeMX: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsMXRecordTTLNumber]. +type RecordEditParamsDNSRecordsMXRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsMXRecordTTL() +} + +type RecordEditParamsDNSRecordsMXRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsMXRecordTTLNumber1 RecordEditParamsDNSRecordsMXRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsMXRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsMXRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsNAPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a NAPTR record. + Data param.Field[RecordEditParamsDNSRecordsNAPTRRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsNAPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsNAPTRRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsNAPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsNAPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsNAPTRRecord) ImplementsRecordEditParams() { + +} + +// Components of a NAPTR record. +type RecordEditParamsDNSRecordsNAPTRRecordData struct { + // Flags. + Flags param.Field[string] `json:"flags"` + // Order. + Order param.Field[float64] `json:"order"` // Preference. Preference param.Field[float64] `json:"preference"` - // priority. - Priority param.Field[float64] `json:"priority"` - // A valid protocol, prefixed with an underscore. Deprecated in favor of the - // regular 'name' outside the data map. This data map field normally represents the - // second label of that 'name'. - Proto param.Field[string] `json:"proto"` - // Protocol. - Protocol param.Field[float64] `json:"protocol"` - // Public Key. - PublicKey param.Field[string] `json:"public_key"` // Regex. Regex param.Field[string] `json:"regex"` // Replacement. Replacement param.Field[string] `json:"replacement"` + // Service. + Service param.Field[string] `json:"service"` +} + +func (r RecordEditParamsDNSRecordsNAPTRRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsNAPTRRecordType string + +const ( + RecordEditParamsDNSRecordsNAPTRRecordTypeNAPTR RecordEditParamsDNSRecordsNAPTRRecordType = "NAPTR" +) + +func (r RecordEditParamsDNSRecordsNAPTRRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsNAPTRRecordTypeNAPTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsNAPTRRecordTTLNumber]. +type RecordEditParamsDNSRecordsNAPTRRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsNAPTRRecordTTL() +} + +type RecordEditParamsDNSRecordsNAPTRRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsNAPTRRecordTTLNumber1 RecordEditParamsDNSRecordsNAPTRRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsNAPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsNAPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsNSRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A valid name server host name. + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsNSRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsNSRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsNSRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsNSRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsNSRecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsNSRecordType string + +const ( + RecordEditParamsDNSRecordsNSRecordTypeNS RecordEditParamsDNSRecordsNSRecordType = "NS" +) + +func (r RecordEditParamsDNSRecordsNSRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsNSRecordTypeNS: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsNSRecordTTLNumber]. +type RecordEditParamsDNSRecordsNSRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsNSRecordTTL() +} + +type RecordEditParamsDNSRecordsNSRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsNSRecordTTLNumber1 RecordEditParamsDNSRecordsNSRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsNSRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsNSRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsPTRRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Domain name pointing to the address. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsPTRRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsPTRRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsPTRRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsPTRRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsPTRRecord) ImplementsRecordEditParams() { + +} + +// Record type. +type RecordEditParamsDNSRecordsPTRRecordType string + +const ( + RecordEditParamsDNSRecordsPTRRecordTypePTR RecordEditParamsDNSRecordsPTRRecordType = "PTR" +) + +func (r RecordEditParamsDNSRecordsPTRRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsPTRRecordTypePTR: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsPTRRecordTTLNumber]. +type RecordEditParamsDNSRecordsPTRRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsPTRRecordTTL() +} + +type RecordEditParamsDNSRecordsPTRRecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsPTRRecordTTLNumber1 RecordEditParamsDNSRecordsPTRRecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsPTRRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsPTRRecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsSMIMEARecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SMIMEA record. + Data param.Field[RecordEditParamsDNSRecordsSMIMEARecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsSMIMEARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsSMIMEARecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsSMIMEARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsSMIMEARecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsSMIMEARecord) ImplementsRecordEditParams() { + +} + +// Components of a SMIMEA record. +type RecordEditParamsDNSRecordsSMIMEARecordData struct { + // Certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` // Selector. Selector param.Field[float64] `json:"selector"` - // A service type, prefixed with an underscore. Deprecated in favor of the regular - // 'name' outside the data map. This data map field normally represents the first - // label of that 'name'. - Service param.Field[string] `json:"service"` - // Size of location in meters. - Size param.Field[float64] `json:"size"` - // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). - Tag param.Field[string] `json:"tag"` - // target. - Target param.Field[string] `json:"target"` - // type. - Type param.Field[float64] `json:"type"` // Usage. Usage param.Field[float64] `json:"usage"` - // value. - Value param.Field[string] `json:"value"` +} + +func (r RecordEditParamsDNSRecordsSMIMEARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Record type. +type RecordEditParamsDNSRecordsSMIMEARecordType string + +const ( + RecordEditParamsDNSRecordsSMIMEARecordTypeSMIMEA RecordEditParamsDNSRecordsSMIMEARecordType = "SMIMEA" +) + +func (r RecordEditParamsDNSRecordsSMIMEARecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsSMIMEARecordTypeSMIMEA: + return true + } + return false +} + +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsSMIMEARecordTTLNumber]. +type RecordEditParamsDNSRecordsSMIMEARecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsSMIMEARecordTTL() +} + +type RecordEditParamsDNSRecordsSMIMEARecordTTLNumber float64 + +const ( + RecordEditParamsDNSRecordsSMIMEARecordTTLNumber1 RecordEditParamsDNSRecordsSMIMEARecordTTLNumber = 1 +) + +func (r RecordEditParamsDNSRecordsSMIMEARecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsSMIMEARecordTTLNumber1: + return true + } + return false +} + +type RecordEditParamsDNSRecordsSRVRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SRV record. + Data param.Field[RecordEditParamsDNSRecordsSRVRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first + // label is normally a service and the second a protocol name, each starting with + // an underscore. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsSRVRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsSRVRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsSRVRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsSRVRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsSRVRecord) ImplementsRecordEditParams() { + +} + +// Components of a SRV record. +type RecordEditParamsDNSRecordsSRVRecordData struct { + // A valid hostname. Deprecated in favor of the regular 'name' outside the data + // map. This data map field represents the remainder of the full 'name' after the + // service and protocol. + Name param.Field[string] `json:"name" format:"hostname"` + // The port of the service. + Port param.Field[float64] `json:"port"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority"` + // A valid protocol, prefixed with an underscore. Deprecated in favor of the + // regular 'name' outside the data map. This data map field normally represents the + // second label of that 'name'. + Proto param.Field[string] `json:"proto"` + // A service type, prefixed with an underscore. Deprecated in favor of the regular + // 'name' outside the data map. This data map field normally represents the first + // label of that 'name'. + Service param.Field[string] `json:"service"` + // A valid hostname. + Target param.Field[string] `json:"target" format:"hostname"` // The record weight. Weight param.Field[float64] `json:"weight"` } -func (r RecordUpdateParamsData) MarshalJSON() (data []byte, err error) { +func (r RecordEditParamsDNSRecordsSRVRecordData) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Latitude direction. -type RecordUpdateParamsDataLatDirection string +// Record type. +type RecordEditParamsDNSRecordsSRVRecordType string const ( - RecordUpdateParamsDataLatDirectionN RecordUpdateParamsDataLatDirection = "N" - RecordUpdateParamsDataLatDirectionS RecordUpdateParamsDataLatDirection = "S" + RecordEditParamsDNSRecordsSRVRecordTypeSRV RecordEditParamsDNSRecordsSRVRecordType = "SRV" ) -func (r RecordUpdateParamsDataLatDirection) IsKnown() bool { +func (r RecordEditParamsDNSRecordsSRVRecordType) IsKnown() bool { switch r { - case RecordUpdateParamsDataLatDirectionN, RecordUpdateParamsDataLatDirectionS: + case RecordEditParamsDNSRecordsSRVRecordTypeSRV: return true } return false } -// Longitude direction. -type RecordUpdateParamsDataLongDirection string +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsSRVRecordTTLNumber]. +type RecordEditParamsDNSRecordsSRVRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsSRVRecordTTL() +} + +type RecordEditParamsDNSRecordsSRVRecordTTLNumber float64 const ( - RecordUpdateParamsDataLongDirectionE RecordUpdateParamsDataLongDirection = "E" - RecordUpdateParamsDataLongDirectionW RecordUpdateParamsDataLongDirection = "W" + RecordEditParamsDNSRecordsSRVRecordTTLNumber1 RecordEditParamsDNSRecordsSRVRecordTTLNumber = 1 ) -func (r RecordUpdateParamsDataLongDirection) IsKnown() bool { +func (r RecordEditParamsDNSRecordsSRVRecordTTLNumber) IsKnown() bool { switch r { - case RecordUpdateParamsDataLongDirectionE, RecordUpdateParamsDataLongDirectionW: + case RecordEditParamsDNSRecordsSRVRecordTTLNumber1: return true } return false } -type RecordUpdateParamsMeta struct { - // Will exist if Cloudflare automatically added this DNS record during initial - // setup. - AutoAdded param.Field[bool] `json:"auto_added"` - // Where the record originated from. - Source param.Field[string] `json:"source"` +type RecordEditParamsDNSRecordsSSHFPRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SSHFP record. + Data param.Field[RecordEditParamsDNSRecordsSSHFPRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsSSHFPRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsSSHFPRecordTTL] `json:"ttl"` +} + +func (r RecordEditParamsDNSRecordsSSHFPRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordEditParamsDNSRecordsSSHFPRecord) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RecordEditParamsDNSRecordsSSHFPRecord) ImplementsRecordEditParams() { + +} + +// Components of a SSHFP record. +type RecordEditParamsDNSRecordsSSHFPRecordData struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` } -func (r RecordUpdateParamsMeta) MarshalJSON() (data []byte, err error) { +func (r RecordEditParamsDNSRecordsSSHFPRecordData) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Record type. +type RecordEditParamsDNSRecordsSSHFPRecordType string + +const ( + RecordEditParamsDNSRecordsSSHFPRecordTypeSSHFP RecordEditParamsDNSRecordsSSHFPRecordType = "SSHFP" +) + +func (r RecordEditParamsDNSRecordsSSHFPRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsSSHFPRecordTypeSSHFP: + return true + } + return false +} + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. // -// Satisfied by [shared.UnionFloat], [dns.RecordUpdateParamsTTLNumber]. -type RecordUpdateParamsTTL interface { - ImplementsDNSRecordUpdateParamsTTL() +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsSSHFPRecordTTLNumber]. +type RecordEditParamsDNSRecordsSSHFPRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsSSHFPRecordTTL() } -type RecordUpdateParamsTTLNumber float64 +type RecordEditParamsDNSRecordsSSHFPRecordTTLNumber float64 const ( - RecordUpdateParamsTTLNumber1 RecordUpdateParamsTTLNumber = 1 + RecordEditParamsDNSRecordsSSHFPRecordTTLNumber1 RecordEditParamsDNSRecordsSSHFPRecordTTLNumber = 1 ) -func (r RecordUpdateParamsTTLNumber) IsKnown() bool { +func (r RecordEditParamsDNSRecordsSSHFPRecordTTLNumber) IsKnown() bool { switch r { - case RecordUpdateParamsTTLNumber1: + case RecordEditParamsDNSRecordsSSHFPRecordTTLNumber1: return true } return false } -type RecordUpdateResponseEnvelope struct { - Errors []RecordUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []RecordUpdateResponseEnvelopeMessages `json:"messages,required"` - Result DNSRecord `json:"result,required"` - // Whether the API call was successful - Success RecordUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON recordUpdateResponseEnvelopeJSON `json:"-"` -} - -// recordUpdateResponseEnvelopeJSON contains the JSON metadata for the struct -// [RecordUpdateResponseEnvelope] -type recordUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field +type RecordEditParamsDNSRecordsSVCBRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a SVCB record. + Data param.Field[RecordEditParamsDNSRecordsSVCBRecordData] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsSVCBRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsSVCBRecordTTL] `json:"ttl"` } -func (r *RecordUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RecordEditParamsDNSRecordsSVCBRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r recordUpdateResponseEnvelopeJSON) RawJSON() string { - return r.raw +func (r RecordEditParamsDNSRecordsSVCBRecord) getZoneID() param.Field[string] { + return r.ZoneID } -type RecordUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON recordUpdateResponseEnvelopeErrorsJSON `json:"-"` -} +func (RecordEditParamsDNSRecordsSVCBRecord) ImplementsRecordEditParams() { -// recordUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [RecordUpdateResponseEnvelopeErrors] -type recordUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field } -func (r *RecordUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// Components of a SVCB record. +type RecordEditParamsDNSRecordsSVCBRecordData struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` } -func (r recordUpdateResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw +func (r RecordEditParamsDNSRecordsSVCBRecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RecordUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON recordUpdateResponseEnvelopeMessagesJSON `json:"-"` -} +// Record type. +type RecordEditParamsDNSRecordsSVCBRecordType string -// recordUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [RecordUpdateResponseEnvelopeMessages] -type recordUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +const ( + RecordEditParamsDNSRecordsSVCBRecordTypeSVCB RecordEditParamsDNSRecordsSVCBRecordType = "SVCB" +) -func (r *RecordUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RecordEditParamsDNSRecordsSVCBRecordType) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsSVCBRecordTypeSVCB: + return true + } + return false } -func (r recordUpdateResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsSVCBRecordTTLNumber]. +type RecordEditParamsDNSRecordsSVCBRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsSVCBRecordTTL() } -// Whether the API call was successful -type RecordUpdateResponseEnvelopeSuccess bool +type RecordEditParamsDNSRecordsSVCBRecordTTLNumber float64 const ( - RecordUpdateResponseEnvelopeSuccessTrue RecordUpdateResponseEnvelopeSuccess = true + RecordEditParamsDNSRecordsSVCBRecordTTLNumber1 RecordEditParamsDNSRecordsSVCBRecordTTLNumber = 1 ) -func (r RecordUpdateResponseEnvelopeSuccess) IsKnown() bool { +func (r RecordEditParamsDNSRecordsSVCBRecordTTLNumber) IsKnown() bool { switch r { - case RecordUpdateResponseEnvelopeSuccessTrue: + case RecordEditParamsDNSRecordsSVCBRecordTTLNumber1: return true } return false } -type RecordListParams struct { +type RecordEditParamsDNSRecordsTLSARecord struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Comment param.Field[RecordListParamsComment] `query:"comment"` - // DNS record content. - Content param.Field[string] `query:"content"` - // Direction to order DNS records in. - Direction param.Field[RecordListParamsDirection] `query:"direction"` - // Whether to match all search requirements or at least one (any). If set to `all`, - // acts like a logical AND between filters. If set to `any`, acts like a logical OR - // instead. Note that the interaction between tag filters is controlled by the - // `tag-match` parameter instead. - Match param.Field[RecordListParamsMatch] `query:"match"` + ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a TLSA record. + Data param.Field[RecordEditParamsDNSRecordsTLSARecordData] `json:"data,required"` // DNS record name (or @ for the zone apex) in Punycode. - Name param.Field[string] `query:"name"` - // Field to order DNS records by. - Order param.Field[RecordListParamsOrder] `query:"order"` - // Page number of paginated results. - Page param.Field[float64] `query:"page"` - // Number of DNS records per page. - PerPage param.Field[float64] `query:"per_page"` - // Whether the record is receiving the performance and security benefits of - // Cloudflare. - Proxied param.Field[bool] `query:"proxied"` - // Allows searching in multiple properties of a DNS record simultaneously. This - // parameter is intended for human users, not automation. Its exact behavior is - // intentionally left unspecified and is subject to change in the future. This - // parameter works independently of the `match` setting. For automated searches, - // please use the other available parameters. - Search param.Field[string] `query:"search"` - Tag param.Field[RecordListParamsTag] `query:"tag"` - // Whether to match all tag search requirements or at least one (any). If set to - // `all`, acts like a logical AND between tag filters. If set to `any`, acts like a - // logical OR instead. Note that the regular `match` parameter is still used to - // combine the resulting condition with other filters that aren't related to tags. - TagMatch param.Field[RecordListParamsTagMatch] `query:"tag_match"` + Name param.Field[string] `json:"name,required"` // Record type. - Type param.Field[RecordListParamsType] `query:"type"` + Type param.Field[RecordEditParamsDNSRecordsTLSARecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsTLSARecordTTL] `json:"ttl"` } -// URLQuery serializes [RecordListParams]'s query parameters as `url.Values`. -func (r RecordListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) +func (r RecordEditParamsDNSRecordsTLSARecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type RecordListParamsComment struct { - // If this parameter is present, only records _without_ a comment are returned. - Absent param.Field[string] `query:"absent"` - // Substring of the DNS record comment. Comment filters are case-insensitive. - Contains param.Field[string] `query:"contains"` - // Suffix of the DNS record comment. Comment filters are case-insensitive. - Endswith param.Field[string] `query:"endswith"` - // Exact value of the DNS record comment. Comment filters are case-insensitive. - Exact param.Field[string] `query:"exact"` - // If this parameter is present, only records _with_ a comment are returned. - Present param.Field[string] `query:"present"` - // Prefix of the DNS record comment. Comment filters are case-insensitive. - Startswith param.Field[string] `query:"startswith"` +func (r RecordEditParamsDNSRecordsTLSARecord) getZoneID() param.Field[string] { + return r.ZoneID } -// URLQuery serializes [RecordListParamsComment]'s query parameters as -// `url.Values`. -func (r RecordListParamsComment) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} +func (RecordEditParamsDNSRecordsTLSARecord) ImplementsRecordEditParams() { -// Direction to order DNS records in. -type RecordListParamsDirection string +} -const ( - RecordListParamsDirectionAsc RecordListParamsDirection = "asc" - RecordListParamsDirectionDesc RecordListParamsDirection = "desc" -) +// Components of a TLSA record. +type RecordEditParamsDNSRecordsTLSARecordData struct { + // certificate. + Certificate param.Field[string] `json:"certificate"` + // Matching Type. + MatchingType param.Field[float64] `json:"matching_type"` + // Selector. + Selector param.Field[float64] `json:"selector"` + // Usage. + Usage param.Field[float64] `json:"usage"` +} -func (r RecordListParamsDirection) IsKnown() bool { - switch r { - case RecordListParamsDirectionAsc, RecordListParamsDirectionDesc: - return true - } - return false +func (r RecordEditParamsDNSRecordsTLSARecordData) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Whether to match all search requirements or at least one (any). If set to `all`, -// acts like a logical AND between filters. If set to `any`, acts like a logical OR -// instead. Note that the interaction between tag filters is controlled by the -// `tag-match` parameter instead. -type RecordListParamsMatch string +// Record type. +type RecordEditParamsDNSRecordsTLSARecordType string const ( - RecordListParamsMatchAny RecordListParamsMatch = "any" - RecordListParamsMatchAll RecordListParamsMatch = "all" + RecordEditParamsDNSRecordsTLSARecordTypeTLSA RecordEditParamsDNSRecordsTLSARecordType = "TLSA" ) -func (r RecordListParamsMatch) IsKnown() bool { +func (r RecordEditParamsDNSRecordsTLSARecordType) IsKnown() bool { switch r { - case RecordListParamsMatchAny, RecordListParamsMatchAll: + case RecordEditParamsDNSRecordsTLSARecordTypeTLSA: return true } return false } -// Field to order DNS records by. -type RecordListParamsOrder string +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsTLSARecordTTLNumber]. +type RecordEditParamsDNSRecordsTLSARecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsTLSARecordTTL() +} + +type RecordEditParamsDNSRecordsTLSARecordTTLNumber float64 const ( - RecordListParamsOrderType RecordListParamsOrder = "type" - RecordListParamsOrderName RecordListParamsOrder = "name" - RecordListParamsOrderContent RecordListParamsOrder = "content" - RecordListParamsOrderTTL RecordListParamsOrder = "ttl" - RecordListParamsOrderProxied RecordListParamsOrder = "proxied" + RecordEditParamsDNSRecordsTLSARecordTTLNumber1 RecordEditParamsDNSRecordsTLSARecordTTLNumber = 1 ) -func (r RecordListParamsOrder) IsKnown() bool { +func (r RecordEditParamsDNSRecordsTLSARecordTTLNumber) IsKnown() bool { switch r { - case RecordListParamsOrderType, RecordListParamsOrderName, RecordListParamsOrderContent, RecordListParamsOrderTTL, RecordListParamsOrderProxied: + case RecordEditParamsDNSRecordsTLSARecordTTLNumber1: return true } return false } -type RecordListParamsTag struct { - // Name of a tag which must _not_ be present on the DNS record. Tag filters are - // case-insensitive. - Absent param.Field[string] `query:"absent"` - // A tag and value, of the form `:`. The API will only return - // DNS records that have a tag named `` whose value contains - // ``. Tag filters are case-insensitive. - Contains param.Field[string] `query:"contains"` - // A tag and value, of the form `:`. The API will only return - // DNS records that have a tag named `` whose value ends with - // ``. Tag filters are case-insensitive. - Endswith param.Field[string] `query:"endswith"` - // A tag and value, of the form `:`. The API will only return - // DNS records that have a tag named `` whose value is ``. Tag - // filters are case-insensitive. - Exact param.Field[string] `query:"exact"` - // Name of a tag which must be present on the DNS record. Tag filters are - // case-insensitive. - Present param.Field[string] `query:"present"` - // A tag and value, of the form `:`. The API will only return - // DNS records that have a tag named `` whose value starts with - // ``. Tag filters are case-insensitive. - Startswith param.Field[string] `query:"startswith"` +type RecordEditParamsDNSRecordsTXTRecord struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Text content for the record. + Content param.Field[string] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Record type. + Type param.Field[RecordEditParamsDNSRecordsTXTRecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]string] `json:"tags"` + // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + // Value must be between 60 and 86400, with the minimum reduced to 30 for + // Enterprise zones. + TTL param.Field[RecordEditParamsDNSRecordsTXTRecordTTL] `json:"ttl"` } -// URLQuery serializes [RecordListParamsTag]'s query parameters as `url.Values`. -func (r RecordListParamsTag) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) +func (r RecordEditParamsDNSRecordsTXTRecord) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Whether to match all tag search requirements or at least one (any). If set to -// `all`, acts like a logical AND between tag filters. If set to `any`, acts like a -// logical OR instead. Note that the regular `match` parameter is still used to -// combine the resulting condition with other filters that aren't related to tags. -type RecordListParamsTagMatch string +func (r RecordEditParamsDNSRecordsTXTRecord) getZoneID() param.Field[string] { + return r.ZoneID +} -const ( - RecordListParamsTagMatchAny RecordListParamsTagMatch = "any" - RecordListParamsTagMatchAll RecordListParamsTagMatch = "all" -) +func (RecordEditParamsDNSRecordsTXTRecord) ImplementsRecordEditParams() { -func (r RecordListParamsTagMatch) IsKnown() bool { - switch r { - case RecordListParamsTagMatchAny, RecordListParamsTagMatchAll: - return true - } - return false } // Record type. -type RecordListParamsType string +type RecordEditParamsDNSRecordsTXTRecordType string const ( - RecordListParamsTypeA RecordListParamsType = "A" - RecordListParamsTypeAAAA RecordListParamsType = "AAAA" - RecordListParamsTypeCAA RecordListParamsType = "CAA" - RecordListParamsTypeCERT RecordListParamsType = "CERT" - RecordListParamsTypeCNAME RecordListParamsType = "CNAME" - RecordListParamsTypeDNSKEY RecordListParamsType = "DNSKEY" - RecordListParamsTypeDS RecordListParamsType = "DS" - RecordListParamsTypeHTTPS RecordListParamsType = "HTTPS" - RecordListParamsTypeLOC RecordListParamsType = "LOC" - RecordListParamsTypeMX RecordListParamsType = "MX" - RecordListParamsTypeNAPTR RecordListParamsType = "NAPTR" - RecordListParamsTypeNS RecordListParamsType = "NS" - RecordListParamsTypePTR RecordListParamsType = "PTR" - RecordListParamsTypeSMIMEA RecordListParamsType = "SMIMEA" - RecordListParamsTypeSRV RecordListParamsType = "SRV" - RecordListParamsTypeSSHFP RecordListParamsType = "SSHFP" - RecordListParamsTypeSVCB RecordListParamsType = "SVCB" - RecordListParamsTypeTLSA RecordListParamsType = "TLSA" - RecordListParamsTypeTXT RecordListParamsType = "TXT" - RecordListParamsTypeURI RecordListParamsType = "URI" + RecordEditParamsDNSRecordsTXTRecordTypeTXT RecordEditParamsDNSRecordsTXTRecordType = "TXT" ) -func (r RecordListParamsType) IsKnown() bool { +func (r RecordEditParamsDNSRecordsTXTRecordType) IsKnown() bool { switch r { - case RecordListParamsTypeA, RecordListParamsTypeAAAA, RecordListParamsTypeCAA, RecordListParamsTypeCERT, RecordListParamsTypeCNAME, RecordListParamsTypeDNSKEY, RecordListParamsTypeDS, RecordListParamsTypeHTTPS, RecordListParamsTypeLOC, RecordListParamsTypeMX, RecordListParamsTypeNAPTR, RecordListParamsTypeNS, RecordListParamsTypePTR, RecordListParamsTypeSMIMEA, RecordListParamsTypeSRV, RecordListParamsTypeSSHFP, RecordListParamsTypeSVCB, RecordListParamsTypeTLSA, RecordListParamsTypeTXT, RecordListParamsTypeURI: + case RecordEditParamsDNSRecordsTXTRecordTypeTXT: return true } return false } -type RecordDeleteParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type RecordDeleteResponseEnvelope struct { - Result RecordDeleteResponse `json:"result"` - JSON recordDeleteResponseEnvelopeJSON `json:"-"` +// Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. +// Value must be between 60 and 86400, with the minimum reduced to 30 for +// Enterprise zones. +// +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsTXTRecordTTLNumber]. +type RecordEditParamsDNSRecordsTXTRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsTXTRecordTTL() } -// recordDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [RecordDeleteResponseEnvelope] -type recordDeleteResponseEnvelopeJSON struct { - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +type RecordEditParamsDNSRecordsTXTRecordTTLNumber float64 -func (r *RecordDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + RecordEditParamsDNSRecordsTXTRecordTTLNumber1 RecordEditParamsDNSRecordsTXTRecordTTLNumber = 1 +) -func (r recordDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw +func (r RecordEditParamsDNSRecordsTXTRecordTTLNumber) IsKnown() bool { + switch r { + case RecordEditParamsDNSRecordsTXTRecordTTLNumber1: + return true + } + return false } -type RecordEditParams struct { +type RecordEditParamsDNSRecordsURIRecord struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` + // Components of a URI record. + Data param.Field[RecordEditParamsDNSRecordsURIRecordData] `json:"data,required"` // DNS record name (or @ for the zone apex) in Punycode. Name param.Field[string] `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority param.Field[float64] `json:"priority,required"` // Record type. - Type param.Field[RecordEditParamsType] `json:"type,required"` + Type param.Field[RecordEditParamsDNSRecordsURIRecordType] `json:"type,required"` // Comments or notes about the DNS record. This field has no effect on DNS // responses. Comment param.Field[string] `json:"comment"` - // Formatted URI content. See 'data' to set URI properties. - Content param.Field[interface{}] `json:"content"` - Data param.Field[RecordEditParamsData] `json:"data"` - Meta param.Field[RecordEditParamsMeta] `json:"meta"` - // Required for MX, SRV and URI records; unused by other record types. Records with - // lower priorities are preferred. - Priority param.Field[float64] `json:"priority"` - // Whether the record is receiving the performance and security benefits of - // Cloudflare. - Proxied param.Field[bool] `json:"proxied"` // Custom tags for the DNS record. This field has no effect on DNS responses. Tags param.Field[[]string] `json:"tags"` // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. - TTL param.Field[RecordEditParamsTTL] `json:"ttl"` + TTL param.Field[RecordEditParamsDNSRecordsURIRecordTTL] `json:"ttl"` } -func (r RecordEditParams) MarshalJSON() (data []byte, err error) { +func (r RecordEditParamsDNSRecordsURIRecord) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Record type. -type RecordEditParamsType string +func (r RecordEditParamsDNSRecordsURIRecord) getZoneID() param.Field[string] { + return r.ZoneID +} -const ( - RecordEditParamsTypeURI RecordEditParamsType = "URI" - RecordEditParamsTypeTXT RecordEditParamsType = "TXT" - RecordEditParamsTypeTLSA RecordEditParamsType = "TLSA" - RecordEditParamsTypeSVCB RecordEditParamsType = "SVCB" - RecordEditParamsTypeSSHFP RecordEditParamsType = "SSHFP" - RecordEditParamsTypeSRV RecordEditParamsType = "SRV" - RecordEditParamsTypeSMIMEA RecordEditParamsType = "SMIMEA" - RecordEditParamsTypePTR RecordEditParamsType = "PTR" - RecordEditParamsTypeNS RecordEditParamsType = "NS" - RecordEditParamsTypeNAPTR RecordEditParamsType = "NAPTR" - RecordEditParamsTypeMX RecordEditParamsType = "MX" - RecordEditParamsTypeLOC RecordEditParamsType = "LOC" - RecordEditParamsTypeHTTPS RecordEditParamsType = "HTTPS" - RecordEditParamsTypeDS RecordEditParamsType = "DS" - RecordEditParamsTypeDNSKEY RecordEditParamsType = "DNSKEY" - RecordEditParamsTypeCNAME RecordEditParamsType = "CNAME" - RecordEditParamsTypeCERT RecordEditParamsType = "CERT" - RecordEditParamsTypeCAA RecordEditParamsType = "CAA" - RecordEditParamsTypeAAAA RecordEditParamsType = "AAAA" - RecordEditParamsTypeA RecordEditParamsType = "A" -) +func (RecordEditParamsDNSRecordsURIRecord) ImplementsRecordEditParams() { -func (r RecordEditParamsType) IsKnown() bool { - switch r { - case RecordEditParamsTypeURI, RecordEditParamsTypeTXT, RecordEditParamsTypeTLSA, RecordEditParamsTypeSVCB, RecordEditParamsTypeSSHFP, RecordEditParamsTypeSRV, RecordEditParamsTypeSMIMEA, RecordEditParamsTypePTR, RecordEditParamsTypeNS, RecordEditParamsTypeNAPTR, RecordEditParamsTypeMX, RecordEditParamsTypeLOC, RecordEditParamsTypeHTTPS, RecordEditParamsTypeDS, RecordEditParamsTypeDNSKEY, RecordEditParamsTypeCNAME, RecordEditParamsTypeCERT, RecordEditParamsTypeCAA, RecordEditParamsTypeAAAA, RecordEditParamsTypeA: - return true - } - return false } -type RecordEditParamsData struct { - // algorithm. - Algorithm param.Field[float64] `json:"algorithm"` - // Altitude of location in meters. - Altitude param.Field[float64] `json:"altitude"` - // certificate. - Certificate param.Field[string] `json:"certificate"` +// Components of a URI record. +type RecordEditParamsDNSRecordsURIRecordData struct { // The record content. Content param.Field[string] `json:"content"` - // Digest. - Digest param.Field[string] `json:"digest"` - // Digest Type. - DigestType param.Field[float64] `json:"digest_type"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // Flags. - Flags param.Field[interface{}] `json:"flags"` - // Key Tag. - KeyTag param.Field[float64] `json:"key_tag"` - // Degrees of latitude. - LatDegrees param.Field[float64] `json:"lat_degrees"` - // Latitude direction. - LatDirection param.Field[RecordEditParamsDataLatDirection] `json:"lat_direction"` - // Minutes of latitude. - LatMinutes param.Field[float64] `json:"lat_minutes"` - // Seconds of latitude. - LatSeconds param.Field[float64] `json:"lat_seconds"` - // Degrees of longitude. - LongDegrees param.Field[float64] `json:"long_degrees"` - // Longitude direction. - LongDirection param.Field[RecordEditParamsDataLongDirection] `json:"long_direction"` - // Minutes of longitude. - LongMinutes param.Field[float64] `json:"long_minutes"` - // Seconds of longitude. - LongSeconds param.Field[float64] `json:"long_seconds"` - // Matching Type. - MatchingType param.Field[float64] `json:"matching_type"` - // A valid hostname. Deprecated in favor of the regular 'name' outside the data - // map. This data map field represents the remainder of the full 'name' after the - // service and protocol. - Name param.Field[string] `json:"name" format:"hostname"` - // Order. - Order param.Field[float64] `json:"order"` - // The port of the service. - Port param.Field[float64] `json:"port"` - // Horizontal precision of location. - PrecisionHorz param.Field[float64] `json:"precision_horz"` - // Vertical precision of location. - PrecisionVert param.Field[float64] `json:"precision_vert"` - // Preference. - Preference param.Field[float64] `json:"preference"` - // priority. - Priority param.Field[float64] `json:"priority"` - // A valid protocol, prefixed with an underscore. Deprecated in favor of the - // regular 'name' outside the data map. This data map field normally represents the - // second label of that 'name'. - Proto param.Field[string] `json:"proto"` - // Protocol. - Protocol param.Field[float64] `json:"protocol"` - // Public Key. - PublicKey param.Field[string] `json:"public_key"` - // Regex. - Regex param.Field[string] `json:"regex"` - // Replacement. - Replacement param.Field[string] `json:"replacement"` - // Selector. - Selector param.Field[float64] `json:"selector"` - // A service type, prefixed with an underscore. Deprecated in favor of the regular - // 'name' outside the data map. This data map field normally represents the first - // label of that 'name'. - Service param.Field[string] `json:"service"` - // Size of location in meters. - Size param.Field[float64] `json:"size"` - // Name of the property controlled by this record (e.g.: issue, issuewild, iodef). - Tag param.Field[string] `json:"tag"` - // target. - Target param.Field[string] `json:"target"` - // type. - Type param.Field[float64] `json:"type"` - // Usage. - Usage param.Field[float64] `json:"usage"` - // value. - Value param.Field[string] `json:"value"` // The record weight. Weight param.Field[float64] `json:"weight"` } -func (r RecordEditParamsData) MarshalJSON() (data []byte, err error) { +func (r RecordEditParamsDNSRecordsURIRecordData) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Latitude direction. -type RecordEditParamsDataLatDirection string - -const ( - RecordEditParamsDataLatDirectionN RecordEditParamsDataLatDirection = "N" - RecordEditParamsDataLatDirectionS RecordEditParamsDataLatDirection = "S" -) - -func (r RecordEditParamsDataLatDirection) IsKnown() bool { - switch r { - case RecordEditParamsDataLatDirectionN, RecordEditParamsDataLatDirectionS: - return true - } - return false -} - -// Longitude direction. -type RecordEditParamsDataLongDirection string +// Record type. +type RecordEditParamsDNSRecordsURIRecordType string const ( - RecordEditParamsDataLongDirectionE RecordEditParamsDataLongDirection = "E" - RecordEditParamsDataLongDirectionW RecordEditParamsDataLongDirection = "W" + RecordEditParamsDNSRecordsURIRecordTypeURI RecordEditParamsDNSRecordsURIRecordType = "URI" ) -func (r RecordEditParamsDataLongDirection) IsKnown() bool { +func (r RecordEditParamsDNSRecordsURIRecordType) IsKnown() bool { switch r { - case RecordEditParamsDataLongDirectionE, RecordEditParamsDataLongDirectionW: + case RecordEditParamsDNSRecordsURIRecordTypeURI: return true } return false } -type RecordEditParamsMeta struct { - // Will exist if Cloudflare automatically added this DNS record during initial - // setup. - AutoAdded param.Field[bool] `json:"auto_added"` - // Where the record originated from. - Source param.Field[string] `json:"source"` -} - -func (r RecordEditParamsMeta) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. // Value must be between 60 and 86400, with the minimum reduced to 30 for // Enterprise zones. // -// Satisfied by [shared.UnionFloat], [dns.RecordEditParamsTTLNumber]. -type RecordEditParamsTTL interface { - ImplementsDNSRecordEditParamsTTL() +// Satisfied by [shared.UnionFloat], +// [dns.RecordEditParamsDNSRecordsURIRecordTTLNumber]. +type RecordEditParamsDNSRecordsURIRecordTTL interface { + ImplementsDNSRecordEditParamsDNSRecordsURIRecordTTL() } -type RecordEditParamsTTLNumber float64 +type RecordEditParamsDNSRecordsURIRecordTTLNumber float64 const ( - RecordEditParamsTTLNumber1 RecordEditParamsTTLNumber = 1 + RecordEditParamsDNSRecordsURIRecordTTLNumber1 RecordEditParamsDNSRecordsURIRecordTTLNumber = 1 ) -func (r RecordEditParamsTTLNumber) IsKnown() bool { +func (r RecordEditParamsDNSRecordsURIRecordTTLNumber) IsKnown() bool { switch r { - case RecordEditParamsTTLNumber1: + case RecordEditParamsDNSRecordsURIRecordTTLNumber1: return true } return false diff --git a/dns/record_test.go b/dns/record_test.go index fb0bc3ec4d0..4c59b3222f8 100644 --- a/dns/record_test.go +++ b/dns/record_test.go @@ -29,61 +29,15 @@ func TestRecordNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParams{ + _, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParamsDNSRecordsARecord{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Content: cloudflare.F("198.51.100.4"), Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordNewParamsTypeURI), + Type: cloudflare.F(dns.RecordNewParamsDNSRecordsARecordTypeA), Comment: cloudflare.F("Domain verification record"), - Content: cloudflare.F[any](map[string]interface{}{}), - Data: cloudflare.F(dns.RecordNewParamsData{ - Flags: cloudflare.F[any](map[string]interface{}{}), - Tag: cloudflare.F("issue"), - Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""), - Algorithm: cloudflare.F(2.000000), - Certificate: cloudflare.F("string"), - KeyTag: cloudflare.F(1.000000), - Type: cloudflare.F(1.000000), - Protocol: cloudflare.F(3.000000), - PublicKey: cloudflare.F("string"), - Digest: cloudflare.F("string"), - DigestType: cloudflare.F(1.000000), - Priority: cloudflare.F(1.000000), - Target: cloudflare.F("."), - Altitude: cloudflare.F(0.000000), - LatDegrees: cloudflare.F(37.000000), - LatDirection: cloudflare.F(dns.RecordNewParamsDataLatDirectionN), - LatMinutes: cloudflare.F(46.000000), - LatSeconds: cloudflare.F(46.000000), - LongDegrees: cloudflare.F(122.000000), - LongDirection: cloudflare.F(dns.RecordNewParamsDataLongDirectionW), - LongMinutes: cloudflare.F(23.000000), - LongSeconds: cloudflare.F(35.000000), - PrecisionHorz: cloudflare.F(0.000000), - PrecisionVert: cloudflare.F(0.000000), - Size: cloudflare.F(100.000000), - Order: cloudflare.F(100.000000), - Preference: cloudflare.F(10.000000), - Regex: cloudflare.F("string"), - Replacement: cloudflare.F("string"), - Service: cloudflare.F("_sip"), - MatchingType: cloudflare.F(1.000000), - Selector: cloudflare.F(0.000000), - Usage: cloudflare.F(0.000000), - Name: cloudflare.F("example.com"), - Port: cloudflare.F(8806.000000), - Proto: cloudflare.F("_tcp"), - Weight: cloudflare.F(20.000000), - Fingerprint: cloudflare.F("string"), - Content: cloudflare.F("http://example.com/example.html"), - }), - Meta: cloudflare.F(dns.RecordNewParamsMeta{ - AutoAdded: cloudflare.F(true), - Source: cloudflare.F("primary"), - }), - Priority: cloudflare.F(10.000000), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.RecordNewParamsTTL](shared.UnionFloat(3600.000000)), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.RecordNewParamsDNSRecordsARecordTTL](shared.UnionFloat(3600.000000)), }) if err != nil { var apierr *cloudflare.Error @@ -111,61 +65,15 @@ func TestRecordUpdateWithOptionalParams(t *testing.T) { _, err := client.DNS.Records.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - dns.RecordUpdateParams{ + dns.RecordUpdateParamsDNSRecordsARecord{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Content: cloudflare.F("198.51.100.4"), Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordUpdateParamsTypeURI), + Type: cloudflare.F(dns.RecordUpdateParamsDNSRecordsARecordTypeA), Comment: cloudflare.F("Domain verification record"), - Content: cloudflare.F[any](map[string]interface{}{}), - Data: cloudflare.F(dns.RecordUpdateParamsData{ - Flags: cloudflare.F[any](map[string]interface{}{}), - Tag: cloudflare.F("issue"), - Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""), - Algorithm: cloudflare.F(2.000000), - Certificate: cloudflare.F("string"), - KeyTag: cloudflare.F(1.000000), - Type: cloudflare.F(1.000000), - Protocol: cloudflare.F(3.000000), - PublicKey: cloudflare.F("string"), - Digest: cloudflare.F("string"), - DigestType: cloudflare.F(1.000000), - Priority: cloudflare.F(1.000000), - Target: cloudflare.F("."), - Altitude: cloudflare.F(0.000000), - LatDegrees: cloudflare.F(37.000000), - LatDirection: cloudflare.F(dns.RecordUpdateParamsDataLatDirectionN), - LatMinutes: cloudflare.F(46.000000), - LatSeconds: cloudflare.F(46.000000), - LongDegrees: cloudflare.F(122.000000), - LongDirection: cloudflare.F(dns.RecordUpdateParamsDataLongDirectionW), - LongMinutes: cloudflare.F(23.000000), - LongSeconds: cloudflare.F(35.000000), - PrecisionHorz: cloudflare.F(0.000000), - PrecisionVert: cloudflare.F(0.000000), - Size: cloudflare.F(100.000000), - Order: cloudflare.F(100.000000), - Preference: cloudflare.F(10.000000), - Regex: cloudflare.F("string"), - Replacement: cloudflare.F("string"), - Service: cloudflare.F("_sip"), - MatchingType: cloudflare.F(1.000000), - Selector: cloudflare.F(0.000000), - Usage: cloudflare.F(0.000000), - Name: cloudflare.F("example.com"), - Port: cloudflare.F(8806.000000), - Proto: cloudflare.F("_tcp"), - Weight: cloudflare.F(20.000000), - Fingerprint: cloudflare.F("string"), - Content: cloudflare.F("http://example.com/example.html"), - }), - Meta: cloudflare.F(dns.RecordUpdateParamsMeta{ - AutoAdded: cloudflare.F(true), - Source: cloudflare.F("primary"), - }), - Priority: cloudflare.F(10.000000), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.RecordUpdateParamsTTL](shared.UnionFloat(3600.000000)), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.RecordUpdateParamsDNSRecordsARecordTTL](shared.UnionFloat(3600.000000)), }, ) if err != nil { @@ -277,61 +185,15 @@ func TestRecordEditWithOptionalParams(t *testing.T) { _, err := client.DNS.Records.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - dns.RecordEditParams{ + dns.RecordEditParamsDNSRecordsARecord{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Content: cloudflare.F("198.51.100.4"), Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordEditParamsTypeURI), + Type: cloudflare.F(dns.RecordEditParamsDNSRecordsARecordTypeA), Comment: cloudflare.F("Domain verification record"), - Content: cloudflare.F[any](map[string]interface{}{}), - Data: cloudflare.F(dns.RecordEditParamsData{ - Flags: cloudflare.F[any](map[string]interface{}{}), - Tag: cloudflare.F("issue"), - Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""), - Algorithm: cloudflare.F(2.000000), - Certificate: cloudflare.F("string"), - KeyTag: cloudflare.F(1.000000), - Type: cloudflare.F(1.000000), - Protocol: cloudflare.F(3.000000), - PublicKey: cloudflare.F("string"), - Digest: cloudflare.F("string"), - DigestType: cloudflare.F(1.000000), - Priority: cloudflare.F(1.000000), - Target: cloudflare.F("."), - Altitude: cloudflare.F(0.000000), - LatDegrees: cloudflare.F(37.000000), - LatDirection: cloudflare.F(dns.RecordEditParamsDataLatDirectionN), - LatMinutes: cloudflare.F(46.000000), - LatSeconds: cloudflare.F(46.000000), - LongDegrees: cloudflare.F(122.000000), - LongDirection: cloudflare.F(dns.RecordEditParamsDataLongDirectionW), - LongMinutes: cloudflare.F(23.000000), - LongSeconds: cloudflare.F(35.000000), - PrecisionHorz: cloudflare.F(0.000000), - PrecisionVert: cloudflare.F(0.000000), - Size: cloudflare.F(100.000000), - Order: cloudflare.F(100.000000), - Preference: cloudflare.F(10.000000), - Regex: cloudflare.F("string"), - Replacement: cloudflare.F("string"), - Service: cloudflare.F("_sip"), - MatchingType: cloudflare.F(1.000000), - Selector: cloudflare.F(0.000000), - Usage: cloudflare.F(0.000000), - Name: cloudflare.F("example.com"), - Port: cloudflare.F(8806.000000), - Proto: cloudflare.F("_tcp"), - Weight: cloudflare.F(20.000000), - Fingerprint: cloudflare.F("string"), - Content: cloudflare.F("http://example.com/example.html"), - }), - Meta: cloudflare.F(dns.RecordEditParamsMeta{ - AutoAdded: cloudflare.F(true), - Source: cloudflare.F("primary"), - }), - Priority: cloudflare.F(10.000000), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.RecordEditParamsTTL](shared.UnionFloat(3600.000000)), + Proxied: cloudflare.F(false), + Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.RecordEditParamsDNSRecordsARecordTTL](shared.UnionFloat(3600.000000)), }, ) if err != nil { diff --git a/images/v1.go b/images/v1.go index 93e788a708d..d6b3a178eda 100644 --- a/images/v1.go +++ b/images/v1.go @@ -50,7 +50,7 @@ func NewV1Service(opts ...option.RequestOption) (r *V1Service) { func (r *V1Service) New(ctx context.Context, params V1NewParams, opts ...option.RequestOption) (res *ImagesImage, err error) { opts = append(r.Options[:], opts...) var env V1NewResponseEnvelope - path := fmt.Sprintf("accounts/%s/images/v1", params.AccountID) + path := fmt.Sprintf("accounts/%s/images/v1", params.getAccountID()) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -315,18 +315,52 @@ func init() { ) } -type V1NewParams struct { +// This interface is a union satisfied by one of the following: +// [V1NewParamsImagesImageUploadViaFile], [V1NewParamsImagesImageUploadViaURL]. +type V1NewParams interface { + ImplementsV1NewParams() + + getAccountID() param.Field[string] +} + +type V1NewParamsImagesImageUploadViaFile struct { // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Metadata param.Field[interface{}] `json:"metadata"` - // Indicates whether the image requires a signature token for the access. - RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"` + AccountID param.Field[string] `path:"account_id,required"` + // An image binary data. + File param.Field[interface{}] `json:"file,required"` } -func (r V1NewParams) MarshalJSON() (data []byte, err error) { +func (r V1NewParamsImagesImageUploadViaFile) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +func (r V1NewParamsImagesImageUploadViaFile) getAccountID() param.Field[string] { + return r.AccountID +} + +func (V1NewParamsImagesImageUploadViaFile) ImplementsV1NewParams() { + +} + +type V1NewParamsImagesImageUploadViaURL struct { + // Account identifier tag. + AccountID param.Field[string] `path:"account_id,required"` + // A URL to fetch an image from origin. + URL param.Field[string] `json:"url,required"` +} + +func (r V1NewParamsImagesImageUploadViaURL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r V1NewParamsImagesImageUploadViaURL) getAccountID() param.Field[string] { + return r.AccountID +} + +func (V1NewParamsImagesImageUploadViaURL) ImplementsV1NewParams() { + +} + type V1NewResponseEnvelope struct { Errors []V1NewResponseEnvelopeErrors `json:"errors,required"` Messages []V1NewResponseEnvelopeMessages `json:"messages,required"` diff --git a/images/v1_test.go b/images/v1_test.go index acd5a4edea0..f457523c26f 100644 --- a/images/v1_test.go +++ b/images/v1_test.go @@ -14,7 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/option" ) -func TestV1NewWithOptionalParams(t *testing.T) { +func TestV1New(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 { @@ -28,10 +28,9 @@ func TestV1NewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Images.V1.New(context.TODO(), images.V1NewParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Metadata: cloudflare.F[any](map[string]interface{}{}), - RequireSignedURLs: cloudflare.F(true), + _, err := client.Images.V1.New(context.TODO(), images.V1NewParamsImagesImageUploadViaFile{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + File: cloudflare.F[any](map[string]interface{}{}), }) if err != nil { var apierr *cloudflare.Error diff --git a/internal/shared/union.go b/internal/shared/union.go index 0c1d52ee930..6b026c8b721 100644 --- a/internal/shared/union.go +++ b/internal/shared/union.go @@ -4,175 +4,183 @@ package shared type UnionString string -func (UnionString) ImplementsAccountsAccountUpdateResponse() {} -func (UnionString) ImplementsAccountsAccountGetResponse() {} -func (UnionString) ImplementsAccountsRoleGetResponse() {} -func (UnionString) ImplementsOriginCACertificatesOriginCACertificateNewResponse() {} -func (UnionString) ImplementsOriginCACertificatesOriginCACertificateGetResponse() {} -func (UnionString) ImplementsMembershipsMembershipUpdateResponse() {} -func (UnionString) ImplementsMembershipsMembershipGetResponse() {} -func (UnionString) ImplementsUserUserEditResponse() {} -func (UnionString) ImplementsUserUserGetResponse() {} -func (UnionString) ImplementsUserAuditLogListResponse() {} -func (UnionString) ImplementsUserBillingProfileGetResponse() {} -func (UnionString) ImplementsUserInviteEditResponse() {} -func (UnionString) ImplementsUserInviteGetResponse() {} -func (UnionString) ImplementsUserLoadBalancerPoolHealthResponse() {} -func (UnionString) ImplementsUserOrganizationGetResponse() {} -func (UnionString) ImplementsUserSubscriptionUpdateResponse() {} -func (UnionString) ImplementsUserSubscriptionEditResponse() {} -func (UnionString) ImplementsUserTokenUpdateResponse() {} -func (UnionString) ImplementsUserTokenGetResponse() {} -func (UnionString) ImplementsZonesCustomNameserverUpdateResponse() {} -func (UnionString) ImplementsZonesCustomNameserverGetResponse() {} -func (UnionString) ImplementsZonesWorkerScriptUpdateResponse() {} -func (UnionString) ImplementsZonesSubscriptionNewResponse() {} -func (UnionString) ImplementsZonesSubscriptionGetResponse() {} -func (UnionString) ImplementsLoadBalancersPoolHealthGetResponse() {} -func (UnionString) ImplementsLoadBalancersRegionListResponse() {} -func (UnionString) ImplementsLoadBalancersRegionGetResponse() {} -func (UnionString) ImplementsCacheCachePurgeParamsFile() {} -func (UnionString) ImplementsCacheSmartTieredCacheDeleteResponse() {} -func (UnionString) ImplementsCacheSmartTieredCacheEditResponse() {} -func (UnionString) ImplementsCacheSmartTieredCacheGetResponse() {} -func (UnionString) ImplementsSSLAnalyzeNewResponse() {} -func (UnionString) ImplementsSSLCertificatePackGetResponse() {} -func (UnionString) ImplementsSubscriptionsSubscriptionNewResponse() {} -func (UnionString) ImplementsSubscriptionsSubscriptionUpdateResponse() {} -func (UnionString) ImplementsSubscriptionsSubscriptionGetResponse() {} -func (UnionString) ImplementsArgoSmartRoutingEditResponse() {} -func (UnionString) ImplementsArgoSmartRoutingGetResponse() {} -func (UnionString) ImplementsArgoTieredCachingEditResponse() {} -func (UnionString) ImplementsArgoTieredCachingGetResponse() {} -func (UnionString) ImplementsCustomCertificatesCustomCertificateNewResponse() {} -func (UnionString) ImplementsCustomCertificatesCustomCertificateEditResponse() {} -func (UnionString) ImplementsCustomCertificatesCustomCertificateGetResponse() {} -func (UnionString) ImplementsCustomHostnamesFallbackOriginUpdateResponse() {} -func (UnionString) ImplementsCustomHostnamesFallbackOriginDeleteResponse() {} -func (UnionString) ImplementsCustomHostnamesFallbackOriginGetResponse() {} -func (UnionString) ImplementsCustomNameserversCustomNameserverDeleteResponse() {} -func (UnionString) ImplementsDNSDNSFirewallDNSFirewallDNSFirewallIP() {} -func (UnionString) ImplementsDNSDNSFirewallDNSFirewallUpstreamIP() {} -func (UnionString) ImplementsDNSFirewallNewParamsUpstreamIP() {} -func (UnionString) ImplementsDNSFirewallEditParamsDNSFirewallIP() {} -func (UnionString) ImplementsDNSFirewallEditParamsUpstreamIP() {} -func (UnionString) ImplementsDNSSECDNSSECDeleteResponse() {} -func (UnionString) ImplementsFirewallAccessRuleNewResponse() {} -func (UnionString) ImplementsFirewallAccessRuleEditResponse() {} -func (UnionString) ImplementsFirewallAccessRuleGetResponse() {} -func (UnionString) ImplementsFirewallUARuleNewResponse() {} -func (UnionString) ImplementsFirewallUARuleUpdateResponse() {} -func (UnionString) ImplementsFirewallUARuleGetResponse() {} -func (UnionString) ImplementsFirewallWAFPackageListResponseLegacyJhsAPIResponseCollectionResult() {} -func (UnionString) ImplementsFirewallWAFPackageGetResponseLegacyJhsAPIResponseSingleResult() {} -func (UnionString) ImplementsFirewallWAFPackageGroupEditResponse() {} -func (UnionString) ImplementsFirewallWAFPackageGroupGetResponse() {} -func (UnionString) ImplementsFirewallWAFPackageRuleGetResponse() {} -func (UnionString) ImplementsLogpushJobDeleteResponse() {} -func (UnionString) ImplementsLogsControlCmbConfigDeleteResponse() {} -func (UnionString) ImplementsLogsRayidGetResponse() {} -func (UnionString) ImplementsLogsReceivedGetResponse() {} -func (UnionString) ImplementsLogsReceivedGetParamsEnd() {} -func (UnionString) ImplementsLogsReceivedGetParamsStart() {} -func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthNewResponse() {} -func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthDeleteResponse() {} -func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthGetResponse() {} -func (UnionString) ImplementsPagerulesPageruleNewResponse() {} -func (UnionString) ImplementsPagerulesPageruleUpdateResponse() {} -func (UnionString) ImplementsPagerulesPageruleEditResponse() {} -func (UnionString) ImplementsPagerulesPageruleGetResponse() {} -func (UnionString) ImplementsRateLimitsRateLimitNewResponse() {} -func (UnionString) ImplementsRateLimitsRateLimitEditResponse() {} -func (UnionString) ImplementsRateLimitsRateLimitGetResponse() {} -func (UnionString) ImplementsWorkersAIRunResponse() {} -func (UnionString) ImplementsWorkersAIRunParamsBody() {} -func (UnionString) ImplementsWorkersAIRunParamsBodyTextEmbeddingsText() {} -func (UnionString) ImplementsWorkersScriptTailDeleteResponse() {} -func (UnionString) ImplementsWorkersRouteNewResponse() {} -func (UnionString) ImplementsWorkersRouteDeleteResponse() {} -func (UnionString) ImplementsKVNamespaceUpdateResponse() {} -func (UnionString) ImplementsKVNamespaceDeleteResponse() {} -func (UnionString) ImplementsKVNamespaceBulkUpdateResponse() {} -func (UnionString) ImplementsKVNamespaceBulkDeleteResponse() {} -func (UnionString) ImplementsKVNamespaceValueUpdateResponse() {} -func (UnionString) ImplementsKVNamespaceValueDeleteResponse() {} -func (UnionString) ImplementsQueuesQueueDeleteResponse() {} -func (UnionString) ImplementsQueuesConsumerDeleteResponse() {} -func (UnionString) ImplementsSpectrumAnalyticsEventBytimeGetResponse() {} -func (UnionString) ImplementsSpectrumAnalyticsEventSummaryGetResponse() {} -func (UnionString) ImplementsSpectrumAppNewResponseOriginPort() {} -func (UnionString) ImplementsSpectrumAppUpdateResponseOriginPort() {} -func (UnionString) ImplementsSpectrumAppGetResponse() {} -func (UnionString) ImplementsSpectrumAppNewParamsOriginPort() {} -func (UnionString) ImplementsSpectrumAppUpdateParamsOriginPort() {} -func (UnionString) ImplementsAddressingAddressMapDeleteResponse() {} -func (UnionString) ImplementsAddressingAddressMapAccountUpdateResponse() {} -func (UnionString) ImplementsAddressingAddressMapAccountDeleteResponse() {} -func (UnionString) ImplementsAddressingAddressMapIPUpdateResponse() {} -func (UnionString) ImplementsAddressingAddressMapIPDeleteResponse() {} -func (UnionString) ImplementsAddressingAddressMapZoneUpdateResponse() {} -func (UnionString) ImplementsAddressingAddressMapZoneDeleteResponse() {} -func (UnionString) ImplementsAddressingPrefixDeleteResponse() {} -func (UnionString) ImplementsAddressingPrefixBGPBindingDeleteResponse() {} -func (UnionString) ImplementsAuditLogsAuditLogListResponse() {} -func (UnionString) ImplementsBillingProfileGetResponse() {} -func (UnionString) ImplementsImagesImagesImageVariant() {} -func (UnionString) ImplementsImagesV1DeleteResponse() {} -func (UnionString) ImplementsImagesV1VariantDeleteResponse() {} -func (UnionString) ImplementsIntelIntelSchemasIpip() {} -func (UnionString) ImplementsIntelMiscategorizationNewResponse() {} -func (UnionString) ImplementsIntelAttackSurfaceReportIssueDismissResponse() {} -func (UnionString) ImplementsMagicTransitSiteACLNewResponseACLsLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLNewResponseACLsLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLUpdateResponseACLLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLUpdateResponseACLLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLListResponseACLsLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLListResponseACLsLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLDeleteResponseDeletedACLLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLDeleteResponseDeletedACLLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLGetResponseACLLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLGetResponseACLLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLNewParamsACLLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLNewParamsACLLan2Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLUpdateParamsACLLan1Subnet() {} -func (UnionString) ImplementsMagicTransitSiteACLUpdateParamsACLLan2Subnet() {} -func (UnionString) ImplementsPagesProjectNewResponse() {} -func (UnionString) ImplementsPagesProjectEditResponse() {} -func (UnionString) ImplementsPagesProjectDeploymentHistoryLogGetResponse() {} -func (UnionString) ImplementsPagesProjectDomainNewResponse() {} -func (UnionString) ImplementsPagesProjectDomainEditResponse() {} -func (UnionString) ImplementsPagesProjectDomainGetResponse() {} -func (UnionString) ImplementsRegistrarDomainUpdateResponse() {} -func (UnionString) ImplementsRegistrarDomainGetResponse() {} -func (UnionString) ImplementsRulesListItemGetResponse() {} -func (UnionString) ImplementsStreamAudioTrackDeleteResponse() {} -func (UnionString) ImplementsStreamKeyDeleteResponse() {} -func (UnionString) ImplementsStreamWatermarkNewResponse() {} -func (UnionString) ImplementsStreamWatermarkDeleteResponse() {} -func (UnionString) ImplementsStreamWatermarkGetResponse() {} -func (UnionString) ImplementsStreamWebhookUpdateResponse() {} -func (UnionString) ImplementsStreamWebhookDeleteResponse() {} -func (UnionString) ImplementsStreamWebhookGetResponse() {} -func (UnionString) ImplementsStreamCaptionUpdateResponse() {} -func (UnionString) ImplementsStreamCaptionDeleteResponse() {} -func (UnionString) ImplementsStreamDownloadNewResponse() {} -func (UnionString) ImplementsStreamDownloadDeleteResponse() {} -func (UnionString) ImplementsStreamDownloadGetResponse() {} -func (UnionString) ImplementsAlertingV3ListResponse() {} -func (UnionString) ImplementsAlertingV3DestinationEligibleGetResponse() {} -func (UnionString) ImplementsAlertingV3DestinationPagerdutyDeleteResponse() {} -func (UnionString) ImplementsAlertingV3DestinationWebhookDeleteResponse() {} -func (UnionString) ImplementsAlertingAaaPoliciesMechanismsID() {} -func (UnionString) ImplementsAlertingV3PolicyDeleteResponse() {} -func (UnionString) ImplementsAlertingV3PolicyNewParamsMechanismsID() {} -func (UnionString) ImplementsAlertingV3PolicyUpdateParamsMechanismsID() {} -func (UnionString) ImplementsD1DatabaseDeleteResponse() {} -func (UnionString) ImplementsWARPConnectorWARPConnectorTokenResponse() {} -func (UnionString) ImplementsZeroTrustDeviceGetResponse() {} -func (UnionString) ImplementsZeroTrustDevicePostureIntegrationDeleteResponse() {} -func (UnionString) ImplementsZeroTrustDeviceRevokeNewResponse() {} -func (UnionString) ImplementsZeroTrustDeviceUnrevokeNewResponse() {} -func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsAppID() {} +func (UnionString) ImplementsAccountsAccountUpdateResponse() {} +func (UnionString) ImplementsAccountsAccountGetResponse() {} +func (UnionString) ImplementsAccountsRoleGetResponse() {} +func (UnionString) ImplementsOriginCACertificatesOriginCACertificateNewResponse() {} +func (UnionString) ImplementsOriginCACertificatesOriginCACertificateGetResponse() {} +func (UnionString) ImplementsMembershipsMembershipUpdateResponse() {} +func (UnionString) ImplementsMembershipsMembershipGetResponse() {} +func (UnionString) ImplementsUserUserEditResponse() {} +func (UnionString) ImplementsUserUserGetResponse() {} +func (UnionString) ImplementsUserAuditLogListResponse() {} +func (UnionString) ImplementsUserBillingProfileGetResponse() {} +func (UnionString) ImplementsUserInviteEditResponse() {} +func (UnionString) ImplementsUserInviteGetResponse() {} +func (UnionString) ImplementsUserLoadBalancerPoolHealthResponse() {} +func (UnionString) ImplementsUserOrganizationGetResponse() {} +func (UnionString) ImplementsUserSubscriptionUpdateResponse() {} +func (UnionString) ImplementsUserSubscriptionEditResponse() {} +func (UnionString) ImplementsUserTokenUpdateResponse() {} +func (UnionString) ImplementsUserTokenGetResponse() {} +func (UnionString) ImplementsZonesCustomNameserverUpdateResponse() {} +func (UnionString) ImplementsZonesCustomNameserverGetResponse() {} +func (UnionString) ImplementsZonesWorkerScriptUpdateResponse() {} +func (UnionString) ImplementsZonesSubscriptionNewResponse() {} +func (UnionString) ImplementsZonesSubscriptionGetResponse() {} +func (UnionString) ImplementsLoadBalancersPoolHealthGetResponse() {} +func (UnionString) ImplementsLoadBalancersRegionListResponse() {} +func (UnionString) ImplementsLoadBalancersRegionGetResponse() {} +func (UnionString) ImplementsCacheCachePurgeParamsCachePurgeFilesFile() {} +func (UnionString) ImplementsCacheSmartTieredCacheDeleteResponse() {} +func (UnionString) ImplementsCacheSmartTieredCacheEditResponse() {} +func (UnionString) ImplementsCacheSmartTieredCacheGetResponse() {} +func (UnionString) ImplementsSSLAnalyzeNewResponse() {} +func (UnionString) ImplementsSSLCertificatePackGetResponse() {} +func (UnionString) ImplementsSubscriptionsSubscriptionNewResponse() {} +func (UnionString) ImplementsSubscriptionsSubscriptionUpdateResponse() {} +func (UnionString) ImplementsSubscriptionsSubscriptionGetResponse() {} +func (UnionString) ImplementsArgoSmartRoutingEditResponse() {} +func (UnionString) ImplementsArgoSmartRoutingGetResponse() {} +func (UnionString) ImplementsArgoTieredCachingEditResponse() {} +func (UnionString) ImplementsArgoTieredCachingGetResponse() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateNewResponse() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateEditResponse() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateGetResponse() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginUpdateResponse() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginDeleteResponse() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginGetResponse() {} +func (UnionString) ImplementsCustomNameserversCustomNameserverDeleteResponse() {} +func (UnionString) ImplementsDNSDNSFirewallDNSFirewallDNSFirewallIP() {} +func (UnionString) ImplementsDNSDNSFirewallDNSFirewallUpstreamIP() {} +func (UnionString) ImplementsDNSFirewallNewParamsUpstreamIP() {} +func (UnionString) ImplementsDNSFirewallEditParamsDNSFirewallIP() {} +func (UnionString) ImplementsDNSFirewallEditParamsUpstreamIP() {} +func (UnionString) ImplementsDNSSECDNSSECDeleteResponse() {} +func (UnionString) ImplementsFirewallAccessRuleNewResponse() {} +func (UnionString) ImplementsFirewallAccessRuleEditResponse() {} +func (UnionString) ImplementsFirewallAccessRuleGetResponse() {} +func (UnionString) ImplementsFirewallUARuleNewResponse() {} +func (UnionString) ImplementsFirewallUARuleUpdateResponse() {} +func (UnionString) ImplementsFirewallUARuleGetResponse() {} +func (UnionString) ImplementsFirewallWAFPackageListResponseLegacyJhsAPIResponseCollectionResult() {} +func (UnionString) ImplementsFirewallWAFPackageGetResponseLegacyJhsAPIResponseSingleResult() {} +func (UnionString) ImplementsFirewallWAFPackageGroupEditResponse() {} +func (UnionString) ImplementsFirewallWAFPackageGroupGetResponse() {} +func (UnionString) ImplementsFirewallWAFPackageRuleGetResponse() {} +func (UnionString) ImplementsLogpushJobDeleteResponse() {} +func (UnionString) ImplementsLogsControlCmbConfigDeleteResponse() {} +func (UnionString) ImplementsLogsRayidGetResponse() {} +func (UnionString) ImplementsLogsReceivedGetResponse() {} +func (UnionString) ImplementsLogsReceivedGetParamsEnd() {} +func (UnionString) ImplementsLogsReceivedGetParamsStart() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthNewResponse() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthDeleteResponse() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthGetResponse() {} +func (UnionString) ImplementsPagerulesPageruleNewResponse() {} +func (UnionString) ImplementsPagerulesPageruleUpdateResponse() {} +func (UnionString) ImplementsPagerulesPageruleEditResponse() {} +func (UnionString) ImplementsPagerulesPageruleGetResponse() {} +func (UnionString) ImplementsRateLimitsRateLimitNewResponse() {} +func (UnionString) ImplementsRateLimitsRateLimitEditResponse() {} +func (UnionString) ImplementsRateLimitsRateLimitGetResponse() {} +func (UnionString) ImplementsWorkersAIRunResponse() {} +func (UnionString) ImplementsWorkersAIRunParamsTextEmbeddingsText() {} +func (UnionString) ImplementsWorkersScriptTailDeleteResponse() {} +func (UnionString) ImplementsWorkersRouteNewResponse() {} +func (UnionString) ImplementsWorkersRouteDeleteResponse() {} +func (UnionString) ImplementsKVNamespaceUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceDeleteResponse() {} +func (UnionString) ImplementsKVNamespaceBulkUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceBulkDeleteResponse() {} +func (UnionString) ImplementsKVNamespaceValueUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceValueDeleteResponse() {} +func (UnionString) ImplementsQueuesQueueDeleteResponse() {} +func (UnionString) ImplementsQueuesConsumerDeleteResponse() {} +func (UnionString) ImplementsSpectrumAnalyticsEventBytimeGetResponse() {} +func (UnionString) ImplementsSpectrumAnalyticsEventSummaryGetResponse() {} +func (UnionString) ImplementsSpectrumAppNewResponseOriginPort() {} +func (UnionString) ImplementsSpectrumAppUpdateResponseOriginPort() {} +func (UnionString) ImplementsSpectrumAppGetResponse() {} +func (UnionString) ImplementsSpectrumAppNewParamsOriginPort() {} +func (UnionString) ImplementsSpectrumAppUpdateParamsOriginPort() {} +func (UnionString) ImplementsAddressingAddressMapDeleteResponse() {} +func (UnionString) ImplementsAddressingAddressMapAccountUpdateResponse() {} +func (UnionString) ImplementsAddressingAddressMapAccountDeleteResponse() {} +func (UnionString) ImplementsAddressingAddressMapIPUpdateResponse() {} +func (UnionString) ImplementsAddressingAddressMapIPDeleteResponse() {} +func (UnionString) ImplementsAddressingAddressMapZoneUpdateResponse() {} +func (UnionString) ImplementsAddressingAddressMapZoneDeleteResponse() {} +func (UnionString) ImplementsAddressingPrefixDeleteResponse() {} +func (UnionString) ImplementsAddressingPrefixBGPBindingDeleteResponse() {} +func (UnionString) ImplementsAuditLogsAuditLogListResponse() {} +func (UnionString) ImplementsBillingProfileGetResponse() {} +func (UnionString) ImplementsImagesImagesImageVariant() {} +func (UnionString) ImplementsImagesV1DeleteResponse() {} +func (UnionString) ImplementsImagesV1VariantDeleteResponse() {} +func (UnionString) ImplementsIntelIntelSchemasIpip() {} +func (UnionString) ImplementsIntelMiscategorizationNewResponse() {} +func (UnionString) ImplementsIntelAttackSurfaceReportIssueDismissResponse() {} +func (UnionString) ImplementsMagicTransitSiteACLNewResponseACLsLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLNewResponseACLsLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLUpdateResponseACLLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLUpdateResponseACLLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLListResponseACLsLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLListResponseACLsLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLDeleteResponseDeletedACLLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLDeleteResponseDeletedACLLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLGetResponseACLLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLGetResponseACLLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLNewParamsACLLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLNewParamsACLLan2Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLUpdateParamsACLLan1Subnet() {} +func (UnionString) ImplementsMagicTransitSiteACLUpdateParamsACLLan2Subnet() {} +func (UnionString) ImplementsPagesProjectNewResponse() {} +func (UnionString) ImplementsPagesProjectEditResponse() {} +func (UnionString) ImplementsPagesProjectDeploymentHistoryLogGetResponse() {} +func (UnionString) ImplementsPagesProjectDomainNewResponse() {} +func (UnionString) ImplementsPagesProjectDomainEditResponse() {} +func (UnionString) ImplementsPagesProjectDomainGetResponse() {} +func (UnionString) ImplementsRegistrarDomainUpdateResponse() {} +func (UnionString) ImplementsRegistrarDomainGetResponse() {} +func (UnionString) ImplementsRulesListItemGetResponse() {} +func (UnionString) ImplementsStreamAudioTrackDeleteResponse() {} +func (UnionString) ImplementsStreamKeyDeleteResponse() {} +func (UnionString) ImplementsStreamWatermarkNewResponse() {} +func (UnionString) ImplementsStreamWatermarkDeleteResponse() {} +func (UnionString) ImplementsStreamWatermarkGetResponse() {} +func (UnionString) ImplementsStreamWebhookUpdateResponse() {} +func (UnionString) ImplementsStreamWebhookDeleteResponse() {} +func (UnionString) ImplementsStreamWebhookGetResponse() {} +func (UnionString) ImplementsStreamCaptionUpdateResponse() {} +func (UnionString) ImplementsStreamCaptionDeleteResponse() {} +func (UnionString) ImplementsStreamDownloadNewResponse() {} +func (UnionString) ImplementsStreamDownloadDeleteResponse() {} +func (UnionString) ImplementsStreamDownloadGetResponse() {} +func (UnionString) ImplementsAlertingV3ListResponse() {} +func (UnionString) ImplementsAlertingV3DestinationEligibleGetResponse() {} +func (UnionString) ImplementsAlertingV3DestinationPagerdutyDeleteResponse() {} +func (UnionString) ImplementsAlertingV3DestinationWebhookDeleteResponse() {} +func (UnionString) ImplementsAlertingAaaPoliciesMechanismsID() {} +func (UnionString) ImplementsAlertingV3PolicyDeleteResponse() {} +func (UnionString) ImplementsAlertingV3PolicyNewParamsMechanismsID() {} +func (UnionString) ImplementsAlertingV3PolicyUpdateParamsMechanismsID() {} +func (UnionString) ImplementsD1DatabaseDeleteResponse() {} +func (UnionString) ImplementsWARPConnectorWARPConnectorTokenResponse() {} +func (UnionString) ImplementsZeroTrustDeviceGetResponse() {} +func (UnionString) ImplementsZeroTrustDevicePostureIntegrationDeleteResponse() {} +func (UnionString) ImplementsZeroTrustDeviceRevokeNewResponse() {} +func (UnionString) ImplementsZeroTrustDeviceUnrevokeNewResponse() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsSelfHostedApplicationAppID() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationAppID() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBrowserSSHApplicationAppID() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBrowserVncApplicationAppID() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsAppLauncherApplicationAppID() {} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationAppID() { +} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationAppID() { +} +func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBookmarkApplicationAppID() {} func (UnionString) ImplementsZeroTrustAccessApplicationDeleteParamsAppID() {} func (UnionString) ImplementsZeroTrustAccessApplicationGetParamsAppID() {} func (UnionString) ImplementsZeroTrustAccessApplicationRevokeTokensParamsAppID() {} @@ -240,9 +248,66 @@ func (UnionFloat) ImplementsDNSDNSRecordSvcbttl() func (UnionFloat) ImplementsDNSDNSRecordTlsattl() {} func (UnionFloat) ImplementsDNSDNSRecordTxtttl() {} func (UnionFloat) ImplementsDNSDNSRecordUrittl() {} -func (UnionFloat) ImplementsDNSRecordNewParamsTTL() {} -func (UnionFloat) ImplementsDNSRecordUpdateParamsTTL() {} -func (UnionFloat) ImplementsDNSRecordEditParamsTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsAAAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsCAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsCERTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsCNAMERecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsDNSKEYRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsDSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsHTTPSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsLOCRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsMXRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsNAPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsNSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsSMIMEARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsSRVRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsSSHFPRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsSVCBRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsTLSARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsTXTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordNewParamsDNSRecordsURIRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsAAAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsCAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsCERTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsCNAMERecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsDNSKEYRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsDSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsHTTPSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsLOCRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsMXRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsNAPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsNSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsSMIMEARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsSRVRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsSSHFPRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsSVCBRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsTLSARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsTXTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordUpdateParamsDNSRecordsURIRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsAAAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsCAARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsCERTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsCNAMERecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsDNSKEYRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsDSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsHTTPSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsLOCRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsMXRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsNAPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsNSRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsPTRRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsSMIMEARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsSRVRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsSSHFPRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsSVCBRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsTLSARecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsTXTRecordTTL() {} +func (UnionFloat) ImplementsDNSRecordEditParamsDNSRecordsURIRecordTTL() {} func (UnionFloat) ImplementsEmailRoutingEmailDNSRecordTTL() {} func (UnionFloat) ImplementsRadarRankingTimeseriesGroupsResponseSerie0() {} func (UnionFloat) ImplementsHostnamesTLSCertificatesAndHostnamesSettingObjectValue() {} diff --git a/pcaps/pcap.go b/pcaps/pcap.go index 0324310717e..ef1ca70fb70 100644 --- a/pcaps/pcap.go +++ b/pcaps/pcap.go @@ -40,7 +40,7 @@ func NewPCAPService(opts ...option.RequestOption) (r *PCAPService) { func (r *PCAPService) New(ctx context.Context, params PCAPNewParams, opts ...option.RequestOption) (res *PCAPNewResponse, err error) { opts = append(r.Options[:], opts...) var env PCAPNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/pcaps", params.AccountID) + path := fmt.Sprintf("accounts/%s/pcaps", params.getAccountID()) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -984,44 +984,140 @@ func (r PCAPGetResponseMagicVisibilityPCAPsResponseFullType) IsKnown() bool { return false } -type PCAPNewParams struct { +// This interface is a union satisfied by one of the following: +// [PCAPNewParamsMagicVisibilityPCAPsRequestSimple], +// [PCAPNewParamsMagicVisibilityPCAPsRequestFull]. +type PCAPNewParams interface { + ImplementsPCAPNewParams() + + getAccountID() param.Field[string] +} + +type PCAPNewParamsMagicVisibilityPCAPsRequestSimple struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` + // The limit of packets contained in a packet capture. + PacketLimit param.Field[float64] `json:"packet_limit,required"` // The system used to collect packet captures. - System param.Field[PCAPNewParamsSystem] `json:"system,required"` + System param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem] `json:"system,required"` // The packet capture duration in seconds. TimeLimit param.Field[float64] `json:"time_limit,required"` // The type of packet capture. `Simple` captures sampled packets, and `full` // captures entire payloads and non-sampled packets. - Type param.Field[PCAPNewParamsType] `json:"type,required"` - // The maximum number of bytes to capture. This field only applies to `full` packet - // captures. - ByteLimit param.Field[float64] `json:"byte_limit"` + Type param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType] `json:"type,required"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestSimpleFilterV1] `json:"filter_v1"` +} + +func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimple) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimple) getAccountID() param.Field[string] { + return r.AccountID +} + +func (PCAPNewParamsMagicVisibilityPCAPsRequestSimple) ImplementsPCAPNewParams() { + +} + +// The system used to collect packet captures. +type PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem string + +const ( + PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem = "magic-transit" +) + +func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem) IsKnown() bool { + switch r { + case PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystemMagicTransit: + return true + } + return false +} + +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType string + +const ( + PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeSimple PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType = "simple" + PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeFull PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType = "full" +) + +func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType) IsKnown() bool { + switch r { + case PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeSimple, PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeFull: + return true + } + return false +} + +// The packet capture filter. When this field is empty, all packets are captured. +type PCAPNewParamsMagicVisibilityPCAPsRequestSimpleFilterV1 struct { + // The destination IP address of the packet. + DestinationAddress param.Field[string] `json:"destination_address"` + // The destination port of the packet. + DestinationPort param.Field[float64] `json:"destination_port"` + // The protocol number of the packet. + Protocol param.Field[float64] `json:"protocol"` + // The source IP address of the packet. + SourceAddress param.Field[string] `json:"source_address"` + // The source port of the packet. + SourcePort param.Field[float64] `json:"source_port"` +} + +func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleFilterV1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type PCAPNewParamsMagicVisibilityPCAPsRequestFull struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` // The name of the data center used for the packet capture. This can be a specific // colo (ord02) or a multi-colo name (ORD). This field only applies to `full` // packet captures. - ColoName param.Field[string] `json:"colo_name"` + ColoName param.Field[string] `json:"colo_name,required"` // The full URI for the bucket. This field only applies to `full` packet captures. - DestinationConf param.Field[string] `json:"destination_conf"` - FilterV1 param.Field[PCAPNewParamsFilterV1] `json:"filter_v1"` + DestinationConf param.Field[string] `json:"destination_conf,required"` + // The system used to collect packet captures. + System param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem] `json:"system,required"` + // The packet capture duration in seconds. + TimeLimit param.Field[float64] `json:"time_limit,required"` + // The type of packet capture. `Simple` captures sampled packets, and `full` + // captures entire payloads and non-sampled packets. + Type param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestFullType] `json:"type,required"` + // The maximum number of bytes to capture. This field only applies to `full` packet + // captures. + ByteLimit param.Field[float64] `json:"byte_limit"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestFullFilterV1] `json:"filter_v1"` // The limit of packets contained in a packet capture. PacketLimit param.Field[float64] `json:"packet_limit"` } -func (r PCAPNewParams) MarshalJSON() (data []byte, err error) { +func (r PCAPNewParamsMagicVisibilityPCAPsRequestFull) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +func (r PCAPNewParamsMagicVisibilityPCAPsRequestFull) getAccountID() param.Field[string] { + return r.AccountID +} + +func (PCAPNewParamsMagicVisibilityPCAPsRequestFull) ImplementsPCAPNewParams() { + +} + // The system used to collect packet captures. -type PCAPNewParamsSystem string +type PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem string const ( - PCAPNewParamsSystemMagicTransit PCAPNewParamsSystem = "magic-transit" + PCAPNewParamsMagicVisibilityPCAPsRequestFullSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem = "magic-transit" ) -func (r PCAPNewParamsSystem) IsKnown() bool { +func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem) IsKnown() bool { switch r { - case PCAPNewParamsSystemMagicTransit: + case PCAPNewParamsMagicVisibilityPCAPsRequestFullSystemMagicTransit: return true } return false @@ -1029,22 +1125,23 @@ func (r PCAPNewParamsSystem) IsKnown() bool { // The type of packet capture. `Simple` captures sampled packets, and `full` // captures entire payloads and non-sampled packets. -type PCAPNewParamsType string +type PCAPNewParamsMagicVisibilityPCAPsRequestFullType string const ( - PCAPNewParamsTypeSimple PCAPNewParamsType = "simple" - PCAPNewParamsTypeFull PCAPNewParamsType = "full" + PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeSimple PCAPNewParamsMagicVisibilityPCAPsRequestFullType = "simple" + PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeFull PCAPNewParamsMagicVisibilityPCAPsRequestFullType = "full" ) -func (r PCAPNewParamsType) IsKnown() bool { +func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullType) IsKnown() bool { switch r { - case PCAPNewParamsTypeSimple, PCAPNewParamsTypeFull: + case PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeSimple, PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeFull: return true } return false } -type PCAPNewParamsFilterV1 struct { +// The packet capture filter. When this field is empty, all packets are captured. +type PCAPNewParamsMagicVisibilityPCAPsRequestFullFilterV1 struct { // The destination IP address of the packet. DestinationAddress param.Field[string] `json:"destination_address"` // The destination port of the packet. @@ -1057,7 +1154,7 @@ type PCAPNewParamsFilterV1 struct { SourcePort param.Field[float64] `json:"source_port"` } -func (r PCAPNewParamsFilterV1) MarshalJSON() (data []byte, err error) { +func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullFilterV1) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } diff --git a/pcaps/pcap_test.go b/pcaps/pcap_test.go index 81ccb0e1603..c993bef8918 100644 --- a/pcaps/pcap_test.go +++ b/pcaps/pcap_test.go @@ -28,22 +28,19 @@ func TestPCAPNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.PCAPs.New(context.TODO(), pcaps.PCAPNewParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - System: cloudflare.F(pcaps.PCAPNewParamsSystemMagicTransit), - TimeLimit: cloudflare.F(300.000000), - Type: cloudflare.F(pcaps.PCAPNewParamsTypeSimple), - ByteLimit: cloudflare.F(500000.000000), - ColoName: cloudflare.F("ord02"), - DestinationConf: cloudflare.F("s3://pcaps-bucket?region=us-east-1"), - FilterV1: cloudflare.F(pcaps.PCAPNewParamsFilterV1{ + _, err := client.PCAPs.New(context.TODO(), pcaps.PCAPNewParamsMagicVisibilityPCAPsRequestSimple{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + PacketLimit: cloudflare.F(10000.000000), + System: cloudflare.F(pcaps.PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystemMagicTransit), + TimeLimit: cloudflare.F(300.000000), + Type: cloudflare.F(pcaps.PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeSimple), + FilterV1: cloudflare.F(pcaps.PCAPNewParamsMagicVisibilityPCAPsRequestSimpleFilterV1{ DestinationAddress: cloudflare.F("1.2.3.4"), DestinationPort: cloudflare.F(80.000000), Protocol: cloudflare.F(6.000000), SourceAddress: cloudflare.F("1.2.3.4"), SourcePort: cloudflare.F(123.000000), }), - PacketLimit: cloudflare.F(10000.000000), }) if err != nil { var apierr *cloudflare.Error diff --git a/r2/sippy.go b/r2/sippy.go index e2890ed3a15..66c085f849a 100644 --- a/r2/sippy.go +++ b/r2/sippy.go @@ -34,7 +34,7 @@ func NewSippyService(opts ...option.RequestOption) (r *SippyService) { func (r *SippyService) Update(ctx context.Context, bucketName string, params SippyUpdateParams, opts ...option.RequestOption) (res *R2Sippy, err error) { opts = append(r.Options[:], opts...) var env SippyUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/r2/buckets/%s/sippy", params.AccountID, bucketName) + path := fmt.Sprintf("accounts/%s/r2/buckets/%s/sippy", params.getAccountID(), bucketName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -217,26 +217,45 @@ func (r SippyDeleteResponseEnabled) IsKnown() bool { return false } -type SippyUpdateParams struct { +// This interface is a union satisfied by one of the following: +// [SippyUpdateParamsR2EnableSippyAws], [SippyUpdateParamsR2EnableSippyGcs]. +type SippyUpdateParams interface { + ImplementsSippyUpdateParams() + + getAccountID() param.Field[string] +} + +type SippyUpdateParamsR2EnableSippyAws struct { // Account ID - AccountID param.Field[string] `path:"account_id,required"` - Destination param.Field[SippyUpdateParamsDestination] `json:"destination"` - Source param.Field[SippyUpdateParamsSource] `json:"source"` + AccountID param.Field[string] `path:"account_id,required"` + // R2 bucket to copy objects to + Destination param.Field[SippyUpdateParamsR2EnableSippyAwsDestination] `json:"destination"` + // AWS S3 bucket to copy objects from + Source param.Field[SippyUpdateParamsR2EnableSippyAwsSource] `json:"source"` } -func (r SippyUpdateParams) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsR2EnableSippyAws) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SippyUpdateParamsDestination struct { +func (r SippyUpdateParamsR2EnableSippyAws) getAccountID() param.Field[string] { + return r.AccountID +} + +func (SippyUpdateParamsR2EnableSippyAws) ImplementsSippyUpdateParams() { + +} + +// R2 bucket to copy objects to +type SippyUpdateParamsR2EnableSippyAwsDestination struct { // ID of a Cloudflare API token. This is the value labelled "Access Key ID" when // creating an API token from the // [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). // // Sippy will use this token when writing objects to R2, so it is best to scope // this token to the bucket you're enabling Sippy for. - AccessKeyID param.Field[string] `json:"accessKeyId"` - Provider param.Field[SippyUpdateParamsDestinationProvider] `json:"provider"` + AccessKeyID param.Field[string] `json:"accessKeyId"` + Provider param.Field[SippyUpdateParamsR2EnableSippyAwsDestinationProvider] `json:"provider"` // Value of a Cloudflare API token. This is the value labelled "Secret Access Key" // when creating an API token from the // [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). @@ -246,54 +265,137 @@ type SippyUpdateParamsDestination struct { SecretAccessKey param.Field[string] `json:"secretAccessKey"` } -func (r SippyUpdateParamsDestination) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsR2EnableSippyAwsDestination) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SippyUpdateParamsDestinationProvider string +type SippyUpdateParamsR2EnableSippyAwsDestinationProvider string const ( - SippyUpdateParamsDestinationProviderR2 SippyUpdateParamsDestinationProvider = "r2" + SippyUpdateParamsR2EnableSippyAwsDestinationProviderR2 SippyUpdateParamsR2EnableSippyAwsDestinationProvider = "r2" ) -func (r SippyUpdateParamsDestinationProvider) IsKnown() bool { +func (r SippyUpdateParamsR2EnableSippyAwsDestinationProvider) IsKnown() bool { switch r { - case SippyUpdateParamsDestinationProviderR2: + case SippyUpdateParamsR2EnableSippyAwsDestinationProviderR2: return true } return false } -type SippyUpdateParamsSource struct { +// AWS S3 bucket to copy objects from +type SippyUpdateParamsR2EnableSippyAwsSource struct { // Access Key ID of an IAM credential (ideally scoped to a single S3 bucket) AccessKeyID param.Field[string] `json:"accessKeyId"` + // Name of the AWS S3 bucket + Bucket param.Field[string] `json:"bucket"` + Provider param.Field[SippyUpdateParamsR2EnableSippyAwsSourceProvider] `json:"provider"` + // Name of the AWS availability zone + Region param.Field[string] `json:"region"` + // Secret Access Key of an IAM credential (ideally scoped to a single S3 bucket) + SecretAccessKey param.Field[string] `json:"secretAccessKey"` +} + +func (r SippyUpdateParamsR2EnableSippyAwsSource) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type SippyUpdateParamsR2EnableSippyAwsSourceProvider string + +const ( + SippyUpdateParamsR2EnableSippyAwsSourceProviderAws SippyUpdateParamsR2EnableSippyAwsSourceProvider = "aws" +) + +func (r SippyUpdateParamsR2EnableSippyAwsSourceProvider) IsKnown() bool { + switch r { + case SippyUpdateParamsR2EnableSippyAwsSourceProviderAws: + return true + } + return false +} + +type SippyUpdateParamsR2EnableSippyGcs struct { + // Account ID + AccountID param.Field[string] `path:"account_id,required"` + // R2 bucket to copy objects to + Destination param.Field[SippyUpdateParamsR2EnableSippyGcsDestination] `json:"destination"` + // GCS bucket to copy objects from + Source param.Field[SippyUpdateParamsR2EnableSippyGcsSource] `json:"source"` +} + +func (r SippyUpdateParamsR2EnableSippyGcs) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SippyUpdateParamsR2EnableSippyGcs) getAccountID() param.Field[string] { + return r.AccountID +} + +func (SippyUpdateParamsR2EnableSippyGcs) ImplementsSippyUpdateParams() { + +} + +// R2 bucket to copy objects to +type SippyUpdateParamsR2EnableSippyGcsDestination struct { + // ID of a Cloudflare API token. This is the value labelled "Access Key ID" when + // creating an API token from the + // [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). + // + // Sippy will use this token when writing objects to R2, so it is best to scope + // this token to the bucket you're enabling Sippy for. + AccessKeyID param.Field[string] `json:"accessKeyId"` + Provider param.Field[SippyUpdateParamsR2EnableSippyGcsDestinationProvider] `json:"provider"` + // Value of a Cloudflare API token. This is the value labelled "Secret Access Key" + // when creating an API token from the + // [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). + // + // Sippy will use this token when writing objects to R2, so it is best to scope + // this token to the bucket you're enabling Sippy for. + SecretAccessKey param.Field[string] `json:"secretAccessKey"` +} + +func (r SippyUpdateParamsR2EnableSippyGcsDestination) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type SippyUpdateParamsR2EnableSippyGcsDestinationProvider string + +const ( + SippyUpdateParamsR2EnableSippyGcsDestinationProviderR2 SippyUpdateParamsR2EnableSippyGcsDestinationProvider = "r2" +) + +func (r SippyUpdateParamsR2EnableSippyGcsDestinationProvider) IsKnown() bool { + switch r { + case SippyUpdateParamsR2EnableSippyGcsDestinationProviderR2: + return true + } + return false +} + +// GCS bucket to copy objects from +type SippyUpdateParamsR2EnableSippyGcsSource struct { // Name of the GCS bucket Bucket param.Field[string] `json:"bucket"` // Client email of an IAM credential (ideally scoped to a single GCS bucket) ClientEmail param.Field[string] `json:"clientEmail"` // Private Key of an IAM credential (ideally scoped to a single GCS bucket) - PrivateKey param.Field[string] `json:"privateKey"` - Provider param.Field[SippyUpdateParamsSourceProvider] `json:"provider"` - // Name of the AWS availability zone - Region param.Field[string] `json:"region"` - // Secret Access Key of an IAM credential (ideally scoped to a single S3 bucket) - SecretAccessKey param.Field[string] `json:"secretAccessKey"` + PrivateKey param.Field[string] `json:"privateKey"` + Provider param.Field[SippyUpdateParamsR2EnableSippyGcsSourceProvider] `json:"provider"` } -func (r SippyUpdateParamsSource) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsR2EnableSippyGcsSource) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SippyUpdateParamsSourceProvider string +type SippyUpdateParamsR2EnableSippyGcsSourceProvider string const ( - SippyUpdateParamsSourceProviderGcs SippyUpdateParamsSourceProvider = "gcs" - SippyUpdateParamsSourceProviderAws SippyUpdateParamsSourceProvider = "aws" + SippyUpdateParamsR2EnableSippyGcsSourceProviderGcs SippyUpdateParamsR2EnableSippyGcsSourceProvider = "gcs" ) -func (r SippyUpdateParamsSourceProvider) IsKnown() bool { +func (r SippyUpdateParamsR2EnableSippyGcsSourceProvider) IsKnown() bool { switch r { - case SippyUpdateParamsSourceProviderGcs, SippyUpdateParamsSourceProviderAws: + case SippyUpdateParamsR2EnableSippyGcsSourceProviderGcs: return true } return false diff --git a/r2/sippy_test.go b/r2/sippy_test.go index 60cbab3d91e..58ecde3eeb4 100644 --- a/r2/sippy_test.go +++ b/r2/sippy_test.go @@ -31,21 +31,19 @@ func TestSippyUpdateWithOptionalParams(t *testing.T) { _, err := client.R2.Sippy.Update( context.TODO(), "example-bucket", - r2.SippyUpdateParams{ + r2.SippyUpdateParamsR2EnableSippyAws{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Destination: cloudflare.F(r2.SippyUpdateParamsDestination{ + Destination: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsDestination{ AccessKeyID: cloudflare.F("string"), - Provider: cloudflare.F(r2.SippyUpdateParamsDestinationProviderR2), + Provider: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsDestinationProviderR2), SecretAccessKey: cloudflare.F("string"), }), - Source: cloudflare.F(r2.SippyUpdateParamsSource{ + Source: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsSource{ AccessKeyID: cloudflare.F("string"), Bucket: cloudflare.F("string"), - Provider: cloudflare.F(r2.SippyUpdateParamsSourceProviderGcs), + Provider: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsSourceProviderAws), Region: cloudflare.F("string"), SecretAccessKey: cloudflare.F("string"), - ClientEmail: cloudflare.F("string"), - PrivateKey: cloudflare.F("string"), }), }, ) diff --git a/rulesets/rule.go b/rulesets/rule.go index 3a46498fa02..fdbaecf448f 100644 --- a/rulesets/rule.go +++ b/rulesets/rule.go @@ -37,12 +37,12 @@ func (r *RuleService) New(ctx context.Context, rulesetID string, params RuleNewP var env RuleNewResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/rulesets/%s/rules", accountOrZone, accountOrZoneID, rulesetID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -81,12 +81,12 @@ func (r *RuleService) Edit(ctx context.Context, rulesetID string, ruleID string, var env RuleEditResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/rulesets/%s/rules/%s", accountOrZone, accountOrZoneID, rulesetID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) @@ -97,65 +97,527 @@ func (r *RuleService) Edit(ctx context.Context, rulesetID string, ruleID string, return } -type RuleNewParams struct { +// This interface is a union satisfied by one of the following: +// [RuleNewParamsRulesetsBlockRule], [RuleNewParamsRulesetsExecuteRule], +// [RuleNewParamsRulesetsLogRule], [RuleNewParamsRulesetsSkipRule]. +type RuleNewParams interface { + ImplementsRuleNewParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type RuleNewParamsRulesetsBlockRule struct { // 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 object configuring where the rule will be placed. - Position param.Field[RuleNewParamsPosition] `json:"position"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleNewParamsRulesetsBlockRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleNewParamsRulesetsBlockRuleActionParameters] `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[RuleNewParamsRulesetsBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleNewParamsRulesetsBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleNewParamsRulesetsBlockRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleNewParamsRulesetsBlockRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleNewParamsRulesetsBlockRule) ImplementsRuleNewParams() { + +} + +// The action to perform when the rule matches. +type RuleNewParamsRulesetsBlockRuleAction string + +const ( + RuleNewParamsRulesetsBlockRuleActionBlock RuleNewParamsRulesetsBlockRuleAction = "block" +) + +func (r RuleNewParamsRulesetsBlockRuleAction) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsBlockRuleActionBlock: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleNewParamsRulesetsBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[RuleNewParamsRulesetsBlockRuleActionParametersResponse] `json:"response"` } -func (r RuleNewParams) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsRulesetsBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// An object configuring where the rule will be placed. -// -// Satisfied by [rulesets.RuleNewParamsPositionBeforePosition], -// [rulesets.RuleNewParamsPositionAfterPosition], -// [rulesets.RuleNewParamsPositionIndexPosition]. -type RuleNewParamsPosition interface { - implementsRulesetsRuleNewParamsPosition() +// The response to show when the block is applied. +type RuleNewParamsRulesetsBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r RuleNewParamsRulesetsBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type RuleNewParamsRulesetsBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleNewParamsRulesetsBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleNewParamsRulesetsExecuteRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleNewParamsRulesetsExecuteRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleNewParamsRulesetsExecuteRuleActionParameters] `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[RuleNewParamsRulesetsExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleNewParamsRulesetsExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleNewParamsRulesetsExecuteRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleNewParamsRulesetsExecuteRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleNewParamsRulesetsExecuteRule) ImplementsRuleNewParams() { + +} + +// The action to perform when the rule matches. +type RuleNewParamsRulesetsExecuteRuleAction string + +const ( + RuleNewParamsRulesetsExecuteRuleActionExecute RuleNewParamsRulesetsExecuteRuleAction = "execute" +) + +func (r RuleNewParamsRulesetsExecuteRuleAction) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsExecuteRuleActionExecute: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleNewParamsRulesetsExecuteRuleActionParameters struct { + // The ID of the ruleset to execute. + ID param.Field[string] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[RuleNewParamsRulesetsExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[RuleNewParamsRulesetsExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r RuleNewParamsRulesetsExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// An object configuring where the rule will be placed. -type RuleNewParamsPositionBeforePosition struct { - // The ID of another rule to place the rule before. An empty value causes the rule - // to be placed at the top. - Before param.Field[string] `json:"before"` +// The configuration to use for matched data logging. +type RuleNewParamsRulesetsExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` } -func (r RuleNewParamsPositionBeforePosition) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsRulesetsExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleNewParamsPositionBeforePosition) implementsRulesetsRuleNewParamsPosition() {} +// A set of overrides to apply to the target ruleset. +type RuleNewParamsRulesetsExecuteRuleActionParametersOverrides struct { + // An action to override all rules with. This option has lower precedence than rule + // and category overrides. + Action param.Field[string] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategory] `json:"categories"` + // Whether to enable execution of all rules. This option has lower precedence than + // rule and category overrides. + Enabled param.Field[bool] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRule] `json:"rules"` + // A sensitivity level to set for all rules. This option has lower precedence than + // rule and category overrides and is only applicable for DDoS phases. + SensitivityLevel param.Field[RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel] `json:"sensitivity_level"` +} + +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -// An object configuring where the rule will be placed. -type RuleNewParamsPositionAfterPosition struct { - // The ID of another rule to place the rule after. An empty value causes the rule - // to be placed at the bottom. - After param.Field[string] `json:"after"` +// A category-level override +type RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategory struct { + // The name of the category to override. + Category param.Field[string] `json:"category,required"` + // The action to override rules in the category with. + Action param.Field[string] `json:"action"` + // Whether to enable execution of rules in the category. + Enabled param.Field[bool] `json:"enabled"` + // The sensitivity level to use for rules in the category. + SensitivityLevel param.Field[RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel] `json:"sensitivity_level"` } -func (r RuleNewParamsPositionAfterPosition) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleNewParamsPositionAfterPosition) implementsRulesetsRuleNewParamsPosition() {} +// The sensitivity level to use for rules in the category. +type RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel string + +const ( + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "default" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "medium" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "low" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "eoff" +) -// An object configuring where the rule will be placed. -type RuleNewParamsPositionIndexPosition struct { - // An index at which to place the rule, where index 1 is the first rule. - Index param.Field[float64] `json:"index"` +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff: + return true + } + return false } -func (r RuleNewParamsPositionIndexPosition) MarshalJSON() (data []byte, err error) { +// A rule-level override +type RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRule struct { + // The ID of the rule to override. + ID param.Field[string] `json:"id,required"` + // The action to override the rule with. + Action param.Field[string] `json:"action"` + // Whether to enable execution of the rule. + Enabled param.Field[bool] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + // The sensitivity level to use for the rule. + SensitivityLevel param.Field[RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel] `json:"sensitivity_level"` +} + +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleNewParamsPositionIndexPosition) implementsRulesetsRuleNewParamsPosition() {} +// The sensitivity level to use for the rule. +type RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel string + +const ( + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "default" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "medium" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "low" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "eoff" +) + +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff: + return true + } + return false +} + +// A sensitivity level to set for all rules. This option has lower precedence than +// rule and category overrides and is only applicable for DDoS phases. +type RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel string + +const ( + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelDefault RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "default" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelMedium RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "medium" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelLow RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "low" + RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelEoff RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "eoff" +) + +func (r RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelDefault, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelMedium, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelLow, RuleNewParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelEoff: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleNewParamsRulesetsExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleNewParamsRulesetsExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleNewParamsRulesetsLogRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleNewParamsRulesetsLogRuleAction] `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[RuleNewParamsRulesetsLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleNewParamsRulesetsLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleNewParamsRulesetsLogRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleNewParamsRulesetsLogRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleNewParamsRulesetsLogRule) ImplementsRuleNewParams() { + +} + +// The action to perform when the rule matches. +type RuleNewParamsRulesetsLogRuleAction string + +const ( + RuleNewParamsRulesetsLogRuleActionLog RuleNewParamsRulesetsLogRuleAction = "log" +) + +func (r RuleNewParamsRulesetsLogRuleAction) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsLogRuleActionLog: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleNewParamsRulesetsLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleNewParamsRulesetsLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleNewParamsRulesetsSkipRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleNewParamsRulesetsSkipRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleNewParamsRulesetsSkipRuleActionParameters] `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[RuleNewParamsRulesetsSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleNewParamsRulesetsSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleNewParamsRulesetsSkipRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleNewParamsRulesetsSkipRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleNewParamsRulesetsSkipRule) ImplementsRuleNewParams() { + +} + +// The action to perform when the rule matches. +type RuleNewParamsRulesetsSkipRuleAction string + +const ( + RuleNewParamsRulesetsSkipRuleActionSkip RuleNewParamsRulesetsSkipRuleAction = "skip" +) + +func (r RuleNewParamsRulesetsSkipRuleAction) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsSkipRuleActionSkip: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleNewParamsRulesetsSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]RuleNewParamsRulesetsSkipRuleActionParametersPhase] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]RuleNewParamsRulesetsSkipRuleActionParametersProduct] `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[RuleNewParamsRulesetsSkipRuleActionParametersRuleset] `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 RuleNewParamsRulesetsSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A phase to skip the execution of. +type RuleNewParamsRulesetsSkipRuleActionParametersPhase string + +const ( + RuleNewParamsRulesetsSkipRuleActionParametersPhaseDDOSL4 RuleNewParamsRulesetsSkipRuleActionParametersPhase = "ddos_l4" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseDDOSL7 RuleNewParamsRulesetsSkipRuleActionParametersPhase = "ddos_l7" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPConfigSettings RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_config_settings" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPCustomErrors RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_custom_errors" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPLogCustomFields RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_log_custom_fields" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRatelimit RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_ratelimit" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestCacheSettings RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_cache_settings" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_dynamic_redirect" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_firewall_custom" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_firewall_managed" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestLateTransform RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_late_transform" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestOrigin RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_origin" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestRedirect RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_redirect" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSanitize RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_sanitize" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSbfm RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_sbfm" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_select_configuration" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestTransform RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_request_transform" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseCompression RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_response_compression" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_response_firewall_managed" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform RuleNewParamsRulesetsSkipRuleActionParametersPhase = "http_response_headers_transform" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransit RuleNewParamsRulesetsSkipRuleActionParametersPhase = "magic_transit" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransitIDsManaged RuleNewParamsRulesetsSkipRuleActionParametersPhase = "magic_transit_ids_managed" + RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransitManaged RuleNewParamsRulesetsSkipRuleActionParametersPhase = "magic_transit_managed" +) + +func (r RuleNewParamsRulesetsSkipRuleActionParametersPhase) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsSkipRuleActionParametersPhaseDDOSL4, RuleNewParamsRulesetsSkipRuleActionParametersPhaseDDOSL7, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPConfigSettings, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPCustomErrors, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPLogCustomFields, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRatelimit, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestCacheSettings, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestLateTransform, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestOrigin, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestRedirect, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSanitize, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSbfm, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestTransform, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseCompression, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged, RuleNewParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform, RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransit, RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransitIDsManaged, RuleNewParamsRulesetsSkipRuleActionParametersPhaseMagicTransitManaged: + return true + } + return false +} + +// The name of a legacy security product to skip the execution of. +type RuleNewParamsRulesetsSkipRuleActionParametersProduct string + +const ( + RuleNewParamsRulesetsSkipRuleActionParametersProductBic RuleNewParamsRulesetsSkipRuleActionParametersProduct = "bic" + RuleNewParamsRulesetsSkipRuleActionParametersProductHot RuleNewParamsRulesetsSkipRuleActionParametersProduct = "hot" + RuleNewParamsRulesetsSkipRuleActionParametersProductRateLimit RuleNewParamsRulesetsSkipRuleActionParametersProduct = "rateLimit" + RuleNewParamsRulesetsSkipRuleActionParametersProductSecurityLevel RuleNewParamsRulesetsSkipRuleActionParametersProduct = "securityLevel" + RuleNewParamsRulesetsSkipRuleActionParametersProductUABlock RuleNewParamsRulesetsSkipRuleActionParametersProduct = "uaBlock" + RuleNewParamsRulesetsSkipRuleActionParametersProductWAF RuleNewParamsRulesetsSkipRuleActionParametersProduct = "waf" + RuleNewParamsRulesetsSkipRuleActionParametersProductZoneLockdown RuleNewParamsRulesetsSkipRuleActionParametersProduct = "zoneLockdown" +) + +func (r RuleNewParamsRulesetsSkipRuleActionParametersProduct) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsSkipRuleActionParametersProductBic, RuleNewParamsRulesetsSkipRuleActionParametersProductHot, RuleNewParamsRulesetsSkipRuleActionParametersProductRateLimit, RuleNewParamsRulesetsSkipRuleActionParametersProductSecurityLevel, RuleNewParamsRulesetsSkipRuleActionParametersProductUABlock, RuleNewParamsRulesetsSkipRuleActionParametersProductWAF, RuleNewParamsRulesetsSkipRuleActionParametersProductZoneLockdown: + return true + } + return false +} + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type RuleNewParamsRulesetsSkipRuleActionParametersRuleset string + +const ( + RuleNewParamsRulesetsSkipRuleActionParametersRulesetCurrent RuleNewParamsRulesetsSkipRuleActionParametersRuleset = "current" +) + +func (r RuleNewParamsRulesetsSkipRuleActionParametersRuleset) IsKnown() bool { + switch r { + case RuleNewParamsRulesetsSkipRuleActionParametersRulesetCurrent: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleNewParamsRulesetsSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleNewParamsRulesetsSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} // A response object. type RuleNewResponseEnvelope struct { @@ -466,65 +928,527 @@ func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { return false } -type RuleEditParams struct { +// This interface is a union satisfied by one of the following: +// [RuleEditParamsRulesetsBlockRule], [RuleEditParamsRulesetsExecuteRule], +// [RuleEditParamsRulesetsLogRule], [RuleEditParamsRulesetsSkipRule]. +type RuleEditParams interface { + ImplementsRuleEditParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type RuleEditParamsRulesetsBlockRule struct { // 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 object configuring where the rule will be placed. - Position param.Field[RuleEditParamsPosition] `json:"position"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleEditParamsRulesetsBlockRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleEditParamsRulesetsBlockRuleActionParameters] `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[RuleEditParamsRulesetsBlockRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleEditParamsRulesetsBlockRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleEditParamsRulesetsBlockRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleEditParamsRulesetsBlockRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleEditParamsRulesetsBlockRule) ImplementsRuleEditParams() { + +} + +// The action to perform when the rule matches. +type RuleEditParamsRulesetsBlockRuleAction string + +const ( + RuleEditParamsRulesetsBlockRuleActionBlock RuleEditParamsRulesetsBlockRuleAction = "block" +) + +func (r RuleEditParamsRulesetsBlockRuleAction) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsBlockRuleActionBlock: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleEditParamsRulesetsBlockRuleActionParameters struct { + // The response to show when the block is applied. + Response param.Field[RuleEditParamsRulesetsBlockRuleActionParametersResponse] `json:"response"` } -func (r RuleEditParams) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsRulesetsBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// An object configuring where the rule will be placed. -// -// Satisfied by [rulesets.RuleEditParamsPositionBeforePosition], -// [rulesets.RuleEditParamsPositionAfterPosition], -// [rulesets.RuleEditParamsPositionIndexPosition]. -type RuleEditParamsPosition interface { - implementsRulesetsRuleEditParamsPosition() +// The response to show when the block is applied. +type RuleEditParamsRulesetsBlockRuleActionParametersResponse struct { + // The content to return. + Content param.Field[string] `json:"content,required"` + // The type of the content to return. + ContentType param.Field[string] `json:"content_type,required"` + // The status code to return. + StatusCode param.Field[int64] `json:"status_code,required"` +} + +func (r RuleEditParamsRulesetsBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// An object configuring the rule's logging behavior. +type RuleEditParamsRulesetsBlockRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleEditParamsRulesetsBlockRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleEditParamsRulesetsExecuteRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleEditParamsRulesetsExecuteRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleEditParamsRulesetsExecuteRuleActionParameters] `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[RuleEditParamsRulesetsExecuteRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleEditParamsRulesetsExecuteRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleEditParamsRulesetsExecuteRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleEditParamsRulesetsExecuteRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleEditParamsRulesetsExecuteRule) ImplementsRuleEditParams() { + +} + +// The action to perform when the rule matches. +type RuleEditParamsRulesetsExecuteRuleAction string + +const ( + RuleEditParamsRulesetsExecuteRuleActionExecute RuleEditParamsRulesetsExecuteRuleAction = "execute" +) + +func (r RuleEditParamsRulesetsExecuteRuleAction) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsExecuteRuleActionExecute: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleEditParamsRulesetsExecuteRuleActionParameters struct { + // The ID of the ruleset to execute. + ID param.Field[string] `json:"id,required"` + // The configuration to use for matched data logging. + MatchedData param.Field[RuleEditParamsRulesetsExecuteRuleActionParametersMatchedData] `json:"matched_data"` + // A set of overrides to apply to the target ruleset. + Overrides param.Field[RuleEditParamsRulesetsExecuteRuleActionParametersOverrides] `json:"overrides"` +} + +func (r RuleEditParamsRulesetsExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// An object configuring where the rule will be placed. -type RuleEditParamsPositionBeforePosition struct { - // The ID of another rule to place the rule before. An empty value causes the rule - // to be placed at the top. - Before param.Field[string] `json:"before"` +// The configuration to use for matched data logging. +type RuleEditParamsRulesetsExecuteRuleActionParametersMatchedData struct { + // The public key to encrypt matched data logs with. + PublicKey param.Field[string] `json:"public_key,required"` } -func (r RuleEditParamsPositionBeforePosition) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsRulesetsExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleEditParamsPositionBeforePosition) implementsRulesetsRuleEditParamsPosition() {} +// A set of overrides to apply to the target ruleset. +type RuleEditParamsRulesetsExecuteRuleActionParametersOverrides struct { + // An action to override all rules with. This option has lower precedence than rule + // and category overrides. + Action param.Field[string] `json:"action"` + // A list of category-level overrides. This option has the second-highest + // precedence after rule-level overrides. + Categories param.Field[[]RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategory] `json:"categories"` + // Whether to enable execution of all rules. This option has lower precedence than + // rule and category overrides. + Enabled param.Field[bool] `json:"enabled"` + // A list of rule-level overrides. This option has the highest precedence. + Rules param.Field[[]RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRule] `json:"rules"` + // A sensitivity level to set for all rules. This option has lower precedence than + // rule and category overrides and is only applicable for DDoS phases. + SensitivityLevel param.Field[RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel] `json:"sensitivity_level"` +} + +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -// An object configuring where the rule will be placed. -type RuleEditParamsPositionAfterPosition struct { - // The ID of another rule to place the rule after. An empty value causes the rule - // to be placed at the bottom. - After param.Field[string] `json:"after"` +// A category-level override +type RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategory struct { + // The name of the category to override. + Category param.Field[string] `json:"category,required"` + // The action to override rules in the category with. + Action param.Field[string] `json:"action"` + // Whether to enable execution of rules in the category. + Enabled param.Field[bool] `json:"enabled"` + // The sensitivity level to use for rules in the category. + SensitivityLevel param.Field[RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel] `json:"sensitivity_level"` } -func (r RuleEditParamsPositionAfterPosition) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleEditParamsPositionAfterPosition) implementsRulesetsRuleEditParamsPosition() {} +// The sensitivity level to use for rules in the category. +type RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel string + +const ( + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "default" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "medium" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "low" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "eoff" +) -// An object configuring where the rule will be placed. -type RuleEditParamsPositionIndexPosition struct { - // An index at which to place the rule, where index 1 is the first rule. - Index param.Field[float64] `json:"index"` +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff: + return true + } + return false } -func (r RuleEditParamsPositionIndexPosition) MarshalJSON() (data []byte, err error) { +// A rule-level override +type RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRule struct { + // The ID of the rule to override. + ID param.Field[string] `json:"id,required"` + // The action to override the rule with. + Action param.Field[string] `json:"action"` + // Whether to enable execution of the rule. + Enabled param.Field[bool] `json:"enabled"` + // The score threshold to use for the rule. + ScoreThreshold param.Field[int64] `json:"score_threshold"` + // The sensitivity level to use for the rule. + SensitivityLevel param.Field[RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel] `json:"sensitivity_level"` +} + +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleEditParamsPositionIndexPosition) implementsRulesetsRuleEditParamsPosition() {} +// The sensitivity level to use for the rule. +type RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel string + +const ( + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "default" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "medium" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "low" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "eoff" +) + +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevel) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff: + return true + } + return false +} + +// A sensitivity level to set for all rules. This option has lower precedence than +// rule and category overrides and is only applicable for DDoS phases. +type RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel string + +const ( + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelDefault RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "default" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelMedium RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "medium" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelLow RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "low" + RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelEoff RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel = "eoff" +) + +func (r RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevel) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelDefault, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelMedium, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelLow, RuleEditParamsRulesetsExecuteRuleActionParametersOverridesSensitivityLevelEoff: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleEditParamsRulesetsExecuteRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleEditParamsRulesetsExecuteRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleEditParamsRulesetsLogRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleEditParamsRulesetsLogRuleAction] `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[RuleEditParamsRulesetsLogRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleEditParamsRulesetsLogRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleEditParamsRulesetsLogRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleEditParamsRulesetsLogRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleEditParamsRulesetsLogRule) ImplementsRuleEditParams() { + +} + +// The action to perform when the rule matches. +type RuleEditParamsRulesetsLogRuleAction string + +const ( + RuleEditParamsRulesetsLogRuleActionLog RuleEditParamsRulesetsLogRuleAction = "log" +) + +func (r RuleEditParamsRulesetsLogRuleAction) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsLogRuleActionLog: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleEditParamsRulesetsLogRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleEditParamsRulesetsLogRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RuleEditParamsRulesetsSkipRule struct { + // 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"` + // The unique ID of the rule. + ID param.Field[string] `json:"id"` + // The action to perform when the rule matches. + Action param.Field[RuleEditParamsRulesetsSkipRuleAction] `json:"action"` + // The parameters configuring the rule's action. + ActionParameters param.Field[RuleEditParamsRulesetsSkipRuleActionParameters] `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[RuleEditParamsRulesetsSkipRuleLogging] `json:"logging"` + // The reference of the rule (the rule ID by default). + Ref param.Field[string] `json:"ref"` +} + +func (r RuleEditParamsRulesetsSkipRule) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RuleEditParamsRulesetsSkipRule) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r RuleEditParamsRulesetsSkipRule) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (RuleEditParamsRulesetsSkipRule) ImplementsRuleEditParams() { + +} + +// The action to perform when the rule matches. +type RuleEditParamsRulesetsSkipRuleAction string + +const ( + RuleEditParamsRulesetsSkipRuleActionSkip RuleEditParamsRulesetsSkipRuleAction = "skip" +) + +func (r RuleEditParamsRulesetsSkipRuleAction) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsSkipRuleActionSkip: + return true + } + return false +} + +// The parameters configuring the rule's action. +type RuleEditParamsRulesetsSkipRuleActionParameters struct { + // A list of phases to skip the execution of. This option is incompatible with the + // ruleset and rulesets options. + Phases param.Field[[]RuleEditParamsRulesetsSkipRuleActionParametersPhase] `json:"phases"` + // A list of legacy security products to skip the execution of. + Products param.Field[[]RuleEditParamsRulesetsSkipRuleActionParametersProduct] `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[RuleEditParamsRulesetsSkipRuleActionParametersRuleset] `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 RuleEditParamsRulesetsSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A phase to skip the execution of. +type RuleEditParamsRulesetsSkipRuleActionParametersPhase string + +const ( + RuleEditParamsRulesetsSkipRuleActionParametersPhaseDDOSL4 RuleEditParamsRulesetsSkipRuleActionParametersPhase = "ddos_l4" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseDDOSL7 RuleEditParamsRulesetsSkipRuleActionParametersPhase = "ddos_l7" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPConfigSettings RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_config_settings" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPCustomErrors RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_custom_errors" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPLogCustomFields RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_log_custom_fields" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRatelimit RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_ratelimit" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestCacheSettings RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_cache_settings" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_dynamic_redirect" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_firewall_custom" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_firewall_managed" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestLateTransform RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_late_transform" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestOrigin RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_origin" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestRedirect RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_redirect" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSanitize RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_sanitize" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSbfm RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_sbfm" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_select_configuration" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestTransform RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_request_transform" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseCompression RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_response_compression" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_response_firewall_managed" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform RuleEditParamsRulesetsSkipRuleActionParametersPhase = "http_response_headers_transform" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransit RuleEditParamsRulesetsSkipRuleActionParametersPhase = "magic_transit" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransitIDsManaged RuleEditParamsRulesetsSkipRuleActionParametersPhase = "magic_transit_ids_managed" + RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransitManaged RuleEditParamsRulesetsSkipRuleActionParametersPhase = "magic_transit_managed" +) + +func (r RuleEditParamsRulesetsSkipRuleActionParametersPhase) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsSkipRuleActionParametersPhaseDDOSL4, RuleEditParamsRulesetsSkipRuleActionParametersPhaseDDOSL7, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPConfigSettings, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPCustomErrors, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPLogCustomFields, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRatelimit, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestCacheSettings, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestLateTransform, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestOrigin, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestRedirect, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSanitize, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSbfm, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPRequestTransform, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseCompression, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged, RuleEditParamsRulesetsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform, RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransit, RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransitIDsManaged, RuleEditParamsRulesetsSkipRuleActionParametersPhaseMagicTransitManaged: + return true + } + return false +} + +// The name of a legacy security product to skip the execution of. +type RuleEditParamsRulesetsSkipRuleActionParametersProduct string + +const ( + RuleEditParamsRulesetsSkipRuleActionParametersProductBic RuleEditParamsRulesetsSkipRuleActionParametersProduct = "bic" + RuleEditParamsRulesetsSkipRuleActionParametersProductHot RuleEditParamsRulesetsSkipRuleActionParametersProduct = "hot" + RuleEditParamsRulesetsSkipRuleActionParametersProductRateLimit RuleEditParamsRulesetsSkipRuleActionParametersProduct = "rateLimit" + RuleEditParamsRulesetsSkipRuleActionParametersProductSecurityLevel RuleEditParamsRulesetsSkipRuleActionParametersProduct = "securityLevel" + RuleEditParamsRulesetsSkipRuleActionParametersProductUABlock RuleEditParamsRulesetsSkipRuleActionParametersProduct = "uaBlock" + RuleEditParamsRulesetsSkipRuleActionParametersProductWAF RuleEditParamsRulesetsSkipRuleActionParametersProduct = "waf" + RuleEditParamsRulesetsSkipRuleActionParametersProductZoneLockdown RuleEditParamsRulesetsSkipRuleActionParametersProduct = "zoneLockdown" +) + +func (r RuleEditParamsRulesetsSkipRuleActionParametersProduct) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsSkipRuleActionParametersProductBic, RuleEditParamsRulesetsSkipRuleActionParametersProductHot, RuleEditParamsRulesetsSkipRuleActionParametersProductRateLimit, RuleEditParamsRulesetsSkipRuleActionParametersProductSecurityLevel, RuleEditParamsRulesetsSkipRuleActionParametersProductUABlock, RuleEditParamsRulesetsSkipRuleActionParametersProductWAF, RuleEditParamsRulesetsSkipRuleActionParametersProductZoneLockdown: + return true + } + return false +} + +// A ruleset to skip the execution of. This option is incompatible with the +// rulesets, rules and phases options. +type RuleEditParamsRulesetsSkipRuleActionParametersRuleset string + +const ( + RuleEditParamsRulesetsSkipRuleActionParametersRulesetCurrent RuleEditParamsRulesetsSkipRuleActionParametersRuleset = "current" +) + +func (r RuleEditParamsRulesetsSkipRuleActionParametersRuleset) IsKnown() bool { + switch r { + case RuleEditParamsRulesetsSkipRuleActionParametersRulesetCurrent: + return true + } + return false +} + +// An object configuring the rule's logging behavior. +type RuleEditParamsRulesetsSkipRuleLogging struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r RuleEditParamsRulesetsSkipRuleLogging) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} // A response object. type RuleEditResponseEnvelope struct { diff --git a/rulesets/rule_test.go b/rulesets/rule_test.go index 24c85fb0542..8d8416a722c 100644 --- a/rulesets/rule_test.go +++ b/rulesets/rule_test.go @@ -31,12 +31,25 @@ func TestRuleNewWithOptionalParams(t *testing.T) { _, err := client.Rulesets.Rules.New( context.TODO(), "2f2feab2026849078ba485f918791bdc", - rulesets.RuleNewParams{ + rulesets.RuleNewParamsRulesetsBlockRule{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - Position: cloudflare.F[rulesets.RuleNewParamsPosition](rulesets.RuleNewParamsPositionBeforePosition(rulesets.RuleNewParamsPositionBeforePosition{ - Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), - })), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Action: cloudflare.F(rulesets.RuleNewParamsRulesetsBlockRuleActionBlock), + ActionParameters: cloudflare.F(rulesets.RuleNewParamsRulesetsBlockRuleActionParameters{ + Response: cloudflare.F(rulesets.RuleNewParamsRulesetsBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + Logging: cloudflare.F(rulesets.RuleNewParamsRulesetsBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), }, ) if err != nil { @@ -98,12 +111,25 @@ func TestRuleEditWithOptionalParams(t *testing.T) { context.TODO(), "2f2feab2026849078ba485f918791bdc", "3a03d665bac047339bb530ecb439a90d", - rulesets.RuleEditParams{ + rulesets.RuleEditParamsRulesetsBlockRule{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - Position: cloudflare.F[rulesets.RuleEditParamsPosition](rulesets.RuleEditParamsPositionBeforePosition(rulesets.RuleEditParamsPositionBeforePosition{ - Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), - })), + ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), + Action: cloudflare.F(rulesets.RuleEditParamsRulesetsBlockRuleActionBlock), + ActionParameters: cloudflare.F(rulesets.RuleEditParamsRulesetsBlockRuleActionParameters{ + Response: cloudflare.F(rulesets.RuleEditParamsRulesetsBlockRuleActionParametersResponse{ + Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), + ContentType: cloudflare.F("application/json"), + StatusCode: cloudflare.F(int64(400)), + }), + }), + Description: cloudflare.F("Block when the IP address is not 1.1.1.1"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("ip.src ne 1.1.1.1"), + Logging: cloudflare.F(rulesets.RuleEditParamsRulesetsBlockRuleLogging{ + Enabled: cloudflare.F(true), + }), + Ref: cloudflare.F("my_ref"), }, ) if err != nil { diff --git a/workers/ai.go b/workers/ai.go index d70b192f130..ba6b8be0251 100644 --- a/workers/ai.go +++ b/workers/ai.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "io" "mime/multipart" "net/http" "reflect" @@ -48,7 +49,7 @@ func NewAIService(opts ...option.RequestOption) (r *AIService) { func (r *AIService) Run(ctx context.Context, modelName string, params AIRunParams, opts ...option.RequestOption) (res *AIRunResponse, err error) { opts = append(r.Options[:], opts...) var env AIRunResponseEnvelope - path := fmt.Sprintf("accounts/%s/ai/run/%s", params.AccountID, modelName) + path := fmt.Sprintf("accounts/%s/ai/run/%s", params.getAccountID(), modelName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -308,12 +309,108 @@ func (r aiRunResponseImageToTextJSON) RawJSON() string { func (r AIRunResponseImageToText) ImplementsWorkersAIRunResponse() {} -type AIRunParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[AIRunParamsBody] `json:"body,required" format:"binary"` +// This interface is a union satisfied by one of the following: +// [AIRunParamsTextClassification], [AIRunParamsTextToImage], +// [AIRunParamsSentenceSimilarity], [AIRunParamsTextEmbeddings], +// [AIRunParamsVariant4], [AIRunParamsVariant5], [AIRunParamsVariant6], +// [AIRunParamsVariant7], [AIRunParamsVariant8], [AIRunParamsVariant9], +// [AIRunParamsVariant10], [AIRunParamsVariant11], [AIRunParamsTranslation], +// [AIRunParamsSummarization], [AIRunParamsVariant14], [AIRunParamsVariant15]. +type AIRunParams interface { + ImplementsAIRunParams() + + getAccountID() param.Field[string] +} + +type AIRunParamsTextClassification struct { + AccountID param.Field[string] `path:"account_id,required"` + Text param.Field[string] `json:"text,required"` +} + +func (r AIRunParamsTextClassification) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AIRunParamsTextClassification) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsTextClassification) ImplementsAIRunParams() { + +} + +type AIRunParamsTextToImage struct { + AccountID param.Field[string] `path:"account_id,required"` + Prompt param.Field[string] `json:"prompt,required"` + Guidance param.Field[float64] `json:"guidance"` + Image param.Field[[]float64] `json:"image"` + Mask param.Field[[]float64] `json:"mask"` + NumSteps param.Field[int64] `json:"num_steps"` + Strength param.Field[float64] `json:"strength"` +} + +func (r AIRunParamsTextToImage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AIRunParamsTextToImage) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsTextToImage) ImplementsAIRunParams() { + +} + +type AIRunParamsSentenceSimilarity struct { + AccountID param.Field[string] `path:"account_id,required"` + Sentences param.Field[[]string] `json:"sentences,required"` + Source param.Field[string] `json:"source,required"` +} + +func (r AIRunParamsSentenceSimilarity) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AIRunParamsSentenceSimilarity) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsSentenceSimilarity) ImplementsAIRunParams() { + +} + +type AIRunParamsTextEmbeddings struct { + AccountID param.Field[string] `path:"account_id,required"` + Text param.Field[AIRunParamsTextEmbeddingsText] `json:"text,required"` +} + +func (r AIRunParamsTextEmbeddings) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AIRunParamsTextEmbeddings) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsTextEmbeddings) ImplementsAIRunParams() { + +} + +// Satisfied by [shared.UnionString], [workers.AIRunParamsTextEmbeddingsTextArray]. +type AIRunParamsTextEmbeddingsText interface { + ImplementsWorkersAIRunParamsTextEmbeddingsText() } -func (r AIRunParams) MarshalMultipart() (data []byte, contentType string, err error) { +type AIRunParamsTextEmbeddingsTextArray []string + +func (r AIRunParamsTextEmbeddingsTextArray) ImplementsWorkersAIRunParamsTextEmbeddingsText() {} + +type AIRunParamsVariant4 struct { + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[io.Reader] `json:"body,required" format:"binary"` +} + +func (r AIRunParamsVariant4) MarshalMultipart() (data []byte, contentType string, err error) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) err = apiform.MarshalRoot(r, writer) @@ -328,129 +425,253 @@ func (r AIRunParams) MarshalMultipart() (data []byte, contentType string, err er return buf.Bytes(), writer.FormDataContentType(), nil } -// Satisfied by [workers.AIRunParamsBodyTextClassification], -// [workers.AIRunParamsBodyTextToImage], -// [workers.AIRunParamsBodySentenceSimilarity], -// [workers.AIRunParamsBodyTextEmbeddings], [shared.UnionString], -// [workers.AIRunParamsBodyObject], [shared.UnionString], -// [workers.AIRunParamsBodyImageClassification], [shared.UnionString], -// [workers.AIRunParamsBodyObjectDetection], [workers.AIRunParamsBodyObject], -// [workers.AIRunParamsBodyObject], [workers.AIRunParamsBodyTranslation], -// [workers.AIRunParamsBodySummarization], [shared.UnionString], -// [workers.AIRunParamsBodyObject]. -type AIRunParamsBody interface { - ImplementsWorkersAIRunParamsBody() +func (r AIRunParamsVariant4) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant4) ImplementsAIRunParams() { + } -type AIRunParamsBodyTextClassification struct { - Text param.Field[string] `json:"text,required"` +type AIRunParamsVariant5 struct { + AccountID param.Field[string] `path:"account_id,required"` + Audio param.Field[[]float64] `json:"audio"` } -func (r AIRunParamsBodyTextClassification) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsVariant5) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodyTextClassification) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant5) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant5) ImplementsAIRunParams() { -type AIRunParamsBodyTextToImage struct { - Prompt param.Field[string] `json:"prompt,required"` - Guidance param.Field[float64] `json:"guidance"` - Image param.Field[[]float64] `json:"image"` - Mask param.Field[[]float64] `json:"mask"` - NumSteps param.Field[int64] `json:"num_steps"` - Strength param.Field[float64] `json:"strength"` } -func (r AIRunParamsBodyTextToImage) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +type AIRunParamsVariant6 struct { + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[io.Reader] `json:"body,required" format:"binary"` } -func (r AIRunParamsBodyTextToImage) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant6) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} -type AIRunParamsBodySentenceSimilarity struct { - Sentences param.Field[[]string] `json:"sentences,required"` - Source param.Field[string] `json:"source,required"` +func (r AIRunParamsVariant6) getAccountID() param.Field[string] { + return r.AccountID } -func (r AIRunParamsBodySentenceSimilarity) MarshalJSON() (data []byte, err error) { +func (AIRunParamsVariant6) ImplementsAIRunParams() { + +} + +type AIRunParamsVariant7 struct { + AccountID param.Field[string] `path:"account_id,required"` + Image param.Field[[]float64] `json:"image"` +} + +func (r AIRunParamsVariant7) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodySentenceSimilarity) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant7) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant7) ImplementsAIRunParams() { -type AIRunParamsBodyTextEmbeddings struct { - Text param.Field[AIRunParamsBodyTextEmbeddingsText] `json:"text,required"` } -func (r AIRunParamsBodyTextEmbeddings) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +type AIRunParamsVariant8 struct { + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[io.Reader] `json:"body,required" format:"binary"` } -func (r AIRunParamsBodyTextEmbeddings) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant8) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} -// Satisfied by [shared.UnionString], -// [workers.AIRunParamsBodyTextEmbeddingsTextArray]. -type AIRunParamsBodyTextEmbeddingsText interface { - ImplementsWorkersAIRunParamsBodyTextEmbeddingsText() +func (r AIRunParamsVariant8) getAccountID() param.Field[string] { + return r.AccountID } -type AIRunParamsBodyTextEmbeddingsTextArray []string +func (AIRunParamsVariant8) ImplementsAIRunParams() { -func (r AIRunParamsBodyTextEmbeddingsTextArray) ImplementsWorkersAIRunParamsBodyTextEmbeddingsText() { } -type AIRunParamsBodyObject struct { - Audio param.Field[[]float64] `json:"audio"` +type AIRunParamsVariant9 struct { + AccountID param.Field[string] `path:"account_id,required"` + Image param.Field[[]float64] `json:"image"` } -func (r AIRunParamsBodyObject) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsVariant9) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodyObject) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant9) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant9) ImplementsAIRunParams() { -type AIRunParamsBodyImageClassification struct { - Image param.Field[[]float64] `json:"image"` } -func (r AIRunParamsBodyImageClassification) MarshalJSON() (data []byte, err error) { +type AIRunParamsVariant10 struct { + AccountID param.Field[string] `path:"account_id,required"` + Prompt param.Field[string] `json:"prompt,required"` + Lora param.Field[string] `json:"lora"` + MaxTokens param.Field[int64] `json:"max_tokens"` + Raw param.Field[bool] `json:"raw"` + Stream param.Field[bool] `json:"stream"` +} + +func (r AIRunParamsVariant10) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodyImageClassification) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant10) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant10) ImplementsAIRunParams() { -type AIRunParamsBodyObjectDetection struct { - Image param.Field[[]float64] `json:"image"` } -func (r AIRunParamsBodyObjectDetection) MarshalJSON() (data []byte, err error) { +type AIRunParamsVariant11 struct { + AccountID param.Field[string] `path:"account_id,required"` + Messages param.Field[[]AIRunParamsVariant11Message] `json:"messages,required"` + MaxTokens param.Field[int64] `json:"max_tokens"` + Stream param.Field[bool] `json:"stream"` +} + +func (r AIRunParamsVariant11) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodyObjectDetection) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant11) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant11) ImplementsAIRunParams() { + +} + +type AIRunParamsVariant11Message struct { + Content param.Field[string] `json:"content,required"` + Role param.Field[string] `json:"role,required"` +} -type AIRunParamsBodyTranslation struct { +func (r AIRunParamsVariant11Message) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AIRunParamsTranslation struct { + AccountID param.Field[string] `path:"account_id,required"` TargetLang param.Field[string] `json:"target_lang,required"` Text param.Field[string] `json:"text,required"` SourceLang param.Field[string] `json:"source_lang"` } -func (r AIRunParamsBodyTranslation) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsTranslation) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodyTranslation) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsTranslation) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsTranslation) ImplementsAIRunParams() { -type AIRunParamsBodySummarization struct { +} + +type AIRunParamsSummarization struct { + AccountID param.Field[string] `path:"account_id,required"` InputText param.Field[string] `json:"input_text,required"` MaxLength param.Field[int64] `json:"max_length"` } -func (r AIRunParamsBodySummarization) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsSummarization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AIRunParamsSummarization) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsSummarization) ImplementsAIRunParams() { + +} + +type AIRunParamsVariant14 struct { + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[io.Reader] `json:"body,required" format:"binary"` +} + +func (r AIRunParamsVariant14) MarshalMultipart() (data []byte, contentType string, err error) { + buf := bytes.NewBuffer(nil) + writer := multipart.NewWriter(buf) + err = apiform.MarshalRoot(r, writer) + if err != nil { + writer.Close() + return nil, "", err + } + err = writer.Close() + if err != nil { + return nil, "", err + } + return buf.Bytes(), writer.FormDataContentType(), nil +} + +func (r AIRunParamsVariant14) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant14) ImplementsAIRunParams() { + +} + +type AIRunParamsVariant15 struct { + AccountID param.Field[string] `path:"account_id,required"` + Image param.Field[[]float64] `json:"image"` + MaxTokens param.Field[int64] `json:"max_tokens"` + Prompt param.Field[string] `json:"prompt"` +} + +func (r AIRunParamsVariant15) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsBodySummarization) ImplementsWorkersAIRunParamsBody() {} +func (r AIRunParamsVariant15) getAccountID() param.Field[string] { + return r.AccountID +} + +func (AIRunParamsVariant15) ImplementsAIRunParams() { + +} type AIRunResponseEnvelope struct { Result AIRunResponse `json:"result" format:"binary"` diff --git a/workers/ai_test.go b/workers/ai_test.go index 9a94e90eee6..24cf2450bc8 100644 --- a/workers/ai_test.go +++ b/workers/ai_test.go @@ -31,11 +31,9 @@ func TestAIRunWithOptionalParams(t *testing.T) { _, err := client.Workers.AI.Run( context.TODO(), "string", - workers.AIRunParams{ + workers.AIRunParamsTextClassification{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[workers.AIRunParamsBody](workers.AIRunParamsBodyTextClassification(workers.AIRunParamsBodyTextClassification{ - Text: cloudflare.F("string"), - })), + Text: cloudflare.F("string"), }, ) if err != nil { diff --git a/workers/script.go b/workers/script.go index 28d61b8fb9a..554c3622c6a 100644 --- a/workers/script.go +++ b/workers/script.go @@ -55,7 +55,7 @@ func NewScriptService(opts ...option.RequestOption) (r *ScriptService) { func (r *ScriptService) Update(ctx context.Context, scriptName string, params ScriptUpdateParams, opts ...option.RequestOption) (res *WorkersScript, err error) { opts = append(r.Options[:], opts...) var env ScriptUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/scripts/%s", params.AccountID, scriptName) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s", params.getAccountID(), scriptName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -170,7 +170,15 @@ func (r workersScriptTailConsumerJSON) RawJSON() string { return r.raw } -type ScriptUpdateParams struct { +// This interface is a union satisfied by one of the following: +// [ScriptUpdateParamsVariant0], [ScriptUpdateParamsVariant1]. +type ScriptUpdateParams interface { + ImplementsScriptUpdateParams() + + getAccountID() param.Field[string] +} + +type ScriptUpdateParamsVariant0 struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // Rollback to provided deployment based on deployment ID. Request body will only @@ -181,14 +189,11 @@ type ScriptUpdateParams struct { // may be provided as separate named parts, but at least one module must be present // and referenced in the metadata as `main_module` or `body_part` by part name. AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` - // Rollback message to be associated with this deployment. Only parsed when query - // param `"rollback_to"` is present. - Message param.Field[string] `json:"message"` // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[ScriptUpdateParamsMetadata] `json:"metadata"` + Metadata param.Field[ScriptUpdateParamsVariant0Metadata] `json:"metadata"` } -func (r ScriptUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { +func (r ScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) err = apiform.MarshalRoot(r, writer) @@ -203,16 +208,25 @@ func (r ScriptUpdateParams) MarshalMultipart() (data []byte, contentType string, return buf.Bytes(), writer.FormDataContentType(), nil } -// URLQuery serializes [ScriptUpdateParams]'s query parameters as `url.Values`. -func (r ScriptUpdateParams) URLQuery() (v url.Values) { +// URLQuery serializes [ScriptUpdateParamsVariant0]'s query parameters as +// `url.Values`. +func (r ScriptUpdateParamsVariant0) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ ArrayFormat: apiquery.ArrayQueryFormatComma, NestedFormat: apiquery.NestedQueryFormatBrackets, }) } +func (r ScriptUpdateParamsVariant0) getAccountID() param.Field[string] { + return r.AccountID +} + +func (ScriptUpdateParamsVariant0) ImplementsScriptUpdateParams() { + +} + // JSON encoded metadata about the uploaded parts and Worker configuration. -type ScriptUpdateParamsMetadata struct { +type ScriptUpdateParamsVariant0Metadata struct { // List of bindings available to the worker. Bindings param.Field[[]interface{}] `json:"bindings"` // Name of the part in the multipart request that contains the script (e.g. the @@ -234,33 +248,33 @@ type ScriptUpdateParamsMetadata struct { // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. MainModule param.Field[string] `json:"main_module"` // Migrations to apply for Durable Objects associated with this Worker. - Migrations param.Field[ScriptUpdateParamsMetadataMigrations] `json:"migrations"` - Placement param.Field[ScriptUpdateParamsMetadataPlacement] `json:"placement"` + Migrations param.Field[ScriptUpdateParamsVariant0MetadataMigrations] `json:"migrations"` + Placement param.Field[ScriptUpdateParamsVariant0MetadataPlacement] `json:"placement"` // List of strings to use as tags for this Worker Tags param.Field[[]string] `json:"tags"` // List of Workers that will consume logs from the attached Worker. - TailConsumers param.Field[[]ScriptUpdateParamsMetadataTailConsumer] `json:"tail_consumers"` + TailConsumers param.Field[[]ScriptUpdateParamsVariant0MetadataTailConsumer] `json:"tail_consumers"` // Usage model to apply to invocations. - UsageModel param.Field[ScriptUpdateParamsMetadataUsageModel] `json:"usage_model"` + UsageModel param.Field[ScriptUpdateParamsVariant0MetadataUsageModel] `json:"usage_model"` // Key-value pairs to use as tags for this version of this Worker VersionTags param.Field[interface{}] `json:"version_tags"` } -func (r ScriptUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Migrations to apply for Durable Objects associated with this Worker. // // Satisfied by -// [workers.ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations], -// [workers.ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations]. -type ScriptUpdateParamsMetadataMigrations interface { - implementsWorkersScriptUpdateParamsMetadataMigrations() +// [workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations], +// [workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations]. +type ScriptUpdateParamsVariant0MetadataMigrations interface { + implementsWorkersScriptUpdateParamsVariant0MetadataMigrations() } // A single set of migrations to apply. -type ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations struct { // A list of classes to delete Durable Object namespaces from. DeletedClasses param.Field[[]string] `json:"deleted_classes"` // A list of classes to create Durable Object namespaces from. @@ -271,120 +285,120 @@ type ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations struct { // don't match, the upload is rejected. OldTag param.Field[string] `json:"old_tag"` // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses param.Field[[]ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass] `json:"renamed_classes"` + RenamedClasses param.Field[[]ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass] `json:"renamed_classes"` // A list of transfers for Durable Object namespaces from a different Worker and // class to a class defined in this Worker. - TransferredClasses param.Field[[]ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass] `json:"transferred_classes"` + TransferredClasses param.Field[[]ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass] `json:"transferred_classes"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations) implementsWorkersScriptUpdateParamsMetadataMigrations() { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations) implementsWorkersScriptUpdateParamsVariant0MetadataMigrations() { } -type ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass struct { From param.Field[string] `json:"from"` To param.Field[string] `json:"to"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass struct { From param.Field[string] `json:"from"` FromScript param.Field[string] `json:"from_script"` To param.Field[string] `json:"to"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations struct { // Tag to set as the latest migration tag. NewTag param.Field[string] `json:"new_tag"` // Tag used to verify against the latest migration tag for this Worker. If they // don't match, the upload is rejected. OldTag param.Field[string] `json:"old_tag"` // Migrations to apply in order. - Steps param.Field[[]ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep] `json:"steps"` + Steps param.Field[[]ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep] `json:"steps"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations) implementsWorkersScriptUpdateParamsMetadataMigrations() { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations) implementsWorkersScriptUpdateParamsVariant0MetadataMigrations() { } -type ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep struct { // A list of classes to delete Durable Object namespaces from. DeletedClasses param.Field[[]string] `json:"deleted_classes"` // A list of classes to create Durable Object namespaces from. NewClasses param.Field[[]string] `json:"new_classes"` // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses param.Field[[]ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass] `json:"renamed_classes"` + RenamedClasses param.Field[[]ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass] `json:"renamed_classes"` // A list of transfers for Durable Object namespaces from a different Worker and // class to a class defined in this Worker. - TransferredClasses param.Field[[]ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` + TransferredClasses param.Field[[]ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass struct { From param.Field[string] `json:"from"` To param.Field[string] `json:"to"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass struct { +type ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass struct { From param.Field[string] `json:"from"` FromScript param.Field[string] `json:"from_script"` To param.Field[string] `json:"to"` } -func (r ScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ScriptUpdateParamsMetadataPlacement struct { +type ScriptUpdateParamsVariant0MetadataPlacement struct { // Enables // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). // Only `"smart"` is currently supported - Mode param.Field[ScriptUpdateParamsMetadataPlacementMode] `json:"mode"` + Mode param.Field[ScriptUpdateParamsVariant0MetadataPlacementMode] `json:"mode"` } -func (r ScriptUpdateParamsMetadataPlacement) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataPlacement) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Enables // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). // Only `"smart"` is currently supported -type ScriptUpdateParamsMetadataPlacementMode string +type ScriptUpdateParamsVariant0MetadataPlacementMode string const ( - ScriptUpdateParamsMetadataPlacementModeSmart ScriptUpdateParamsMetadataPlacementMode = "smart" + ScriptUpdateParamsVariant0MetadataPlacementModeSmart ScriptUpdateParamsVariant0MetadataPlacementMode = "smart" ) -func (r ScriptUpdateParamsMetadataPlacementMode) IsKnown() bool { +func (r ScriptUpdateParamsVariant0MetadataPlacementMode) IsKnown() bool { switch r { - case ScriptUpdateParamsMetadataPlacementModeSmart: + case ScriptUpdateParamsVariant0MetadataPlacementModeSmart: return true } return false } // A reference to a script that will consume logs from the attached Worker. -type ScriptUpdateParamsMetadataTailConsumer struct { +type ScriptUpdateParamsVariant0MetadataTailConsumer struct { // Name of Worker that is to be the consumer. Service param.Field[string] `json:"service,required"` // Optional environment if the Worker utilizes one. @@ -393,26 +407,59 @@ type ScriptUpdateParamsMetadataTailConsumer struct { Namespace param.Field[string] `json:"namespace"` } -func (r ScriptUpdateParamsMetadataTailConsumer) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsVariant0MetadataTailConsumer) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Usage model to apply to invocations. -type ScriptUpdateParamsMetadataUsageModel string +type ScriptUpdateParamsVariant0MetadataUsageModel string const ( - ScriptUpdateParamsMetadataUsageModelBundled ScriptUpdateParamsMetadataUsageModel = "bundled" - ScriptUpdateParamsMetadataUsageModelUnbound ScriptUpdateParamsMetadataUsageModel = "unbound" + ScriptUpdateParamsVariant0MetadataUsageModelBundled ScriptUpdateParamsVariant0MetadataUsageModel = "bundled" + ScriptUpdateParamsVariant0MetadataUsageModelUnbound ScriptUpdateParamsVariant0MetadataUsageModel = "unbound" ) -func (r ScriptUpdateParamsMetadataUsageModel) IsKnown() bool { +func (r ScriptUpdateParamsVariant0MetadataUsageModel) IsKnown() bool { switch r { - case ScriptUpdateParamsMetadataUsageModelBundled, ScriptUpdateParamsMetadataUsageModelUnbound: + case ScriptUpdateParamsVariant0MetadataUsageModelBundled, ScriptUpdateParamsVariant0MetadataUsageModelUnbound: return true } return false } +type ScriptUpdateParamsVariant1 struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Rollback to provided deployment based on deployment ID. Request body will only + // parse a "message" part. You can learn more about deployments + // [here](https://developers.cloudflare.com/workers/platform/deployments/). + RollbackTo param.Field[string] `query:"rollback_to"` + // Rollback message to be associated with this deployment. Only parsed when query + // param `"rollback_to"` is present. + Message param.Field[string] `json:"message"` +} + +func (r ScriptUpdateParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [ScriptUpdateParamsVariant1]'s query parameters as +// `url.Values`. +func (r ScriptUpdateParamsVariant1) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +func (r ScriptUpdateParamsVariant1) getAccountID() param.Field[string] { + return r.AccountID +} + +func (ScriptUpdateParamsVariant1) ImplementsScriptUpdateParams() { + +} + type ScriptUpdateResponseEnvelope struct { Errors []ScriptUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []ScriptUpdateResponseEnvelopeMessages `json:"messages,required"` diff --git a/workers/script_test.go b/workers/script_test.go index 3b05182af3e..d3d22c9a430 100644 --- a/workers/script_test.go +++ b/workers/script_test.go @@ -35,12 +35,11 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { _, err := client.Workers.Scripts.Update( context.TODO(), "this-is_my_script-01", - workers.ScriptUpdateParams{ + workers.ScriptUpdateParamsVariant0{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), RollbackTo: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), - Message: cloudflare.F("string"), - Metadata: cloudflare.F(workers.ScriptUpdateParamsMetadata{ + Metadata: cloudflare.F(workers.ScriptUpdateParamsVariant0Metadata{ Bindings: cloudflare.F([]interface{}{map[string]interface{}{ "name": "MY_ENV_VAR", "text": "my_data", @@ -52,12 +51,12 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { KeepBindings: cloudflare.F([]string{"string", "string", "string"}), Logpush: cloudflare.F(false), MainModule: cloudflare.F("worker.js"), - Migrations: cloudflare.F[workers.ScriptUpdateParamsMetadataMigrations](workers.ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations(workers.ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations{ + Migrations: cloudflare.F[workers.ScriptUpdateParamsVariant0MetadataMigrations](workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations(workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations{ NewTag: cloudflare.F("v2"), OldTag: cloudflare.F("v1"), DeletedClasses: cloudflare.F([]string{"string", "string", "string"}), NewClasses: cloudflare.F([]string{"string", "string", "string"}), - RenamedClasses: cloudflare.F([]workers.ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass{{ + RenamedClasses: cloudflare.F([]workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass{{ From: cloudflare.F("string"), To: cloudflare.F("string"), }, { @@ -67,7 +66,7 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { From: cloudflare.F("string"), To: cloudflare.F("string"), }}), - TransferredClasses: cloudflare.F([]workers.ScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass{{ + TransferredClasses: cloudflare.F([]workers.ScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass{{ From: cloudflare.F("string"), FromScript: cloudflare.F("string"), To: cloudflare.F("string"), @@ -81,11 +80,11 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { To: cloudflare.F("string"), }}), })), - Placement: cloudflare.F(workers.ScriptUpdateParamsMetadataPlacement{ - Mode: cloudflare.F(workers.ScriptUpdateParamsMetadataPlacementModeSmart), + Placement: cloudflare.F(workers.ScriptUpdateParamsVariant0MetadataPlacement{ + Mode: cloudflare.F(workers.ScriptUpdateParamsVariant0MetadataPlacementModeSmart), }), Tags: cloudflare.F([]string{"string", "string", "string"}), - TailConsumers: cloudflare.F([]workers.ScriptUpdateParamsMetadataTailConsumer{{ + TailConsumers: cloudflare.F([]workers.ScriptUpdateParamsVariant0MetadataTailConsumer{{ Environment: cloudflare.F("production"), Namespace: cloudflare.F("my-namespace"), Service: cloudflare.F("my-log-consumer"), @@ -98,7 +97,7 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { Namespace: cloudflare.F("my-namespace"), Service: cloudflare.F("my-log-consumer"), }}), - UsageModel: cloudflare.F(workers.ScriptUpdateParamsMetadataUsageModelBundled), + UsageModel: cloudflare.F(workers.ScriptUpdateParamsVariant0MetadataUsageModelBundled), VersionTags: cloudflare.F[any](map[string]interface{}{}), }), }, diff --git a/workers_for_platforms/dispatchnamespacescript.go b/workers_for_platforms/dispatchnamespacescript.go index ed13d8aa69f..7558e624cd2 100644 --- a/workers_for_platforms/dispatchnamespacescript.go +++ b/workers_for_platforms/dispatchnamespacescript.go @@ -45,7 +45,7 @@ func NewDispatchNamespaceScriptService(opts ...option.RequestOption) (r *Dispatc func (r *DispatchNamespaceScriptService) Update(ctx context.Context, dispatchNamespace string, scriptName string, params DispatchNamespaceScriptUpdateParams, opts ...option.RequestOption) (res *workers.WorkersScript, err error) { opts = append(r.Options[:], opts...) var env DispatchNamespaceScriptUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", params.AccountID, dispatchNamespace, scriptName) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", params.getAccountID(), dispatchNamespace, scriptName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -108,21 +108,27 @@ func (r workersNamespaceScriptJSON) RawJSON() string { return r.raw } -type DispatchNamespaceScriptUpdateParams struct { +// This interface is a union satisfied by one of the following: +// [DispatchNamespaceScriptUpdateParamsVariant0], +// [DispatchNamespaceScriptUpdateParamsVariant1]. +type DispatchNamespaceScriptUpdateParams interface { + ImplementsDispatchNamespaceScriptUpdateParams() + + getAccountID() param.Field[string] +} + +type DispatchNamespaceScriptUpdateParamsVariant0 struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // A module comprising a Worker script, often a javascript file. Multiple modules // may be provided as separate named parts, but at least one module must be present // and referenced in the metadata as `main_module` or `body_part` by part name. AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` - // Rollback message to be associated with this deployment. Only parsed when query - // param `"rollback_to"` is present. - Message param.Field[string] `json:"message"` // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[DispatchNamespaceScriptUpdateParamsMetadata] `json:"metadata"` + Metadata param.Field[DispatchNamespaceScriptUpdateParamsVariant0Metadata] `json:"metadata"` } -func (r DispatchNamespaceScriptUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) err = apiform.MarshalRoot(r, writer) @@ -137,8 +143,16 @@ func (r DispatchNamespaceScriptUpdateParams) MarshalMultipart() (data []byte, co return buf.Bytes(), writer.FormDataContentType(), nil } +func (r DispatchNamespaceScriptUpdateParamsVariant0) getAccountID() param.Field[string] { + return r.AccountID +} + +func (DispatchNamespaceScriptUpdateParamsVariant0) ImplementsDispatchNamespaceScriptUpdateParams() { + +} + // JSON encoded metadata about the uploaded parts and Worker configuration. -type DispatchNamespaceScriptUpdateParamsMetadata struct { +type DispatchNamespaceScriptUpdateParamsVariant0Metadata struct { // List of bindings available to the worker. Bindings param.Field[[]interface{}] `json:"bindings"` // Name of the part in the multipart request that contains the script (e.g. the @@ -160,33 +174,33 @@ type DispatchNamespaceScriptUpdateParamsMetadata struct { // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. MainModule param.Field[string] `json:"main_module"` // Migrations to apply for Durable Objects associated with this Worker. - Migrations param.Field[DispatchNamespaceScriptUpdateParamsMetadataMigrations] `json:"migrations"` - Placement param.Field[DispatchNamespaceScriptUpdateParamsMetadataPlacement] `json:"placement"` + Migrations param.Field[DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations] `json:"migrations"` + Placement param.Field[DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacement] `json:"placement"` // List of strings to use as tags for this Worker Tags param.Field[[]string] `json:"tags"` // List of Workers that will consume logs from the attached Worker. - TailConsumers param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataTailConsumer] `json:"tail_consumers"` + TailConsumers param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataTailConsumer] `json:"tail_consumers"` // Usage model to apply to invocations. - UsageModel param.Field[DispatchNamespaceScriptUpdateParamsMetadataUsageModel] `json:"usage_model"` + UsageModel param.Field[DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel] `json:"usage_model"` // Key-value pairs to use as tags for this version of this Worker VersionTags param.Field[interface{}] `json:"version_tags"` } -func (r DispatchNamespaceScriptUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Migrations to apply for Durable Objects associated with this Worker. // // Satisfied by -// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations], -// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations]. -type DispatchNamespaceScriptUpdateParamsMetadataMigrations interface { - implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsMetadataMigrations() +// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations], +// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations]. +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations interface { + implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations() } // A single set of migrations to apply. -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations struct { // A list of classes to delete Durable Object namespaces from. DeletedClasses param.Field[[]string] `json:"deleted_classes"` // A list of classes to create Durable Object namespaces from. @@ -197,120 +211,120 @@ type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigra // don't match, the upload is rejected. OldTag param.Field[string] `json:"old_tag"` // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass] `json:"renamed_classes"` + RenamedClasses param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass] `json:"renamed_classes"` // A list of transfers for Durable Object namespaces from a different Worker and // class to a class defined in this Worker. - TransferredClasses param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass] `json:"transferred_classes"` + TransferredClasses param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass] `json:"transferred_classes"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsMetadataMigrations() { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations() { } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass struct { From param.Field[string] `json:"from"` To param.Field[string] `json:"to"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass struct { From param.Field[string] `json:"from"` FromScript param.Field[string] `json:"from_script"` To param.Field[string] `json:"to"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations struct { // Tag to set as the latest migration tag. NewTag param.Field[string] `json:"new_tag"` // Tag used to verify against the latest migration tag for this Worker. If they // don't match, the upload is rejected. OldTag param.Field[string] `json:"old_tag"` // Migrations to apply in order. - Steps param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep] `json:"steps"` + Steps param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep] `json:"steps"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsMetadataMigrations() { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations() { } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep struct { // A list of classes to delete Durable Object namespaces from. DeletedClasses param.Field[[]string] `json:"deleted_classes"` // A list of classes to create Durable Object namespaces from. NewClasses param.Field[[]string] `json:"new_classes"` // A list of classes with Durable Object namespaces that were renamed. - RenamedClasses param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass] `json:"renamed_classes"` + RenamedClasses param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass] `json:"renamed_classes"` // A list of transfers for Durable Object namespaces from a different Worker and // class to a class defined in this Worker. - TransferredClasses param.Field[[]DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` + TransferredClasses param.Field[[]DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass] `json:"transferred_classes"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStep) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass struct { From param.Field[string] `json:"from"` To param.Field[string] `json:"to"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsRenamedClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass struct { From param.Field[string] `json:"from"` FromScript param.Field[string] `json:"from_script"` To param.Field[string] `json:"to"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSteppedMigrationsStepsTransferredClass) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DispatchNamespaceScriptUpdateParamsMetadataPlacement struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacement struct { // Enables // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). // Only `"smart"` is currently supported - Mode param.Field[DispatchNamespaceScriptUpdateParamsMetadataPlacementMode] `json:"mode"` + Mode param.Field[DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementMode] `json:"mode"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataPlacement) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacement) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Enables // [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). // Only `"smart"` is currently supported -type DispatchNamespaceScriptUpdateParamsMetadataPlacementMode string +type DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementMode string const ( - DispatchNamespaceScriptUpdateParamsMetadataPlacementModeSmart DispatchNamespaceScriptUpdateParamsMetadataPlacementMode = "smart" + DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementModeSmart DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementMode = "smart" ) -func (r DispatchNamespaceScriptUpdateParamsMetadataPlacementMode) IsKnown() bool { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementMode) IsKnown() bool { switch r { - case DispatchNamespaceScriptUpdateParamsMetadataPlacementModeSmart: + case DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementModeSmart: return true } return false } // A reference to a script that will consume logs from the attached Worker. -type DispatchNamespaceScriptUpdateParamsMetadataTailConsumer struct { +type DispatchNamespaceScriptUpdateParamsVariant0MetadataTailConsumer struct { // Name of Worker that is to be the consumer. Service param.Field[string] `json:"service,required"` // Optional environment if the Worker utilizes one. @@ -319,26 +333,46 @@ type DispatchNamespaceScriptUpdateParamsMetadataTailConsumer struct { Namespace param.Field[string] `json:"namespace"` } -func (r DispatchNamespaceScriptUpdateParamsMetadataTailConsumer) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataTailConsumer) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Usage model to apply to invocations. -type DispatchNamespaceScriptUpdateParamsMetadataUsageModel string +type DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel string const ( - DispatchNamespaceScriptUpdateParamsMetadataUsageModelBundled DispatchNamespaceScriptUpdateParamsMetadataUsageModel = "bundled" - DispatchNamespaceScriptUpdateParamsMetadataUsageModelUnbound DispatchNamespaceScriptUpdateParamsMetadataUsageModel = "unbound" + DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel = "bundled" + DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelUnbound DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel = "unbound" ) -func (r DispatchNamespaceScriptUpdateParamsMetadataUsageModel) IsKnown() bool { +func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel) IsKnown() bool { switch r { - case DispatchNamespaceScriptUpdateParamsMetadataUsageModelBundled, DispatchNamespaceScriptUpdateParamsMetadataUsageModelUnbound: + case DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled, DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelUnbound: return true } return false } +type DispatchNamespaceScriptUpdateParamsVariant1 struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Rollback message to be associated with this deployment. Only parsed when query + // param `"rollback_to"` is present. + Message param.Field[string] `json:"message"` +} + +func (r DispatchNamespaceScriptUpdateParamsVariant1) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r DispatchNamespaceScriptUpdateParamsVariant1) getAccountID() param.Field[string] { + return r.AccountID +} + +func (DispatchNamespaceScriptUpdateParamsVariant1) ImplementsDispatchNamespaceScriptUpdateParams() { + +} + type DispatchNamespaceScriptUpdateResponseEnvelope struct { Errors []DispatchNamespaceScriptUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []DispatchNamespaceScriptUpdateResponseEnvelopeMessages `json:"messages,required"` diff --git a/workers_for_platforms/dispatchnamespacescript_test.go b/workers_for_platforms/dispatchnamespacescript_test.go index a218aac473e..a176d7f71f4 100644 --- a/workers_for_platforms/dispatchnamespacescript_test.go +++ b/workers_for_platforms/dispatchnamespacescript_test.go @@ -34,11 +34,10 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", - workers_for_platforms.DispatchNamespaceScriptUpdateParams{ + workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), AnyPartName: cloudflare.F([]io.Reader{io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents"))), io.Reader(bytes.NewBuffer([]byte("some file contents")))}), - Message: cloudflare.F("string"), - Metadata: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadata{ + Metadata: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0Metadata{ Bindings: cloudflare.F([]interface{}{map[string]interface{}{ "name": "MY_ENV_VAR", "text": "my_data", @@ -50,12 +49,12 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { KeepBindings: cloudflare.F([]string{"string", "string", "string"}), Logpush: cloudflare.F(false), MainModule: cloudflare.F("worker.js"), - Migrations: cloudflare.F[workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrations](workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrations{ + Migrations: cloudflare.F[workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations](workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrations{ NewTag: cloudflare.F("v2"), OldTag: cloudflare.F("v1"), DeletedClasses: cloudflare.F([]string{"string", "string", "string"}), NewClasses: cloudflare.F([]string{"string", "string", "string"}), - RenamedClasses: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsRenamedClass{{ + RenamedClasses: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsRenamedClass{{ From: cloudflare.F("string"), To: cloudflare.F("string"), }, { @@ -65,7 +64,7 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { From: cloudflare.F("string"), To: cloudflare.F("string"), }}), - TransferredClasses: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersSingleStepMigrationsTransferredClass{{ + TransferredClasses: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsWorkersSingleStepMigrationsTransferredClass{{ From: cloudflare.F("string"), FromScript: cloudflare.F("string"), To: cloudflare.F("string"), @@ -79,11 +78,11 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { To: cloudflare.F("string"), }}), })), - Placement: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataPlacement{ - Mode: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataPlacementModeSmart), + Placement: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacement{ + Mode: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataPlacementModeSmart), }), Tags: cloudflare.F([]string{"string", "string", "string"}), - TailConsumers: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataTailConsumer{{ + TailConsumers: cloudflare.F([]workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataTailConsumer{{ Environment: cloudflare.F("production"), Namespace: cloudflare.F("my-namespace"), Service: cloudflare.F("my-log-consumer"), @@ -96,7 +95,7 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { Namespace: cloudflare.F("my-namespace"), Service: cloudflare.F("my-log-consumer"), }}), - UsageModel: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadataUsageModelBundled), + UsageModel: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled), VersionTags: cloudflare.F[any](map[string]interface{}{}), }), }, diff --git a/zero_trust/accessapplication.go b/zero_trust/accessapplication.go index 17e303bd04a..1fdab571791 100644 --- a/zero_trust/accessapplication.go +++ b/zero_trust/accessapplication.go @@ -46,12 +46,12 @@ func (r *AccessApplicationService) New(ctx context.Context, params AccessApplica var env AccessApplicationNewResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/access/apps", accountOrZone, accountOrZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -63,17 +63,17 @@ func (r *AccessApplicationService) New(ctx context.Context, params AccessApplica } // Updates an Access application. -func (r *AccessApplicationService) Update(ctx context.Context, appID AccessApplicationUpdateParamsAppID, params AccessApplicationUpdateParams, opts ...option.RequestOption) (res *AccessApps, err error) { +func (r *AccessApplicationService) Update(ctx context.Context, appID AccessApplicationUpdateParamsSelfHostedApplicationAppID, params AccessApplicationUpdateParams, opts ...option.RequestOption) (res *AccessApps, err error) { opts = append(r.Options[:], opts...) var env AccessApplicationUpdateResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/access/apps/%v", accountOrZone, accountOrZoneID, appID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) @@ -1409,7 +1409,29 @@ func (r accessApplicationDeleteResponseJSON) RawJSON() string { type AccessApplicationRevokeTokensResponse = interface{} -type AccessApplicationNewParams struct { +// This interface is a union satisfied by one of the following: +// [AccessApplicationNewParamsSelfHostedApplication], +// [AccessApplicationNewParamsSaaSApplication], +// [AccessApplicationNewParamsBrowserSSHApplication], +// [AccessApplicationNewParamsBrowserVncApplication], +// [AccessApplicationNewParamsAppLauncherApplication], +// [AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication], +// [AccessApplicationNewParamsBrowserIsolationPermissionsApplication], +// [AccessApplicationNewParamsBookmarkApplication]. +type AccessApplicationNewParams interface { + ImplementsAccessApplicationNewParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type AccessApplicationNewParamsSelfHostedApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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. @@ -1421,12 +1443,13 @@ type AccessApplicationNewParams struct { AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIDPs param.Field[[]string] `json:"allowed_idps"` - AppLauncherVisible param.Field[interface{}] `json:"app_launcher_visible"` + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. - AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` - CorsHeaders param.Field[AccessApplicationNewParamsCorsHeaders] `json:"cors_headers"` + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationNewParamsSelfHostedApplicationCorsHeaders] `json:"cors_headers"` // The custom error message shown to a user when they are denied access to the // application. CustomDenyMessage param.Field[string] `json:"custom_deny_message"` @@ -1438,8 +1461,6 @@ type AccessApplicationNewParams struct { CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application CustomPages param.Field[[]string] `json:"custom_pages"` - // The URL or domain of the bookmark. - Domain param.Field[interface{}] `json:"domain"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` @@ -1452,8 +1473,7 @@ type AccessApplicationNewParams struct { Name param.Field[string] `json:"name"` // Enables cookie paths to scope an application's JWT to the application path. If // disabled, the JWT will scope to the hostname by default - PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` - SaasApp param.Field[AccessApplicationNewParamsSaasApp] `json:"saas_app"` + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` // Sets the SameSite cookie setting, which provides increased security against CSRF // attacks. SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` @@ -1470,15 +1490,25 @@ type AccessApplicationNewParams struct { // The tags you want assigned to an application. Tags are used to filter // applications in the App Launcher dashboard. Tags param.Field[[]string] `json:"tags"` - // The application type. - Type param.Field[AccessApplicationNewParamsType] `json:"type"` } -func (r AccessApplicationNewParams) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSelfHostedApplication) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type AccessApplicationNewParamsCorsHeaders struct { +func (r AccessApplicationNewParamsSelfHostedApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsSelfHostedApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsSelfHostedApplication) ImplementsAccessApplicationNewParams() { + +} + +type AccessApplicationNewParamsSelfHostedApplicationCorsHeaders struct { // Allows all HTTP request headers. AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` // Allows all HTTP request methods. @@ -1491,60 +1521,104 @@ type AccessApplicationNewParamsCorsHeaders struct { // Allowed HTTP request headers. AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` // Allowed HTTP request methods. - AllowedMethods param.Field[[]AccessApplicationNewParamsCorsHeadersAllowedMethod] `json:"allowed_methods"` + AllowedMethods param.Field[[]AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` // Allowed origins. AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` // The maximum number of seconds the results of a preflight request can be cached. MaxAge param.Field[float64] `json:"max_age"` } -func (r AccessApplicationNewParamsCorsHeaders) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSelfHostedApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type AccessApplicationNewParamsCorsHeadersAllowedMethod string +type AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod string const ( - AccessApplicationNewParamsCorsHeadersAllowedMethodGet AccessApplicationNewParamsCorsHeadersAllowedMethod = "GET" - AccessApplicationNewParamsCorsHeadersAllowedMethodPost AccessApplicationNewParamsCorsHeadersAllowedMethod = "POST" - AccessApplicationNewParamsCorsHeadersAllowedMethodHead AccessApplicationNewParamsCorsHeadersAllowedMethod = "HEAD" - AccessApplicationNewParamsCorsHeadersAllowedMethodPut AccessApplicationNewParamsCorsHeadersAllowedMethod = "PUT" - AccessApplicationNewParamsCorsHeadersAllowedMethodDelete AccessApplicationNewParamsCorsHeadersAllowedMethod = "DELETE" - AccessApplicationNewParamsCorsHeadersAllowedMethodConnect AccessApplicationNewParamsCorsHeadersAllowedMethod = "CONNECT" - AccessApplicationNewParamsCorsHeadersAllowedMethodOptions AccessApplicationNewParamsCorsHeadersAllowedMethod = "OPTIONS" - AccessApplicationNewParamsCorsHeadersAllowedMethodTrace AccessApplicationNewParamsCorsHeadersAllowedMethod = "TRACE" - AccessApplicationNewParamsCorsHeadersAllowedMethodPatch AccessApplicationNewParamsCorsHeadersAllowedMethod = "PATCH" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodGet AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPost AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodHead AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPut AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodDelete AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodConnect AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodOptions AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodTrace AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPatch AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod = "PATCH" ) -func (r AccessApplicationNewParamsCorsHeadersAllowedMethod) IsKnown() bool { +func (r AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod) IsKnown() bool { switch r { - case AccessApplicationNewParamsCorsHeadersAllowedMethodGet, AccessApplicationNewParamsCorsHeadersAllowedMethodPost, AccessApplicationNewParamsCorsHeadersAllowedMethodHead, AccessApplicationNewParamsCorsHeadersAllowedMethodPut, AccessApplicationNewParamsCorsHeadersAllowedMethodDelete, AccessApplicationNewParamsCorsHeadersAllowedMethodConnect, AccessApplicationNewParamsCorsHeadersAllowedMethodOptions, AccessApplicationNewParamsCorsHeadersAllowedMethodTrace, AccessApplicationNewParamsCorsHeadersAllowedMethodPatch: + case AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodGet, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPost, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodHead, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPut, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodDelete, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodConnect, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodOptions, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodTrace, AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodPatch: return true } return false } -// Satisfied by [zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasApp], -// [zero_trust.AccessApplicationNewParamsSaasAppAccessOidcSaasApp]. -type AccessApplicationNewParamsSaasApp interface { - implementsZeroTrustAccessApplicationNewParamsSaasApp() +type AccessApplicationNewParamsSaaSApplication struct { + // 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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + SaasApp param.Field[AccessApplicationNewParamsSaaSApplicationSaasApp] `json:"saas_app"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` + // The application type. + Type param.Field[string] `json:"type"` +} + +func (r AccessApplicationNewParamsSaaSApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationNewParamsSaaSApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsSaaSApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsSaaSApplication) ImplementsAccessApplicationNewParams() { + +} + +// Satisfied by +// [zero_trust.AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasApp], +// [zero_trust.AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasApp]. +type AccessApplicationNewParamsSaaSApplicationSaasApp interface { + implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasApp() } -type AccessApplicationNewParamsSaasAppAccessSamlSaasApp struct { +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasApp struct { // Optional identifier indicating the authentication protocol used for the saas // app. Required for OIDC. Default if unset is "saml" - AuthType param.Field[AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthType] `json:"auth_type"` + AuthType param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType] `json:"auth_type"` // The service provider's endpoint that is responsible for receiving and parsing a // SAML assertion. - ConsumerServiceURL param.Field[string] `json:"consumer_service_url"` - CustomAttributes param.Field[AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributes] `json:"custom_attributes"` + ConsumerServiceURL param.Field[string] `json:"consumer_service_url"` + CustomAttributes param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes] `json:"custom_attributes"` // The URL that the user will be redirected to after a successful login for IDP // initiated logins. DefaultRelayState param.Field[string] `json:"default_relay_state"` // The unique identifier for your SaaS application. IDPEntityID param.Field[string] `json:"idp_entity_id"` // The format of the name identifier sent to the SaaS application. - NameIDFormat param.Field[AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormat] `json:"name_id_format"` + NameIDFormat param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat] `json:"name_id_format"` // A [JSONata](https://jsonata.org/) expression that transforms an application's // user identities into a NameID value for its SAML assertion. This expression // should evaluate to a singular string. The output of this expression can override @@ -1558,96 +1632,96 @@ type AccessApplicationNewParamsSaasAppAccessSamlSaasApp struct { SSOEndpoint param.Field[string] `json:"sso_endpoint"` } -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasApp) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasApp) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasApp) implementsZeroTrustAccessApplicationNewParamsSaasApp() { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasApp) implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasApp() { } // Optional identifier indicating the authentication protocol used for the saas // app. Required for OIDC. Default if unset is "saml" -type AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthType string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType string const ( - AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthTypeSaml AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthType = "saml" - AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthTypeOidc AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthType = "oidc" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeSaml AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType = "saml" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeOidc AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType = "oidc" ) -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthType) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType) IsKnown() bool { switch r { - case AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthTypeSaml, AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthTypeOidc: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeSaml, AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeOidc: return true } return false } -type AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributes struct { +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes struct { // The name of the attribute. Name param.Field[string] `json:"name"` // A globally unique name for an identity or service provider. - NameFormat param.Field[AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat] `json:"name_format"` - Source param.Field[AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesSource] `json:"source"` + NameFormat param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat] `json:"name_format"` + Source param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource] `json:"source"` } -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributes) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // A globally unique name for an identity or service provider. -type AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat string const ( - AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" - AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" - AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ) -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat) IsKnown() bool { switch r { - case AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified, AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic, AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified, AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic, AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI: return true } return false } -type AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesSource struct { +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource struct { // The name of the IdP attribute. Name param.Field[string] `json:"name"` } -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesSource) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // The format of the name identifier sent to the SaaS application. -type AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormat string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat string const ( - AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormatID AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormat = "id" - AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormatEmail AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormat = "email" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatID AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat = "id" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatEmail AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat = "email" ) -func (r AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormat) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat) IsKnown() bool { switch r { - case AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormatID, AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormatEmail: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatID, AccessApplicationNewParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatEmail: return true } return false } -type AccessApplicationNewParamsSaasAppAccessOidcSaasApp struct { +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasApp struct { // The URL where this applications tile redirects users AppLauncherURL param.Field[string] `json:"app_launcher_url"` // Identifier of the authentication protocol used for the saas app. Required for // OIDC. - AuthType param.Field[AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthType] `json:"auth_type"` + AuthType param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType] `json:"auth_type"` // The application client id ClientID param.Field[string] `json:"client_id"` // The application client secret, only returned on POST request. ClientSecret param.Field[string] `json:"client_secret"` // The OIDC flows supported by this application - GrantTypes param.Field[[]AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantType] `json:"grant_types"` + GrantTypes param.Field[[]AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType] `json:"grant_types"` // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint GroupFilterRegex param.Field[string] `json:"group_filter_regex"` // The Access public certificate that will be used to verify your identity. @@ -1656,178 +1730,199 @@ type AccessApplicationNewParamsSaasAppAccessOidcSaasApp struct { // tokens RedirectURIs param.Field[[]string] `json:"redirect_uris"` // Define the user information shared with access - Scopes param.Field[[]AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope] `json:"scopes"` + Scopes param.Field[[]AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope] `json:"scopes"` } -func (r AccessApplicationNewParamsSaasAppAccessOidcSaasApp) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasApp) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AccessApplicationNewParamsSaasAppAccessOidcSaasApp) implementsZeroTrustAccessApplicationNewParamsSaasApp() { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasApp) implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasApp() { } // Identifier of the authentication protocol used for the saas app. Required for // OIDC. -type AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthType string - -const ( - AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthTypeSaml AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthType = "saml" - AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthTypeOidc AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthType = "oidc" -) - -func (r AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthType) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthTypeSaml, AccessApplicationNewParamsSaasAppAccessOidcSaasAppAuthTypeOidc: - return true - } - return false -} - -type AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantType string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType string const ( - AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantType = "authorization_code" - AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantType = "authorization_code_with_pkce" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeSaml AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType = "saml" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeOidc AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType = "oidc" ) -func (r AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantType) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType) IsKnown() bool { switch r { - case AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode, AccessApplicationNewParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeSaml, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeOidc: return true } return false } -type AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType string const ( - AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeOpenid AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope = "openid" - AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeGroups AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope = "groups" - AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeEmail AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope = "email" - AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeProfile AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope = "profile" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType = "authorization_code" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType = "authorization_code_with_pkce" ) -func (r AccessApplicationNewParamsSaasAppAccessOidcSaasAppScope) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType) IsKnown() bool { switch r { - case AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeOpenid, AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeGroups, AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeEmail, AccessApplicationNewParamsSaasAppAccessOidcSaasAppScopeProfile: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce: return true } return false } -// The application type. -type AccessApplicationNewParamsType string +type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope string const ( - AccessApplicationNewParamsTypeSelfHosted AccessApplicationNewParamsType = "self_hosted" - AccessApplicationNewParamsTypeSaas AccessApplicationNewParamsType = "saas" - AccessApplicationNewParamsTypeSSH AccessApplicationNewParamsType = "ssh" - AccessApplicationNewParamsTypeVnc AccessApplicationNewParamsType = "vnc" - AccessApplicationNewParamsTypeAppLauncher AccessApplicationNewParamsType = "app_launcher" - AccessApplicationNewParamsTypeWARP AccessApplicationNewParamsType = "warp" - AccessApplicationNewParamsTypeBiso AccessApplicationNewParamsType = "biso" - AccessApplicationNewParamsTypeBookmark AccessApplicationNewParamsType = "bookmark" - AccessApplicationNewParamsTypeDashSSO AccessApplicationNewParamsType = "dash_sso" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeOpenid AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "openid" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeGroups AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "groups" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeEmail AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "email" + AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeProfile AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "profile" ) -func (r AccessApplicationNewParamsType) IsKnown() bool { +func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScope) IsKnown() bool { switch r { - case AccessApplicationNewParamsTypeSelfHosted, AccessApplicationNewParamsTypeSaas, AccessApplicationNewParamsTypeSSH, AccessApplicationNewParamsTypeVnc, AccessApplicationNewParamsTypeAppLauncher, AccessApplicationNewParamsTypeWARP, AccessApplicationNewParamsTypeBiso, AccessApplicationNewParamsTypeBookmark, AccessApplicationNewParamsTypeDashSSO: + case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeOpenid, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeGroups, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeEmail, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeProfile: return true } return false } -type AccessApplicationNewResponseEnvelope struct { - Errors []AccessApplicationNewResponseEnvelopeErrors `json:"errors,required"` - Messages []AccessApplicationNewResponseEnvelopeMessages `json:"messages,required"` - Result AccessApps `json:"result,required"` - // Whether the API call was successful - Success AccessApplicationNewResponseEnvelopeSuccess `json:"success,required"` - JSON accessApplicationNewResponseEnvelopeJSON `json:"-"` -} - -// accessApplicationNewResponseEnvelopeJSON contains the JSON metadata for the -// struct [AccessApplicationNewResponseEnvelope] -type accessApplicationNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AccessApplicationNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r accessApplicationNewResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type AccessApplicationNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON accessApplicationNewResponseEnvelopeErrorsJSON `json:"-"` +type AccessApplicationNewParamsBrowserSSHApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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"` + // When set to true, users can authenticate to this application using their WARP + // session. When set to false this application will always require direct IdP + // authentication. This setting always overrides the organization setting for WARP + // authentication. + AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationNewParamsBrowserSSHApplicationCorsHeaders] `json:"cors_headers"` + // The custom error message shown to a user when they are denied access to the + // application. + CustomDenyMessage param.Field[string] `json:"custom_deny_message"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing identity-based rules. + CustomDenyURL param.Field[string] `json:"custom_deny_url"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing non-identity rules. + CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // Enables the binding cookie, which increases security against compromised + // authorization tokens and CSRF attacks. + EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` + // Enables the HttpOnly cookie attribute, which increases security against XSS + // attacks. + HTTPOnlyCookieAttribute param.Field[bool] `json:"http_only_cookie_attribute"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + // Enables cookie paths to scope an application's JWT to the application path. If + // disabled, the JWT will scope to the hostname by default + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` + // Sets the SameSite cookie setting, which provides increased security against CSRF + // attacks. + SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` + // List of domains that Access will secure. + SelfHostedDomains param.Field[[]string] `json:"self_hosted_domains"` + // Returns a 401 status code when the request is blocked by a Service Auth policy. + ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` + // Enables automatic authentication through cloudflared. + SkipInterstitial param.Field[bool] `json:"skip_interstitial"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` } -// accessApplicationNewResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [AccessApplicationNewResponseEnvelopeErrors] -type accessApplicationNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r AccessApplicationNewParamsBrowserSSHApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *AccessApplicationNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r AccessApplicationNewParamsBrowserSSHApplication) getAccountID() param.Field[string] { + return r.AccountID } -func (r accessApplicationNewResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw +func (r AccessApplicationNewParamsBrowserSSHApplication) getZoneID() param.Field[string] { + return r.ZoneID } -type AccessApplicationNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON accessApplicationNewResponseEnvelopeMessagesJSON `json:"-"` -} +func (AccessApplicationNewParamsBrowserSSHApplication) ImplementsAccessApplicationNewParams() { -// accessApplicationNewResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [AccessApplicationNewResponseEnvelopeMessages] -type accessApplicationNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field } -func (r *AccessApplicationNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type AccessApplicationNewParamsBrowserSSHApplicationCorsHeaders struct { + // Allows all HTTP request headers. + AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` + // Allows all HTTP request methods. + AllowAllMethods param.Field[bool] `json:"allow_all_methods"` + // Allows all origins. + AllowAllOrigins param.Field[bool] `json:"allow_all_origins"` + // When set to `true`, includes credentials (cookies, authorization headers, or TLS + // client certificates) with requests. + AllowCredentials param.Field[bool] `json:"allow_credentials"` + // Allowed HTTP request headers. + AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods param.Field[[]AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` + // The maximum number of seconds the results of a preflight request can be cached. + MaxAge param.Field[float64] `json:"max_age"` } -func (r accessApplicationNewResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw +func (r AccessApplicationNewParamsBrowserSSHApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Whether the API call was successful -type AccessApplicationNewResponseEnvelopeSuccess bool +type AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod string const ( - AccessApplicationNewResponseEnvelopeSuccessTrue AccessApplicationNewResponseEnvelopeSuccess = true + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodGet AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPost AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodHead AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPut AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodDelete AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodConnect AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodOptions AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodTrace AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPatch AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "PATCH" ) -func (r AccessApplicationNewResponseEnvelopeSuccess) IsKnown() bool { +func (r AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethod) IsKnown() bool { switch r { - case AccessApplicationNewResponseEnvelopeSuccessTrue: + case AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodGet, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPost, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodHead, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPut, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodDelete, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodConnect, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodOptions, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodTrace, AccessApplicationNewParamsBrowserSSHApplicationCorsHeadersAllowedMethodPatch: return true } return false } -type AccessApplicationUpdateParams struct { +type AccessApplicationNewParamsBrowserVncApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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. @@ -1839,12 +1934,13 @@ type AccessApplicationUpdateParams struct { AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIDPs param.Field[[]string] `json:"allowed_idps"` - AppLauncherVisible param.Field[interface{}] `json:"app_launcher_visible"` + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. - AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` - CorsHeaders param.Field[AccessApplicationUpdateParamsCorsHeaders] `json:"cors_headers"` + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationNewParamsBrowserVncApplicationCorsHeaders] `json:"cors_headers"` // The custom error message shown to a user when they are denied access to the // application. CustomDenyMessage param.Field[string] `json:"custom_deny_message"` @@ -1856,8 +1952,6 @@ type AccessApplicationUpdateParams struct { CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application CustomPages param.Field[[]string] `json:"custom_pages"` - // The URL or domain of the bookmark. - Domain param.Field[interface{}] `json:"domain"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` @@ -1870,8 +1964,7 @@ type AccessApplicationUpdateParams struct { Name param.Field[string] `json:"name"` // Enables cookie paths to scope an application's JWT to the application path. If // disabled, the JWT will scope to the hostname by default - PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` - SaasApp param.Field[AccessApplicationUpdateParamsSaasApp] `json:"saas_app"` + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` // Sets the SameSite cookie setting, which provides increased security against CSRF // attacks. SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` @@ -1888,22 +1981,25 @@ type AccessApplicationUpdateParams struct { // The tags you want assigned to an application. Tags are used to filter // applications in the App Launcher dashboard. Tags param.Field[[]string] `json:"tags"` - // The application type. - Type param.Field[AccessApplicationUpdateParamsType] `json:"type"` } -func (r AccessApplicationUpdateParams) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsBrowserVncApplication) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Identifier -// -// Satisfied by [shared.UnionString], [shared.UnionString]. -type AccessApplicationUpdateParamsAppID interface { - ImplementsZeroTrustAccessApplicationUpdateParamsAppID() +func (r AccessApplicationNewParamsBrowserVncApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsBrowserVncApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsBrowserVncApplication) ImplementsAccessApplicationNewParams() { + } -type AccessApplicationUpdateParamsCorsHeaders struct { +type AccessApplicationNewParamsBrowserVncApplicationCorsHeaders struct { // Allows all HTTP request headers. AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` // Allows all HTTP request methods. @@ -1916,253 +2012,1238 @@ type AccessApplicationUpdateParamsCorsHeaders struct { // Allowed HTTP request headers. AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` // Allowed HTTP request methods. - AllowedMethods param.Field[[]AccessApplicationUpdateParamsCorsHeadersAllowedMethod] `json:"allowed_methods"` + AllowedMethods param.Field[[]AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` // Allowed origins. AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` // The maximum number of seconds the results of a preflight request can be cached. MaxAge param.Field[float64] `json:"max_age"` } -func (r AccessApplicationUpdateParamsCorsHeaders) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationNewParamsBrowserVncApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type AccessApplicationUpdateParamsCorsHeadersAllowedMethod string +type AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod string const ( - AccessApplicationUpdateParamsCorsHeadersAllowedMethodGet AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "GET" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodPost AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "POST" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodHead AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "HEAD" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodPut AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "PUT" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodDelete AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "DELETE" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodConnect AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "CONNECT" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodOptions AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "OPTIONS" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodTrace AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "TRACE" - AccessApplicationUpdateParamsCorsHeadersAllowedMethodPatch AccessApplicationUpdateParamsCorsHeadersAllowedMethod = "PATCH" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodGet AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPost AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodHead AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPut AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodDelete AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodConnect AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodOptions AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodTrace AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPatch AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod = "PATCH" ) -func (r AccessApplicationUpdateParamsCorsHeadersAllowedMethod) IsKnown() bool { +func (r AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethod) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsCorsHeadersAllowedMethodGet, AccessApplicationUpdateParamsCorsHeadersAllowedMethodPost, AccessApplicationUpdateParamsCorsHeadersAllowedMethodHead, AccessApplicationUpdateParamsCorsHeadersAllowedMethodPut, AccessApplicationUpdateParamsCorsHeadersAllowedMethodDelete, AccessApplicationUpdateParamsCorsHeadersAllowedMethodConnect, AccessApplicationUpdateParamsCorsHeadersAllowedMethodOptions, AccessApplicationUpdateParamsCorsHeadersAllowedMethodTrace, AccessApplicationUpdateParamsCorsHeadersAllowedMethodPatch: + case AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodGet, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPost, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodHead, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPut, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodDelete, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodConnect, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodOptions, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodTrace, AccessApplicationNewParamsBrowserVncApplicationCorsHeadersAllowedMethodPatch: return true } return false } -// Satisfied by [zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp], -// [zero_trust.AccessApplicationUpdateParamsSaasAppAccessOidcSaasApp]. -type AccessApplicationUpdateParamsSaasApp interface { - implementsZeroTrustAccessApplicationUpdateParamsSaasApp() +type AccessApplicationNewParamsAppLauncherApplication struct { + // The application type. + Type param.Field[AccessApplicationNewParamsAppLauncherApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` +} + +func (r AccessApplicationNewParamsAppLauncherApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp struct { - // Optional identifier indicating the authentication protocol used for the saas - // app. Required for OIDC. Default if unset is "saml" - AuthType param.Field[AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthType] `json:"auth_type"` - // The service provider's endpoint that is responsible for receiving and parsing a - // SAML assertion. - ConsumerServiceURL param.Field[string] `json:"consumer_service_url"` - CustomAttributes param.Field[AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributes] `json:"custom_attributes"` - // The URL that the user will be redirected to after a successful login for IDP - // initiated logins. - DefaultRelayState param.Field[string] `json:"default_relay_state"` - // The unique identifier for your SaaS application. - IDPEntityID param.Field[string] `json:"idp_entity_id"` - // The format of the name identifier sent to the SaaS application. - NameIDFormat param.Field[AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormat] `json:"name_id_format"` - // A [JSONata](https://jsonata.org/) expression that transforms an application's - // user identities into a NameID value for its SAML assertion. This expression - // should evaluate to a singular string. The output of this expression can override - // the `name_id_format` setting. - NameIDTransformJsonata param.Field[string] `json:"name_id_transform_jsonata"` - // The Access public certificate that will be used to verify your identity. - PublicKey param.Field[string] `json:"public_key"` - // A globally unique name for an identity or service provider. - SpEntityID param.Field[string] `json:"sp_entity_id"` - // The endpoint where your SaaS application will send login requests. - SSOEndpoint param.Field[string] `json:"sso_endpoint"` +func (r AccessApplicationNewParamsAppLauncherApplication) getAccountID() param.Field[string] { + return r.AccountID } -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r AccessApplicationNewParamsAppLauncherApplication) getZoneID() param.Field[string] { + return r.ZoneID } -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp) implementsZeroTrustAccessApplicationUpdateParamsSaasApp() { +func (AccessApplicationNewParamsAppLauncherApplication) ImplementsAccessApplicationNewParams() { + } -// Optional identifier indicating the authentication protocol used for the saas -// app. Required for OIDC. Default if unset is "saml" -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthType string +// The application type. +type AccessApplicationNewParamsAppLauncherApplicationType string const ( - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthTypeSaml AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthType = "saml" - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthTypeOidc AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthType = "oidc" + AccessApplicationNewParamsAppLauncherApplicationTypeSelfHosted AccessApplicationNewParamsAppLauncherApplicationType = "self_hosted" + AccessApplicationNewParamsAppLauncherApplicationTypeSaas AccessApplicationNewParamsAppLauncherApplicationType = "saas" + AccessApplicationNewParamsAppLauncherApplicationTypeSSH AccessApplicationNewParamsAppLauncherApplicationType = "ssh" + AccessApplicationNewParamsAppLauncherApplicationTypeVnc AccessApplicationNewParamsAppLauncherApplicationType = "vnc" + AccessApplicationNewParamsAppLauncherApplicationTypeAppLauncher AccessApplicationNewParamsAppLauncherApplicationType = "app_launcher" + AccessApplicationNewParamsAppLauncherApplicationTypeWARP AccessApplicationNewParamsAppLauncherApplicationType = "warp" + AccessApplicationNewParamsAppLauncherApplicationTypeBiso AccessApplicationNewParamsAppLauncherApplicationType = "biso" + AccessApplicationNewParamsAppLauncherApplicationTypeBookmark AccessApplicationNewParamsAppLauncherApplicationType = "bookmark" + AccessApplicationNewParamsAppLauncherApplicationTypeDashSSO AccessApplicationNewParamsAppLauncherApplicationType = "dash_sso" ) -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthType) IsKnown() bool { +func (r AccessApplicationNewParamsAppLauncherApplicationType) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthTypeSaml, AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthTypeOidc: + case AccessApplicationNewParamsAppLauncherApplicationTypeSelfHosted, AccessApplicationNewParamsAppLauncherApplicationTypeSaas, AccessApplicationNewParamsAppLauncherApplicationTypeSSH, AccessApplicationNewParamsAppLauncherApplicationTypeVnc, AccessApplicationNewParamsAppLauncherApplicationTypeAppLauncher, AccessApplicationNewParamsAppLauncherApplicationTypeWARP, AccessApplicationNewParamsAppLauncherApplicationTypeBiso, AccessApplicationNewParamsAppLauncherApplicationTypeBookmark, AccessApplicationNewParamsAppLauncherApplicationTypeDashSSO: return true } return false } -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributes struct { +type AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication struct { + // The application type. + Type param.Field[AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` +} + +func (r AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsDeviceEnrollmentPermissionsApplication) ImplementsAccessApplicationNewParams() { + +} + +// The application type. +type AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType string + +const ( + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSelfHosted AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "self_hosted" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSaas AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "saas" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSSH AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "ssh" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeVnc AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "vnc" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeAppLauncher AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "app_launcher" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeWARP AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "warp" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeBiso AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "biso" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeBookmark AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "bookmark" + AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeDashSSO AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType = "dash_sso" +) + +func (r AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationType) IsKnown() bool { + switch r { + case AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSelfHosted, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSaas, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeSSH, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeVnc, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeAppLauncher, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeWARP, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeBiso, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeBookmark, AccessApplicationNewParamsDeviceEnrollmentPermissionsApplicationTypeDashSSO: + return true + } + return false +} + +type AccessApplicationNewParamsBrowserIsolationPermissionsApplication struct { + // The application type. + Type param.Field[AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` +} + +func (r AccessApplicationNewParamsBrowserIsolationPermissionsApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationNewParamsBrowserIsolationPermissionsApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsBrowserIsolationPermissionsApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsBrowserIsolationPermissionsApplication) ImplementsAccessApplicationNewParams() { + +} + +// The application type. +type AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType string + +const ( + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSelfHosted AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "self_hosted" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSaas AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "saas" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSSH AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "ssh" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeVnc AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "vnc" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeAppLauncher AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "app_launcher" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeWARP AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "warp" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeBiso AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "biso" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeBookmark AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "bookmark" + AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeDashSSO AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType = "dash_sso" +) + +func (r AccessApplicationNewParamsBrowserIsolationPermissionsApplicationType) IsKnown() bool { + switch r { + case AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSelfHosted, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSaas, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeSSH, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeVnc, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeAppLauncher, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeWARP, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeBiso, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeBookmark, AccessApplicationNewParamsBrowserIsolationPermissionsApplicationTypeDashSSO: + return true + } + return false +} + +type AccessApplicationNewParamsBookmarkApplication struct { + // 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"` + AppLauncherVisible param.Field[interface{}] `json:"app_launcher_visible"` + // The URL or domain of the bookmark. + Domain param.Field[interface{}] `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` + // The application type. + Type param.Field[string] `json:"type"` +} + +func (r AccessApplicationNewParamsBookmarkApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationNewParamsBookmarkApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationNewParamsBookmarkApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationNewParamsBookmarkApplication) ImplementsAccessApplicationNewParams() { + +} + +type AccessApplicationNewResponseEnvelope struct { + Errors []AccessApplicationNewResponseEnvelopeErrors `json:"errors,required"` + Messages []AccessApplicationNewResponseEnvelopeMessages `json:"messages,required"` + Result AccessApps `json:"result,required"` + // Whether the API call was successful + Success AccessApplicationNewResponseEnvelopeSuccess `json:"success,required"` + JSON accessApplicationNewResponseEnvelopeJSON `json:"-"` +} + +// accessApplicationNewResponseEnvelopeJSON contains the JSON metadata for the +// struct [AccessApplicationNewResponseEnvelope] +type accessApplicationNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccessApplicationNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r accessApplicationNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type AccessApplicationNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accessApplicationNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// accessApplicationNewResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [AccessApplicationNewResponseEnvelopeErrors] +type accessApplicationNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccessApplicationNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r accessApplicationNewResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw +} + +type AccessApplicationNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON accessApplicationNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// accessApplicationNewResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [AccessApplicationNewResponseEnvelopeMessages] +type accessApplicationNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccessApplicationNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r accessApplicationNewResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type AccessApplicationNewResponseEnvelopeSuccess bool + +const ( + AccessApplicationNewResponseEnvelopeSuccessTrue AccessApplicationNewResponseEnvelopeSuccess = true +) + +func (r AccessApplicationNewResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case AccessApplicationNewResponseEnvelopeSuccessTrue: + return true + } + return false +} + +// This interface is a union satisfied by one of the following: +// [AccessApplicationUpdateParamsSelfHostedApplication], +// [AccessApplicationUpdateParamsSaaSApplication], +// [AccessApplicationUpdateParamsBrowserSSHApplication], +// [AccessApplicationUpdateParamsBrowserVncApplication], +// [AccessApplicationUpdateParamsAppLauncherApplication], +// [AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication], +// [AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication], +// [AccessApplicationUpdateParamsBookmarkApplication]. +type AccessApplicationUpdateParams interface { + ImplementsAccessApplicationUpdateParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type AccessApplicationUpdateParamsSelfHostedApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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"` + // When set to true, users can authenticate to this application using their WARP + // session. When set to false this application will always require direct IdP + // authentication. This setting always overrides the organization setting for WARP + // authentication. + AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationUpdateParamsSelfHostedApplicationCorsHeaders] `json:"cors_headers"` + // The custom error message shown to a user when they are denied access to the + // application. + CustomDenyMessage param.Field[string] `json:"custom_deny_message"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing identity-based rules. + CustomDenyURL param.Field[string] `json:"custom_deny_url"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing non-identity rules. + CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // Enables the binding cookie, which increases security against compromised + // authorization tokens and CSRF attacks. + EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` + // Enables the HttpOnly cookie attribute, which increases security against XSS + // attacks. + HTTPOnlyCookieAttribute param.Field[bool] `json:"http_only_cookie_attribute"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + // Enables cookie paths to scope an application's JWT to the application path. If + // disabled, the JWT will scope to the hostname by default + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` + // Sets the SameSite cookie setting, which provides increased security against CSRF + // attacks. + SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` + // List of domains that Access will secure. + SelfHostedDomains param.Field[[]string] `json:"self_hosted_domains"` + // Returns a 401 status code when the request is blocked by a Service Auth policy. + ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` + // Enables automatic authentication through cloudflared. + SkipInterstitial param.Field[bool] `json:"skip_interstitial"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` +} + +func (r AccessApplicationUpdateParamsSelfHostedApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsSelfHostedApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsSelfHostedApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsSelfHostedApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsSelfHostedApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsSelfHostedApplicationAppID() +} + +type AccessApplicationUpdateParamsSelfHostedApplicationCorsHeaders struct { + // Allows all HTTP request headers. + AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` + // Allows all HTTP request methods. + AllowAllMethods param.Field[bool] `json:"allow_all_methods"` + // Allows all origins. + AllowAllOrigins param.Field[bool] `json:"allow_all_origins"` + // When set to `true`, includes credentials (cookies, authorization headers, or TLS + // client certificates) with requests. + AllowCredentials param.Field[bool] `json:"allow_credentials"` + // Allowed HTTP request headers. + AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods param.Field[[]AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` + // The maximum number of seconds the results of a preflight request can be cached. + MaxAge param.Field[float64] `json:"max_age"` +} + +func (r AccessApplicationUpdateParamsSelfHostedApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod string + +const ( + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodGet AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPost AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodHead AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPut AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodDelete AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodConnect AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodOptions AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodTrace AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPatch AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod = "PATCH" +) + +func (r AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodGet, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPost, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodHead, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPut, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodDelete, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodConnect, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodOptions, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodTrace, AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodPatch: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplication struct { + // 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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + SaasApp param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasApp] `json:"saas_app"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` + // The application type. + Type param.Field[string] `json:"type"` +} + +func (r AccessApplicationUpdateParamsSaaSApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsSaaSApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsSaaSApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsSaaSApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsSaaSApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationAppID() +} + +// Satisfied by +// [zero_trust.AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasApp], +// [zero_trust.AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasApp]. +type AccessApplicationUpdateParamsSaaSApplicationSaasApp interface { + implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasApp() +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasApp struct { + // Optional identifier indicating the authentication protocol used for the saas + // app. Required for OIDC. Default if unset is "saml" + AuthType param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType] `json:"auth_type"` + // The service provider's endpoint that is responsible for receiving and parsing a + // SAML assertion. + ConsumerServiceURL param.Field[string] `json:"consumer_service_url"` + CustomAttributes param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes] `json:"custom_attributes"` + // The URL that the user will be redirected to after a successful login for IDP + // initiated logins. + DefaultRelayState param.Field[string] `json:"default_relay_state"` + // The unique identifier for your SaaS application. + IDPEntityID param.Field[string] `json:"idp_entity_id"` + // The format of the name identifier sent to the SaaS application. + NameIDFormat param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat] `json:"name_id_format"` + // A [JSONata](https://jsonata.org/) expression that transforms an application's + // user identities into a NameID value for its SAML assertion. This expression + // should evaluate to a singular string. The output of this expression can override + // the `name_id_format` setting. + NameIDTransformJsonata param.Field[string] `json:"name_id_transform_jsonata"` + // The Access public certificate that will be used to verify your identity. + PublicKey param.Field[string] `json:"public_key"` + // A globally unique name for an identity or service provider. + SpEntityID param.Field[string] `json:"sp_entity_id"` + // The endpoint where your SaaS application will send login requests. + SSOEndpoint param.Field[string] `json:"sso_endpoint"` +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasApp) implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasApp() { +} + +// Optional identifier indicating the authentication protocol used for the saas +// app. Required for OIDC. Default if unset is "saml" +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeSaml AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType = "saml" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeOidc AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType = "oidc" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthType) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeSaml, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppAuthTypeOidc: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes struct { // The name of the attribute. Name param.Field[string] `json:"name"` // A globally unique name for an identity or service provider. - NameFormat param.Field[AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat] `json:"name_format"` - Source param.Field[AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesSource] `json:"source"` + NameFormat param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat] `json:"name_format"` + Source param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource] `json:"source"` +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A globally unique name for an identity or service provider. +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormat) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource struct { + // The name of the IdP attribute. + Name param.Field[string] `json:"name"` +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppCustomAttributesSource) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The format of the name identifier sent to the SaaS application. +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatID AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat = "id" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatEmail AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat = "email" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormat) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatID, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessSamlSaasAppNameIDFormatEmail: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasApp struct { + // The URL where this applications tile redirects users + AppLauncherURL param.Field[string] `json:"app_launcher_url"` + // Identifier of the authentication protocol used for the saas app. Required for + // OIDC. + AuthType param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType] `json:"auth_type"` + // The application client id + ClientID param.Field[string] `json:"client_id"` + // The application client secret, only returned on POST request. + ClientSecret param.Field[string] `json:"client_secret"` + // The OIDC flows supported by this application + GrantTypes param.Field[[]AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType] `json:"grant_types"` + // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint + GroupFilterRegex param.Field[string] `json:"group_filter_regex"` + // The Access public certificate that will be used to verify your identity. + PublicKey param.Field[string] `json:"public_key"` + // The permitted URL's for Cloudflare to return Authorization codes and Access/ID + // tokens + RedirectURIs param.Field[[]string] `json:"redirect_uris"` + // Define the user information shared with access + Scopes param.Field[[]AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope] `json:"scopes"` +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasApp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasApp) implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasApp() { +} + +// Identifier of the authentication protocol used for the saas app. Required for +// OIDC. +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeSaml AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType = "saml" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeOidc AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType = "oidc" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthType) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeSaml, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppAuthTypeOidc: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType = "authorization_code" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType = "authorization_code_with_pkce" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantType) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce: + return true + } + return false +} + +type AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope string + +const ( + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeOpenid AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "openid" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeGroups AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "groups" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeEmail AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "email" + AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeProfile AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope = "profile" +) + +func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScope) IsKnown() bool { + switch r { + case AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeOpenid, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeGroups, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeEmail, AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOidcSaasAppScopeProfile: + return true + } + return false +} + +type AccessApplicationUpdateParamsBrowserSSHApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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"` + // When set to true, users can authenticate to this application using their WARP + // session. When set to false this application will always require direct IdP + // authentication. This setting always overrides the organization setting for WARP + // authentication. + AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeaders] `json:"cors_headers"` + // The custom error message shown to a user when they are denied access to the + // application. + CustomDenyMessage param.Field[string] `json:"custom_deny_message"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing identity-based rules. + CustomDenyURL param.Field[string] `json:"custom_deny_url"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing non-identity rules. + CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // Enables the binding cookie, which increases security against compromised + // authorization tokens and CSRF attacks. + EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` + // Enables the HttpOnly cookie attribute, which increases security against XSS + // attacks. + HTTPOnlyCookieAttribute param.Field[bool] `json:"http_only_cookie_attribute"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + // Enables cookie paths to scope an application's JWT to the application path. If + // disabled, the JWT will scope to the hostname by default + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` + // Sets the SameSite cookie setting, which provides increased security against CSRF + // attacks. + SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` + // List of domains that Access will secure. + SelfHostedDomains param.Field[[]string] `json:"self_hosted_domains"` + // Returns a 401 status code when the request is blocked by a Service Auth policy. + ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` + // Enables automatic authentication through cloudflared. + SkipInterstitial param.Field[bool] `json:"skip_interstitial"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` +} + +func (r AccessApplicationUpdateParamsBrowserSSHApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsBrowserSSHApplication) getAccountID() param.Field[string] { + return r.AccountID } -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributes) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationUpdateParamsBrowserSSHApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsBrowserSSHApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsBrowserSSHApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsBrowserSSHApplicationAppID() +} + +type AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeaders struct { + // Allows all HTTP request headers. + AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` + // Allows all HTTP request methods. + AllowAllMethods param.Field[bool] `json:"allow_all_methods"` + // Allows all origins. + AllowAllOrigins param.Field[bool] `json:"allow_all_origins"` + // When set to `true`, includes credentials (cookies, authorization headers, or TLS + // client certificates) with requests. + AllowCredentials param.Field[bool] `json:"allow_credentials"` + // Allowed HTTP request headers. + AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods param.Field[[]AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` + // The maximum number of seconds the results of a preflight request can be cached. + MaxAge param.Field[float64] `json:"max_age"` +} + +func (r AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// A globally unique name for an identity or service provider. -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat string +type AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod string const ( - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodGet AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPost AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodHead AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPut AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodDelete AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodConnect AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodOptions AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodTrace AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPatch AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod = "PATCH" ) -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormat) IsKnown() bool { +func (r AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethod) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatUnspecified, AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic, AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatURI: + case AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodGet, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPost, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodHead, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPut, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodDelete, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodConnect, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodOptions, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodTrace, AccessApplicationUpdateParamsBrowserSSHApplicationCorsHeadersAllowedMethodPatch: return true } return false } -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesSource struct { - // The name of the IdP attribute. +type AccessApplicationUpdateParamsBrowserVncApplication struct { + // The primary hostname and path that Access will secure. If the app is visible in + // the App Launcher dashboard, this is the domain that will be displayed. + Domain param.Field[string] `json:"domain,required"` + // The application type. + Type param.Field[string] `json:"type,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"` + // When set to true, users can authenticate to this application using their WARP + // session. When set to false this application will always require direct IdP + // authentication. This setting always overrides the organization setting for WARP + // authentication. + AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + CorsHeaders param.Field[AccessApplicationUpdateParamsBrowserVncApplicationCorsHeaders] `json:"cors_headers"` + // The custom error message shown to a user when they are denied access to the + // application. + CustomDenyMessage param.Field[string] `json:"custom_deny_message"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing identity-based rules. + CustomDenyURL param.Field[string] `json:"custom_deny_url"` + // The custom URL a user is redirected to when they are denied access to the + // application when failing non-identity rules. + CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` + // The custom pages that will be displayed when applicable for this application + CustomPages param.Field[[]string] `json:"custom_pages"` + // Enables the binding cookie, which increases security against compromised + // authorization tokens and CSRF attacks. + EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` + // Enables the HttpOnly cookie attribute, which increases security against XSS + // attacks. + HTTPOnlyCookieAttribute param.Field[bool] `json:"http_only_cookie_attribute"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. Name param.Field[string] `json:"name"` + // Enables cookie paths to scope an application's JWT to the application path. If + // disabled, the JWT will scope to the hostname by default + PathCookieAttribute param.Field[bool] `json:"path_cookie_attribute"` + // Sets the SameSite cookie setting, which provides increased security against CSRF + // attacks. + SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` + // List of domains that Access will secure. + SelfHostedDomains param.Field[[]string] `json:"self_hosted_domains"` + // Returns a 401 status code when the request is blocked by a Service Auth policy. + ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` + // Enables automatic authentication through cloudflared. + SkipInterstitial param.Field[bool] `json:"skip_interstitial"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` } -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesSource) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationUpdateParamsBrowserVncApplication) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The format of the name identifier sent to the SaaS application. -type AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormat string +func (r AccessApplicationUpdateParamsBrowserVncApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsBrowserVncApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsBrowserVncApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsBrowserVncApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsBrowserVncApplicationAppID() +} + +type AccessApplicationUpdateParamsBrowserVncApplicationCorsHeaders struct { + // Allows all HTTP request headers. + AllowAllHeaders param.Field[bool] `json:"allow_all_headers"` + // Allows all HTTP request methods. + AllowAllMethods param.Field[bool] `json:"allow_all_methods"` + // Allows all origins. + AllowAllOrigins param.Field[bool] `json:"allow_all_origins"` + // When set to `true`, includes credentials (cookies, authorization headers, or TLS + // client certificates) with requests. + AllowCredentials param.Field[bool] `json:"allow_credentials"` + // Allowed HTTP request headers. + AllowedHeaders param.Field[[]interface{}] `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods param.Field[[]AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod] `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins param.Field[[]interface{}] `json:"allowed_origins"` + // The maximum number of seconds the results of a preflight request can be cached. + MaxAge param.Field[float64] `json:"max_age"` +} + +func (r AccessApplicationUpdateParamsBrowserVncApplicationCorsHeaders) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod string const ( - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormatID AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormat = "id" - AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormatEmail AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormat = "email" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodGet AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "GET" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPost AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "POST" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodHead AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "HEAD" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPut AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "PUT" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodDelete AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "DELETE" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodConnect AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "CONNECT" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodOptions AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "OPTIONS" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodTrace AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "TRACE" + AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPatch AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod = "PATCH" ) -func (r AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormat) IsKnown() bool { +func (r AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethod) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormatID, AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormatEmail: + case AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodGet, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPost, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodHead, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPut, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodDelete, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodConnect, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodOptions, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodTrace, AccessApplicationUpdateParamsBrowserVncApplicationCorsHeadersAllowedMethodPatch: return true } return false } -type AccessApplicationUpdateParamsSaasAppAccessOidcSaasApp struct { - // The URL where this applications tile redirects users - AppLauncherURL param.Field[string] `json:"app_launcher_url"` - // Identifier of the authentication protocol used for the saas app. Required for - // OIDC. - AuthType param.Field[AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthType] `json:"auth_type"` - // The application client id - ClientID param.Field[string] `json:"client_id"` - // The application client secret, only returned on POST request. - ClientSecret param.Field[string] `json:"client_secret"` - // The OIDC flows supported by this application - GrantTypes param.Field[[]AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantType] `json:"grant_types"` - // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint - GroupFilterRegex param.Field[string] `json:"group_filter_regex"` - // The Access public certificate that will be used to verify your identity. - PublicKey param.Field[string] `json:"public_key"` - // The permitted URL's for Cloudflare to return Authorization codes and Access/ID - // tokens - RedirectURIs param.Field[[]string] `json:"redirect_uris"` - // Define the user information shared with access - Scopes param.Field[[]AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope] `json:"scopes"` +type AccessApplicationUpdateParamsAppLauncherApplication struct { + // The application type. + Type param.Field[AccessApplicationUpdateParamsAppLauncherApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` } -func (r AccessApplicationUpdateParamsSaasAppAccessOidcSaasApp) MarshalJSON() (data []byte, err error) { +func (r AccessApplicationUpdateParamsAppLauncherApplication) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AccessApplicationUpdateParamsSaasAppAccessOidcSaasApp) implementsZeroTrustAccessApplicationUpdateParamsSaasApp() { +func (r AccessApplicationUpdateParamsAppLauncherApplication) getAccountID() param.Field[string] { + return r.AccountID } -// Identifier of the authentication protocol used for the saas app. Required for -// OIDC. -type AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthType string +func (r AccessApplicationUpdateParamsAppLauncherApplication) getZoneID() param.Field[string] { + return r.ZoneID +} -const ( - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthTypeSaml AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthType = "saml" - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthTypeOidc AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthType = "oidc" -) +func (AccessApplicationUpdateParamsAppLauncherApplication) ImplementsAccessApplicationUpdateParams() { -func (r AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthType) IsKnown() bool { - switch r { - case AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthTypeSaml, AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppAuthTypeOidc: - return true - } - return false } -type AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantType string +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsAppLauncherApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsAppLauncherApplicationAppID() +} + +// The application type. +type AccessApplicationUpdateParamsAppLauncherApplicationType string const ( - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantType = "authorization_code" - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantType = "authorization_code_with_pkce" + AccessApplicationUpdateParamsAppLauncherApplicationTypeSelfHosted AccessApplicationUpdateParamsAppLauncherApplicationType = "self_hosted" + AccessApplicationUpdateParamsAppLauncherApplicationTypeSaas AccessApplicationUpdateParamsAppLauncherApplicationType = "saas" + AccessApplicationUpdateParamsAppLauncherApplicationTypeSSH AccessApplicationUpdateParamsAppLauncherApplicationType = "ssh" + AccessApplicationUpdateParamsAppLauncherApplicationTypeVnc AccessApplicationUpdateParamsAppLauncherApplicationType = "vnc" + AccessApplicationUpdateParamsAppLauncherApplicationTypeAppLauncher AccessApplicationUpdateParamsAppLauncherApplicationType = "app_launcher" + AccessApplicationUpdateParamsAppLauncherApplicationTypeWARP AccessApplicationUpdateParamsAppLauncherApplicationType = "warp" + AccessApplicationUpdateParamsAppLauncherApplicationTypeBiso AccessApplicationUpdateParamsAppLauncherApplicationType = "biso" + AccessApplicationUpdateParamsAppLauncherApplicationTypeBookmark AccessApplicationUpdateParamsAppLauncherApplicationType = "bookmark" + AccessApplicationUpdateParamsAppLauncherApplicationTypeDashSSO AccessApplicationUpdateParamsAppLauncherApplicationType = "dash_sso" ) -func (r AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantType) IsKnown() bool { +func (r AccessApplicationUpdateParamsAppLauncherApplicationType) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCode, AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppGrantTypeAuthorizationCodeWithPkce: + case AccessApplicationUpdateParamsAppLauncherApplicationTypeSelfHosted, AccessApplicationUpdateParamsAppLauncherApplicationTypeSaas, AccessApplicationUpdateParamsAppLauncherApplicationTypeSSH, AccessApplicationUpdateParamsAppLauncherApplicationTypeVnc, AccessApplicationUpdateParamsAppLauncherApplicationTypeAppLauncher, AccessApplicationUpdateParamsAppLauncherApplicationTypeWARP, AccessApplicationUpdateParamsAppLauncherApplicationTypeBiso, AccessApplicationUpdateParamsAppLauncherApplicationTypeBookmark, AccessApplicationUpdateParamsAppLauncherApplicationTypeDashSSO: return true } return false } -type AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope string +type AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication struct { + // The application type. + Type param.Field[AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` +} + +func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationAppID() +} + +// The application type. +type AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType string const ( - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeOpenid AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope = "openid" - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeGroups AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope = "groups" - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeEmail AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope = "email" - AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeProfile AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope = "profile" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSelfHosted AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "self_hosted" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSaas AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "saas" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSSH AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "ssh" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeVnc AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "vnc" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeAppLauncher AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "app_launcher" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeWARP AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "warp" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBiso AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "biso" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBookmark AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "bookmark" + AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeDashSSO AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType = "dash_sso" ) -func (r AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScope) IsKnown() bool { +func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeOpenid, AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeGroups, AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeEmail, AccessApplicationUpdateParamsSaasAppAccessOidcSaasAppScopeProfile: + case AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSelfHosted, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSaas, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSSH, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeVnc, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeAppLauncher, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeWARP, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBiso, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBookmark, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeDashSSO: return true } return false } +type AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication struct { + // The application type. + Type param.Field[AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType] `json:"type,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"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]string] `json:"allowed_idps"` + // When set to `true`, users skip the identity provider selection step during + // login. You must specify only one identity provider in allowed_idps. + AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` + // The amount of time that tokens issued for this application will be valid. Must + // be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, + // s, m, h. + SessionDuration param.Field[string] `json:"session_duration"` +} + +func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationAppID() +} + // The application type. -type AccessApplicationUpdateParamsType string +type AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType string const ( - AccessApplicationUpdateParamsTypeSelfHosted AccessApplicationUpdateParamsType = "self_hosted" - AccessApplicationUpdateParamsTypeSaas AccessApplicationUpdateParamsType = "saas" - AccessApplicationUpdateParamsTypeSSH AccessApplicationUpdateParamsType = "ssh" - AccessApplicationUpdateParamsTypeVnc AccessApplicationUpdateParamsType = "vnc" - AccessApplicationUpdateParamsTypeAppLauncher AccessApplicationUpdateParamsType = "app_launcher" - AccessApplicationUpdateParamsTypeWARP AccessApplicationUpdateParamsType = "warp" - AccessApplicationUpdateParamsTypeBiso AccessApplicationUpdateParamsType = "biso" - AccessApplicationUpdateParamsTypeBookmark AccessApplicationUpdateParamsType = "bookmark" - AccessApplicationUpdateParamsTypeDashSSO AccessApplicationUpdateParamsType = "dash_sso" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSelfHosted AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "self_hosted" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSaas AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "saas" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSSH AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "ssh" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeVnc AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "vnc" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeAppLauncher AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "app_launcher" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeWARP AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "warp" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBiso AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "biso" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBookmark AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "bookmark" + AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeDashSSO AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType = "dash_sso" ) -func (r AccessApplicationUpdateParamsType) IsKnown() bool { +func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsTypeSelfHosted, AccessApplicationUpdateParamsTypeSaas, AccessApplicationUpdateParamsTypeSSH, AccessApplicationUpdateParamsTypeVnc, AccessApplicationUpdateParamsTypeAppLauncher, AccessApplicationUpdateParamsTypeWARP, AccessApplicationUpdateParamsTypeBiso, AccessApplicationUpdateParamsTypeBookmark, AccessApplicationUpdateParamsTypeDashSSO: + case AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSelfHosted, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSaas, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSSH, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeVnc, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeAppLauncher, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeWARP, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBiso, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBookmark, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeDashSSO: return true } return false } +type AccessApplicationUpdateParamsBookmarkApplication struct { + // 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"` + AppLauncherVisible param.Field[interface{}] `json:"app_launcher_visible"` + // The URL or domain of the bookmark. + Domain param.Field[interface{}] `json:"domain"` + // The image URL for the logo shown in the App Launcher dashboard. + LogoURL param.Field[string] `json:"logo_url"` + // The name of the application. + Name param.Field[string] `json:"name"` + // The tags you want assigned to an application. Tags are used to filter + // applications in the App Launcher dashboard. + Tags param.Field[[]string] `json:"tags"` + // The application type. + Type param.Field[string] `json:"type"` +} + +func (r AccessApplicationUpdateParamsBookmarkApplication) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AccessApplicationUpdateParamsBookmarkApplication) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r AccessApplicationUpdateParamsBookmarkApplication) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (AccessApplicationUpdateParamsBookmarkApplication) ImplementsAccessApplicationUpdateParams() { + +} + +// Identifier +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type AccessApplicationUpdateParamsBookmarkApplicationAppID interface { + ImplementsZeroTrustAccessApplicationUpdateParamsBookmarkApplicationAppID() +} + type AccessApplicationUpdateResponseEnvelope struct { Errors []AccessApplicationUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []AccessApplicationUpdateResponseEnvelopeMessages `json:"messages,required"` diff --git a/zero_trust/accessapplication_test.go b/zero_trust/accessapplication_test.go index 0de70898158..72608fc9f31 100644 --- a/zero_trust/accessapplication_test.go +++ b/zero_trust/accessapplication_test.go @@ -29,20 +29,22 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.ZeroTrust.Access.Applications.New(context.TODO(), zero_trust.AccessApplicationNewParams{ + _, err := client.ZeroTrust.Access.Applications.New(context.TODO(), zero_trust.AccessApplicationNewParamsSelfHostedApplication{ + Domain: cloudflare.F("test.example.com/admin"), + Type: cloudflare.F("self_hosted"), AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), AllowAuthenticateViaWARP: cloudflare.F(true), AllowedIDPs: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - AppLauncherVisible: cloudflare.F[any](map[string]interface{}{}), + AppLauncherVisible: cloudflare.F(true), AutoRedirectToIdentity: cloudflare.F(true), - CorsHeaders: cloudflare.F(zero_trust.AccessApplicationNewParamsCorsHeaders{ + CorsHeaders: cloudflare.F(zero_trust.AccessApplicationNewParamsSelfHostedApplicationCorsHeaders{ AllowAllHeaders: cloudflare.F(true), AllowAllMethods: cloudflare.F(true), AllowAllOrigins: cloudflare.F(true), AllowCredentials: cloudflare.F(true), AllowedHeaders: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), - AllowedMethods: cloudflare.F([]zero_trust.AccessApplicationNewParamsCorsHeadersAllowedMethod{zero_trust.AccessApplicationNewParamsCorsHeadersAllowedMethodGet}), + AllowedMethods: cloudflare.F([]zero_trust.AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethod{zero_trust.AccessApplicationNewParamsSelfHostedApplicationCorsHeadersAllowedMethodGet}), AllowedOrigins: cloudflare.F([]interface{}{"https://example.com"}), MaxAge: cloudflare.F(-1.000000), }), @@ -50,37 +52,17 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { CustomDenyURL: cloudflare.F("string"), CustomNonIdentityDenyURL: cloudflare.F("string"), CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - Domain: cloudflare.F[any]("https://mybookmark.com"), EnableBindingCookie: cloudflare.F(true), HTTPOnlyCookieAttribute: cloudflare.F(true), LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"), Name: cloudflare.F("Admin Site"), PathCookieAttribute: cloudflare.F(true), - SaasApp: cloudflare.F[zero_trust.AccessApplicationNewParamsSaasApp](zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasApp(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasApp{ - AuthType: cloudflare.F(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasAppAuthTypeSaml), - ConsumerServiceURL: cloudflare.F("https://example.com"), - CustomAttributes: cloudflare.F(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributes{ - Name: cloudflare.F("family_name"), - NameFormat: cloudflare.F(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic), - Source: cloudflare.F(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasAppCustomAttributesSource{ - Name: cloudflare.F("last_name"), - }), - }), - DefaultRelayState: cloudflare.F("https://example.com"), - IDPEntityID: cloudflare.F("https://example.cloudflareaccess.com"), - NameIDFormat: cloudflare.F(zero_trust.AccessApplicationNewParamsSaasAppAccessSamlSaasAppNameIDFormatID), - NameIDTransformJsonata: cloudflare.F("$substringBefore(email, '@') & '+sandbox@' & $substringAfter(email, '@')"), - PublicKey: cloudflare.F("example unique name"), - SpEntityID: cloudflare.F("example unique name"), - SSOEndpoint: cloudflare.F("https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd"), - })), - SameSiteCookieAttribute: cloudflare.F("strict"), - SelfHostedDomains: cloudflare.F([]string{"test.example.com/admin", "test.anotherexample.com/staff"}), - ServiceAuth401Redirect: cloudflare.F(true), - SessionDuration: cloudflare.F("24h"), - SkipInterstitial: cloudflare.F(true), - Tags: cloudflare.F([]string{"engineers", "engineers", "engineers"}), - Type: cloudflare.F(zero_trust.AccessApplicationNewParamsTypeBookmark), + SameSiteCookieAttribute: cloudflare.F("strict"), + SelfHostedDomains: cloudflare.F([]string{"test.example.com/admin", "test.anotherexample.com/staff"}), + ServiceAuth401Redirect: cloudflare.F(true), + SessionDuration: cloudflare.F("24h"), + SkipInterstitial: cloudflare.F(true), + Tags: cloudflare.F([]string{"engineers", "engineers", "engineers"}), }) if err != nil { var apierr *cloudflare.Error @@ -108,20 +90,22 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { _, err := client.ZeroTrust.Access.Applications.Update( context.TODO(), shared.UnionString("023e105f4ecef8ad9ca31a8372d0c353"), - zero_trust.AccessApplicationUpdateParams{ + zero_trust.AccessApplicationUpdateParamsSelfHostedApplication{ + Domain: cloudflare.F("test.example.com/admin"), + Type: cloudflare.F("self_hosted"), AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), AllowAuthenticateViaWARP: cloudflare.F(true), AllowedIDPs: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - AppLauncherVisible: cloudflare.F[any](map[string]interface{}{}), + AppLauncherVisible: cloudflare.F(true), AutoRedirectToIdentity: cloudflare.F(true), - CorsHeaders: cloudflare.F(zero_trust.AccessApplicationUpdateParamsCorsHeaders{ + CorsHeaders: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSelfHostedApplicationCorsHeaders{ AllowAllHeaders: cloudflare.F(true), AllowAllMethods: cloudflare.F(true), AllowAllOrigins: cloudflare.F(true), AllowCredentials: cloudflare.F(true), AllowedHeaders: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), - AllowedMethods: cloudflare.F([]zero_trust.AccessApplicationUpdateParamsCorsHeadersAllowedMethod{zero_trust.AccessApplicationUpdateParamsCorsHeadersAllowedMethodGet}), + AllowedMethods: cloudflare.F([]zero_trust.AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethod{zero_trust.AccessApplicationUpdateParamsSelfHostedApplicationCorsHeadersAllowedMethodGet}), AllowedOrigins: cloudflare.F([]interface{}{"https://example.com"}), MaxAge: cloudflare.F(-1.000000), }), @@ -129,37 +113,17 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { CustomDenyURL: cloudflare.F("string"), CustomNonIdentityDenyURL: cloudflare.F("string"), CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - Domain: cloudflare.F[any]("https://mybookmark.com"), EnableBindingCookie: cloudflare.F(true), HTTPOnlyCookieAttribute: cloudflare.F(true), LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"), Name: cloudflare.F("Admin Site"), PathCookieAttribute: cloudflare.F(true), - SaasApp: cloudflare.F[zero_trust.AccessApplicationUpdateParamsSaasApp](zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasApp{ - AuthType: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppAuthTypeSaml), - ConsumerServiceURL: cloudflare.F("https://example.com"), - CustomAttributes: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributes{ - Name: cloudflare.F("family_name"), - NameFormat: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesNameFormatUrnOasisNamesTcSaml2_0AttrnameFormatBasic), - Source: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppCustomAttributesSource{ - Name: cloudflare.F("last_name"), - }), - }), - DefaultRelayState: cloudflare.F("https://example.com"), - IDPEntityID: cloudflare.F("https://example.cloudflareaccess.com"), - NameIDFormat: cloudflare.F(zero_trust.AccessApplicationUpdateParamsSaasAppAccessSamlSaasAppNameIDFormatID), - NameIDTransformJsonata: cloudflare.F("$substringBefore(email, '@') & '+sandbox@' & $substringAfter(email, '@')"), - PublicKey: cloudflare.F("example unique name"), - SpEntityID: cloudflare.F("example unique name"), - SSOEndpoint: cloudflare.F("https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd"), - })), - SameSiteCookieAttribute: cloudflare.F("strict"), - SelfHostedDomains: cloudflare.F([]string{"test.example.com/admin", "test.anotherexample.com/staff"}), - ServiceAuth401Redirect: cloudflare.F(true), - SessionDuration: cloudflare.F("24h"), - SkipInterstitial: cloudflare.F(true), - Tags: cloudflare.F([]string{"engineers", "engineers", "engineers"}), - Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsTypeBookmark), + SameSiteCookieAttribute: cloudflare.F("strict"), + SelfHostedDomains: cloudflare.F([]string{"test.example.com/admin", "test.anotherexample.com/staff"}), + ServiceAuth401Redirect: cloudflare.F(true), + SessionDuration: cloudflare.F("24h"), + SkipInterstitial: cloudflare.F(true), + Tags: cloudflare.F([]string{"engineers", "engineers", "engineers"}), }, ) if err != nil { diff --git a/zero_trust/identityprovider.go b/zero_trust/identityprovider.go index 72e72c7ef23..4ba899071cb 100644 --- a/zero_trust/identityprovider.go +++ b/zero_trust/identityprovider.go @@ -39,12 +39,12 @@ func (r *IdentityProviderService) New(ctx context.Context, params IdentityProvid var env IdentityProviderNewResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/access/identity_providers", accountOrZone, accountOrZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -61,12 +61,12 @@ func (r *IdentityProviderService) Update(ctx context.Context, uuid string, param var env IdentityProviderUpdateResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if params.getAccountID().Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = params.getAccountID() } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = params.getZoneID() } path := fmt.Sprintf("%s/%s/access/identity_providers/%s", accountOrZone, accountOrZoneID, uuid) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) @@ -4470,41 +4470,67 @@ func (r identityProviderDeleteResponseJSON) RawJSON() string { return r.raw } -type IdentityProviderNewParams struct { - Config param.Field[IdentityProviderNewParamsConfig] `json:"config,required"` +// This interface is a union satisfied by one of the following: +// [IdentityProviderNewParamsAccessAzureAd], +// [IdentityProviderNewParamsAccessCentrify], +// [IdentityProviderNewParamsAccessFacebook], +// [IdentityProviderNewParamsAccessGitHub], +// [IdentityProviderNewParamsAccessGoogle], +// [IdentityProviderNewParamsAccessGoogleApps], +// [IdentityProviderNewParamsAccessLinkedin], +// [IdentityProviderNewParamsAccessOidc], [IdentityProviderNewParamsAccessOkta], +// [IdentityProviderNewParamsAccessOnelogin], +// [IdentityProviderNewParamsAccessPingone], [IdentityProviderNewParamsAccessSaml], +// [IdentityProviderNewParamsAccessYandex], +// [IdentityProviderNewParamsAccessOnetimepin]. +type IdentityProviderNewParams interface { + ImplementsIdentityProviderNewParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type IdentityProviderNewParamsAccessAzureAd struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessAzureAdConfig] `json:"config,required"` // The name of the identity provider, shown to users on the login page. Name param.Field[string] `json:"name,required"` // The type of identity provider. To determine the value for a specific provider, // refer to our // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - Type param.Field[IdentityProviderNewParamsType] `json:"type,required"` + Type param.Field[IdentityProviderNewParamsAccessAzureAdType] `json:"type,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"` - ScimConfig param.Field[IdentityProviderNewParamsScimConfig] `json:"scim_config"` + ZoneID param.Field[string] `path:"zone_id"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessAzureAdScimConfig] `json:"scim_config"` } -func (r IdentityProviderNewParams) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderNewParamsAccessAzureAd) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type IdentityProviderNewParamsConfig struct { - // Your companies TLD - AppsDomain param.Field[string] `json:"apps_domain"` - // A list of SAML attribute names that will be added to your signed JWT token and - // can be used in SAML policy rules. - Attributes param.Field[[]string] `json:"attributes"` - // The authorization_endpoint URL of your IdP - AuthURL param.Field[string] `json:"auth_url"` - // Your okta authorization server id - AuthorizationServerID param.Field[string] `json:"authorization_server_id"` - // Your centrify account url - CentrifyAccount param.Field[string] `json:"centrify_account"` - // Your centrify app id - CentrifyAppID param.Field[string] `json:"centrify_app_id"` - // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens - CERTsURL param.Field[string] `json:"certs_url"` +func (r IdentityProviderNewParamsAccessAzureAd) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessAzureAd) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessAzureAd) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessAzureAdConfig struct { // Custom claims Claims param.Field[[]string] `json:"claims"` // Your OAuth Client ID @@ -4515,23 +4541,8 @@ type IdentityProviderNewParamsConfig struct { ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` // Your Azure directory uuid DirectoryID param.Field[string] `json:"directory_id"` - // The attribute name for email in the SAML response. - EmailAttributeName param.Field[string] `json:"email_attribute_name"` // The claim name for email in the id_token response. EmailClaimName param.Field[string] `json:"email_claim_name"` - // Add a list of attribute names that will be returned in the response header from - // the Access callback. - HeaderAttributes param.Field[[]IdentityProviderNewParamsConfigHeaderAttribute] `json:"header_attributes"` - // X509 certificate to verify the signature in the SAML authentication response - IDPPublicCERTs param.Field[[]string] `json:"idp_public_certs"` - // IdP Entity ID or Issuer URL - IssuerURL param.Field[string] `json:"issuer_url"` - // Your okta account url - OktaAccount param.Field[string] `json:"okta_account"` - // Your OneLogin account url - OneloginAccount param.Field[string] `json:"onelogin_account"` - // Your PingOne environment identifier - PingEnvID param.Field[string] `json:"ping_env_id"` // Indicates the type of user interaction that is required. prompt=login forces the // user to enter their credentials on that request, negating single-sign on. // prompt=none is the opposite. It ensures that the user isn't presented with any @@ -4540,32 +4551,12 @@ type IdentityProviderNewParamsConfig struct { // error. prompt=select_account interrupts single sign-on providing account // selection experience listing all the accounts either in session or any // remembered account or an option to choose to use a different account altogether. - Prompt param.Field[IdentityProviderNewParamsConfigPrompt] `json:"prompt"` - // OAuth scopes - Scopes param.Field[[]string] `json:"scopes"` - // Sign the SAML authentication request with Access credentials. To verify the - // signature, use the public key from the Access certs endpoints. - SignRequest param.Field[bool] `json:"sign_request"` - // URL to send the SAML authentication requests to - SSOTargetURL param.Field[string] `json:"sso_target_url"` + Prompt param.Field[IdentityProviderNewParamsAccessAzureAdConfigPrompt] `json:"prompt"` // Should Cloudflare try to load groups from your account SupportGroups param.Field[bool] `json:"support_groups"` - // The token_endpoint URL of your IdP - TokenURL param.Field[string] `json:"token_url"` -} - -func (r IdentityProviderNewParamsConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type IdentityProviderNewParamsConfigHeaderAttribute struct { - // attribute name from the IDP - AttributeName param.Field[string] `json:"attribute_name"` - // header that will be added on the request to the origin - HeaderName param.Field[string] `json:"header_name"` } -func (r IdentityProviderNewParamsConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderNewParamsAccessAzureAdConfig) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -4577,17 +4568,17 @@ func (r IdentityProviderNewParamsConfigHeaderAttribute) MarshalJSON() (data []by // error. prompt=select_account interrupts single sign-on providing account // selection experience listing all the accounts either in session or any // remembered account or an option to choose to use a different account altogether. -type IdentityProviderNewParamsConfigPrompt string +type IdentityProviderNewParamsAccessAzureAdConfigPrompt string const ( - IdentityProviderNewParamsConfigPromptLogin IdentityProviderNewParamsConfigPrompt = "login" - IdentityProviderNewParamsConfigPromptSelectAccount IdentityProviderNewParamsConfigPrompt = "select_account" - IdentityProviderNewParamsConfigPromptNone IdentityProviderNewParamsConfigPrompt = "none" + IdentityProviderNewParamsAccessAzureAdConfigPromptLogin IdentityProviderNewParamsAccessAzureAdConfigPrompt = "login" + IdentityProviderNewParamsAccessAzureAdConfigPromptSelectAccount IdentityProviderNewParamsAccessAzureAdConfigPrompt = "select_account" + IdentityProviderNewParamsAccessAzureAdConfigPromptNone IdentityProviderNewParamsAccessAzureAdConfigPrompt = "none" ) -func (r IdentityProviderNewParamsConfigPrompt) IsKnown() bool { +func (r IdentityProviderNewParamsAccessAzureAdConfigPrompt) IsKnown() bool { switch r { - case IdentityProviderNewParamsConfigPromptLogin, IdentityProviderNewParamsConfigPromptSelectAccount, IdentityProviderNewParamsConfigPromptNone: + case IdentityProviderNewParamsAccessAzureAdConfigPromptLogin, IdentityProviderNewParamsAccessAzureAdConfigPromptSelectAccount, IdentityProviderNewParamsAccessAzureAdConfigPromptNone: return true } return false @@ -4596,34 +4587,36 @@ func (r IdentityProviderNewParamsConfigPrompt) IsKnown() bool { // The type of identity provider. To determine the value for a specific provider, // refer to our // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). -type IdentityProviderNewParamsType string +type IdentityProviderNewParamsAccessAzureAdType string const ( - IdentityProviderNewParamsTypeOnetimepin IdentityProviderNewParamsType = "onetimepin" - IdentityProviderNewParamsTypeAzureAd IdentityProviderNewParamsType = "azureAD" - IdentityProviderNewParamsTypeSaml IdentityProviderNewParamsType = "saml" - IdentityProviderNewParamsTypeCentrify IdentityProviderNewParamsType = "centrify" - IdentityProviderNewParamsTypeFacebook IdentityProviderNewParamsType = "facebook" - IdentityProviderNewParamsTypeGitHub IdentityProviderNewParamsType = "github" - IdentityProviderNewParamsTypeGoogleApps IdentityProviderNewParamsType = "google-apps" - IdentityProviderNewParamsTypeGoogle IdentityProviderNewParamsType = "google" - IdentityProviderNewParamsTypeLinkedin IdentityProviderNewParamsType = "linkedin" - IdentityProviderNewParamsTypeOidc IdentityProviderNewParamsType = "oidc" - IdentityProviderNewParamsTypeOkta IdentityProviderNewParamsType = "okta" - IdentityProviderNewParamsTypeOnelogin IdentityProviderNewParamsType = "onelogin" - IdentityProviderNewParamsTypePingone IdentityProviderNewParamsType = "pingone" - IdentityProviderNewParamsTypeYandex IdentityProviderNewParamsType = "yandex" + IdentityProviderNewParamsAccessAzureAdTypeOnetimepin IdentityProviderNewParamsAccessAzureAdType = "onetimepin" + IdentityProviderNewParamsAccessAzureAdTypeAzureAd IdentityProviderNewParamsAccessAzureAdType = "azureAD" + IdentityProviderNewParamsAccessAzureAdTypeSaml IdentityProviderNewParamsAccessAzureAdType = "saml" + IdentityProviderNewParamsAccessAzureAdTypeCentrify IdentityProviderNewParamsAccessAzureAdType = "centrify" + IdentityProviderNewParamsAccessAzureAdTypeFacebook IdentityProviderNewParamsAccessAzureAdType = "facebook" + IdentityProviderNewParamsAccessAzureAdTypeGitHub IdentityProviderNewParamsAccessAzureAdType = "github" + IdentityProviderNewParamsAccessAzureAdTypeGoogleApps IdentityProviderNewParamsAccessAzureAdType = "google-apps" + IdentityProviderNewParamsAccessAzureAdTypeGoogle IdentityProviderNewParamsAccessAzureAdType = "google" + IdentityProviderNewParamsAccessAzureAdTypeLinkedin IdentityProviderNewParamsAccessAzureAdType = "linkedin" + IdentityProviderNewParamsAccessAzureAdTypeOidc IdentityProviderNewParamsAccessAzureAdType = "oidc" + IdentityProviderNewParamsAccessAzureAdTypeOkta IdentityProviderNewParamsAccessAzureAdType = "okta" + IdentityProviderNewParamsAccessAzureAdTypeOnelogin IdentityProviderNewParamsAccessAzureAdType = "onelogin" + IdentityProviderNewParamsAccessAzureAdTypePingone IdentityProviderNewParamsAccessAzureAdType = "pingone" + IdentityProviderNewParamsAccessAzureAdTypeYandex IdentityProviderNewParamsAccessAzureAdType = "yandex" ) -func (r IdentityProviderNewParamsType) IsKnown() bool { +func (r IdentityProviderNewParamsAccessAzureAdType) IsKnown() bool { switch r { - case IdentityProviderNewParamsTypeOnetimepin, IdentityProviderNewParamsTypeAzureAd, IdentityProviderNewParamsTypeSaml, IdentityProviderNewParamsTypeCentrify, IdentityProviderNewParamsTypeFacebook, IdentityProviderNewParamsTypeGitHub, IdentityProviderNewParamsTypeGoogleApps, IdentityProviderNewParamsTypeGoogle, IdentityProviderNewParamsTypeLinkedin, IdentityProviderNewParamsTypeOidc, IdentityProviderNewParamsTypeOkta, IdentityProviderNewParamsTypeOnelogin, IdentityProviderNewParamsTypePingone, IdentityProviderNewParamsTypeYandex: + case IdentityProviderNewParamsAccessAzureAdTypeOnetimepin, IdentityProviderNewParamsAccessAzureAdTypeAzureAd, IdentityProviderNewParamsAccessAzureAdTypeSaml, IdentityProviderNewParamsAccessAzureAdTypeCentrify, IdentityProviderNewParamsAccessAzureAdTypeFacebook, IdentityProviderNewParamsAccessAzureAdTypeGitHub, IdentityProviderNewParamsAccessAzureAdTypeGoogleApps, IdentityProviderNewParamsAccessAzureAdTypeGoogle, IdentityProviderNewParamsAccessAzureAdTypeLinkedin, IdentityProviderNewParamsAccessAzureAdTypeOidc, IdentityProviderNewParamsAccessAzureAdTypeOkta, IdentityProviderNewParamsAccessAzureAdTypeOnelogin, IdentityProviderNewParamsAccessAzureAdTypePingone, IdentityProviderNewParamsAccessAzureAdTypeYandex: return true } return false } -type IdentityProviderNewParamsScimConfig struct { +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessAzureAdScimConfig struct { // A flag to enable or disable SCIM for the identity provider. Enabled param.Field[bool] `json:"enabled"` // A flag to revoke a user's session in Access and force a reauthentication on the @@ -4643,132 +4636,2405 @@ type IdentityProviderNewParamsScimConfig struct { UserDeprovision param.Field[bool] `json:"user_deprovision"` } -func (r IdentityProviderNewParamsScimConfig) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderNewParamsAccessAzureAdScimConfig) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type IdentityProviderNewResponseEnvelope struct { - Errors []IdentityProviderNewResponseEnvelopeErrors `json:"errors,required"` - Messages []IdentityProviderNewResponseEnvelopeMessages `json:"messages,required"` - Result AccessIdentityProviders `json:"result,required"` - // Whether the API call was successful - Success IdentityProviderNewResponseEnvelopeSuccess `json:"success,required"` - JSON identityProviderNewResponseEnvelopeJSON `json:"-"` +type IdentityProviderNewParamsAccessCentrify struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessCentrifyConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessCentrifyType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessCentrifyScimConfig] `json:"scim_config"` } -// identityProviderNewResponseEnvelopeJSON contains the JSON metadata for the -// struct [IdentityProviderNewResponseEnvelope] -type identityProviderNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderNewParamsAccessCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r IdentityProviderNewParamsAccessCentrify) getAccountID() param.Field[string] { + return r.AccountID } -func (r identityProviderNewResponseEnvelopeJSON) RawJSON() string { - return r.raw +func (r IdentityProviderNewParamsAccessCentrify) getZoneID() param.Field[string] { + return r.ZoneID } -type IdentityProviderNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON identityProviderNewResponseEnvelopeErrorsJSON `json:"-"` +func (IdentityProviderNewParamsAccessCentrify) ImplementsIdentityProviderNewParams() { + } -// identityProviderNewResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [IdentityProviderNewResponseEnvelopeErrors] -type identityProviderNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` } -func (r *IdentityProviderNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r IdentityProviderNewParamsAccessCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r identityProviderNewResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessCentrifyType string + +const ( + IdentityProviderNewParamsAccessCentrifyTypeOnetimepin IdentityProviderNewParamsAccessCentrifyType = "onetimepin" + IdentityProviderNewParamsAccessCentrifyTypeAzureAd IdentityProviderNewParamsAccessCentrifyType = "azureAD" + IdentityProviderNewParamsAccessCentrifyTypeSaml IdentityProviderNewParamsAccessCentrifyType = "saml" + IdentityProviderNewParamsAccessCentrifyTypeCentrify IdentityProviderNewParamsAccessCentrifyType = "centrify" + IdentityProviderNewParamsAccessCentrifyTypeFacebook IdentityProviderNewParamsAccessCentrifyType = "facebook" + IdentityProviderNewParamsAccessCentrifyTypeGitHub IdentityProviderNewParamsAccessCentrifyType = "github" + IdentityProviderNewParamsAccessCentrifyTypeGoogleApps IdentityProviderNewParamsAccessCentrifyType = "google-apps" + IdentityProviderNewParamsAccessCentrifyTypeGoogle IdentityProviderNewParamsAccessCentrifyType = "google" + IdentityProviderNewParamsAccessCentrifyTypeLinkedin IdentityProviderNewParamsAccessCentrifyType = "linkedin" + IdentityProviderNewParamsAccessCentrifyTypeOidc IdentityProviderNewParamsAccessCentrifyType = "oidc" + IdentityProviderNewParamsAccessCentrifyTypeOkta IdentityProviderNewParamsAccessCentrifyType = "okta" + IdentityProviderNewParamsAccessCentrifyTypeOnelogin IdentityProviderNewParamsAccessCentrifyType = "onelogin" + IdentityProviderNewParamsAccessCentrifyTypePingone IdentityProviderNewParamsAccessCentrifyType = "pingone" + IdentityProviderNewParamsAccessCentrifyTypeYandex IdentityProviderNewParamsAccessCentrifyType = "yandex" +) + +func (r IdentityProviderNewParamsAccessCentrifyType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessCentrifyTypeOnetimepin, IdentityProviderNewParamsAccessCentrifyTypeAzureAd, IdentityProviderNewParamsAccessCentrifyTypeSaml, IdentityProviderNewParamsAccessCentrifyTypeCentrify, IdentityProviderNewParamsAccessCentrifyTypeFacebook, IdentityProviderNewParamsAccessCentrifyTypeGitHub, IdentityProviderNewParamsAccessCentrifyTypeGoogleApps, IdentityProviderNewParamsAccessCentrifyTypeGoogle, IdentityProviderNewParamsAccessCentrifyTypeLinkedin, IdentityProviderNewParamsAccessCentrifyTypeOidc, IdentityProviderNewParamsAccessCentrifyTypeOkta, IdentityProviderNewParamsAccessCentrifyTypeOnelogin, IdentityProviderNewParamsAccessCentrifyTypePingone, IdentityProviderNewParamsAccessCentrifyTypeYandex: + return true + } + return false } -type IdentityProviderNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON identityProviderNewResponseEnvelopeMessagesJSON `json:"-"` +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` } -// identityProviderNewResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [IdentityProviderNewResponseEnvelopeMessages] -type identityProviderNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderNewParamsAccessCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type IdentityProviderNewParamsAccessFacebook struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessFacebookConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessFacebookType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessFacebookScimConfig] `json:"scim_config"` } -func (r identityProviderNewResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw +func (r IdentityProviderNewParamsAccessFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Whether the API call was successful -type IdentityProviderNewResponseEnvelopeSuccess bool +func (r IdentityProviderNewParamsAccessFacebook) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessFacebook) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessFacebook) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderNewParamsAccessFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessFacebookType string const ( - IdentityProviderNewResponseEnvelopeSuccessTrue IdentityProviderNewResponseEnvelopeSuccess = true + IdentityProviderNewParamsAccessFacebookTypeOnetimepin IdentityProviderNewParamsAccessFacebookType = "onetimepin" + IdentityProviderNewParamsAccessFacebookTypeAzureAd IdentityProviderNewParamsAccessFacebookType = "azureAD" + IdentityProviderNewParamsAccessFacebookTypeSaml IdentityProviderNewParamsAccessFacebookType = "saml" + IdentityProviderNewParamsAccessFacebookTypeCentrify IdentityProviderNewParamsAccessFacebookType = "centrify" + IdentityProviderNewParamsAccessFacebookTypeFacebook IdentityProviderNewParamsAccessFacebookType = "facebook" + IdentityProviderNewParamsAccessFacebookTypeGitHub IdentityProviderNewParamsAccessFacebookType = "github" + IdentityProviderNewParamsAccessFacebookTypeGoogleApps IdentityProviderNewParamsAccessFacebookType = "google-apps" + IdentityProviderNewParamsAccessFacebookTypeGoogle IdentityProviderNewParamsAccessFacebookType = "google" + IdentityProviderNewParamsAccessFacebookTypeLinkedin IdentityProviderNewParamsAccessFacebookType = "linkedin" + IdentityProviderNewParamsAccessFacebookTypeOidc IdentityProviderNewParamsAccessFacebookType = "oidc" + IdentityProviderNewParamsAccessFacebookTypeOkta IdentityProviderNewParamsAccessFacebookType = "okta" + IdentityProviderNewParamsAccessFacebookTypeOnelogin IdentityProviderNewParamsAccessFacebookType = "onelogin" + IdentityProviderNewParamsAccessFacebookTypePingone IdentityProviderNewParamsAccessFacebookType = "pingone" + IdentityProviderNewParamsAccessFacebookTypeYandex IdentityProviderNewParamsAccessFacebookType = "yandex" ) -func (r IdentityProviderNewResponseEnvelopeSuccess) IsKnown() bool { +func (r IdentityProviderNewParamsAccessFacebookType) IsKnown() bool { switch r { - case IdentityProviderNewResponseEnvelopeSuccessTrue: + case IdentityProviderNewParamsAccessFacebookTypeOnetimepin, IdentityProviderNewParamsAccessFacebookTypeAzureAd, IdentityProviderNewParamsAccessFacebookTypeSaml, IdentityProviderNewParamsAccessFacebookTypeCentrify, IdentityProviderNewParamsAccessFacebookTypeFacebook, IdentityProviderNewParamsAccessFacebookTypeGitHub, IdentityProviderNewParamsAccessFacebookTypeGoogleApps, IdentityProviderNewParamsAccessFacebookTypeGoogle, IdentityProviderNewParamsAccessFacebookTypeLinkedin, IdentityProviderNewParamsAccessFacebookTypeOidc, IdentityProviderNewParamsAccessFacebookTypeOkta, IdentityProviderNewParamsAccessFacebookTypeOnelogin, IdentityProviderNewParamsAccessFacebookTypePingone, IdentityProviderNewParamsAccessFacebookTypeYandex: return true } return false } -type IdentityProviderUpdateParams struct { - Config param.Field[IdentityProviderUpdateParamsConfig] `json:"config,required"` +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessGitHub struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessGitHubConfig] `json:"config,required"` // The name of the identity provider, shown to users on the login page. Name param.Field[string] `json:"name,required"` // The type of identity provider. To determine the value for a specific provider, // refer to our // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - Type param.Field[IdentityProviderUpdateParamsType] `json:"type,required"` + Type param.Field[IdentityProviderNewParamsAccessGitHubType] `json:"type,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"` - ScimConfig param.Field[IdentityProviderUpdateParamsScimConfig] `json:"scim_config"` + ZoneID param.Field[string] `path:"zone_id"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessGitHubScimConfig] `json:"scim_config"` } -func (r IdentityProviderUpdateParams) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderNewParamsAccessGitHub) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type IdentityProviderUpdateParamsConfig struct { - // Your companies TLD - AppsDomain param.Field[string] `json:"apps_domain"` +func (r IdentityProviderNewParamsAccessGitHub) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessGitHub) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessGitHub) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderNewParamsAccessGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGitHubType string + +const ( + IdentityProviderNewParamsAccessGitHubTypeOnetimepin IdentityProviderNewParamsAccessGitHubType = "onetimepin" + IdentityProviderNewParamsAccessGitHubTypeAzureAd IdentityProviderNewParamsAccessGitHubType = "azureAD" + IdentityProviderNewParamsAccessGitHubTypeSaml IdentityProviderNewParamsAccessGitHubType = "saml" + IdentityProviderNewParamsAccessGitHubTypeCentrify IdentityProviderNewParamsAccessGitHubType = "centrify" + IdentityProviderNewParamsAccessGitHubTypeFacebook IdentityProviderNewParamsAccessGitHubType = "facebook" + IdentityProviderNewParamsAccessGitHubTypeGitHub IdentityProviderNewParamsAccessGitHubType = "github" + IdentityProviderNewParamsAccessGitHubTypeGoogleApps IdentityProviderNewParamsAccessGitHubType = "google-apps" + IdentityProviderNewParamsAccessGitHubTypeGoogle IdentityProviderNewParamsAccessGitHubType = "google" + IdentityProviderNewParamsAccessGitHubTypeLinkedin IdentityProviderNewParamsAccessGitHubType = "linkedin" + IdentityProviderNewParamsAccessGitHubTypeOidc IdentityProviderNewParamsAccessGitHubType = "oidc" + IdentityProviderNewParamsAccessGitHubTypeOkta IdentityProviderNewParamsAccessGitHubType = "okta" + IdentityProviderNewParamsAccessGitHubTypeOnelogin IdentityProviderNewParamsAccessGitHubType = "onelogin" + IdentityProviderNewParamsAccessGitHubTypePingone IdentityProviderNewParamsAccessGitHubType = "pingone" + IdentityProviderNewParamsAccessGitHubTypeYandex IdentityProviderNewParamsAccessGitHubType = "yandex" +) + +func (r IdentityProviderNewParamsAccessGitHubType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessGitHubTypeOnetimepin, IdentityProviderNewParamsAccessGitHubTypeAzureAd, IdentityProviderNewParamsAccessGitHubTypeSaml, IdentityProviderNewParamsAccessGitHubTypeCentrify, IdentityProviderNewParamsAccessGitHubTypeFacebook, IdentityProviderNewParamsAccessGitHubTypeGitHub, IdentityProviderNewParamsAccessGitHubTypeGoogleApps, IdentityProviderNewParamsAccessGitHubTypeGoogle, IdentityProviderNewParamsAccessGitHubTypeLinkedin, IdentityProviderNewParamsAccessGitHubTypeOidc, IdentityProviderNewParamsAccessGitHubTypeOkta, IdentityProviderNewParamsAccessGitHubTypeOnelogin, IdentityProviderNewParamsAccessGitHubTypePingone, IdentityProviderNewParamsAccessGitHubTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessGoogle struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessGoogleConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessGoogleType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessGoogleScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessGoogle) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessGoogle) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessGoogle) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGoogleConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r IdentityProviderNewParamsAccessGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGoogleType string + +const ( + IdentityProviderNewParamsAccessGoogleTypeOnetimepin IdentityProviderNewParamsAccessGoogleType = "onetimepin" + IdentityProviderNewParamsAccessGoogleTypeAzureAd IdentityProviderNewParamsAccessGoogleType = "azureAD" + IdentityProviderNewParamsAccessGoogleTypeSaml IdentityProviderNewParamsAccessGoogleType = "saml" + IdentityProviderNewParamsAccessGoogleTypeCentrify IdentityProviderNewParamsAccessGoogleType = "centrify" + IdentityProviderNewParamsAccessGoogleTypeFacebook IdentityProviderNewParamsAccessGoogleType = "facebook" + IdentityProviderNewParamsAccessGoogleTypeGitHub IdentityProviderNewParamsAccessGoogleType = "github" + IdentityProviderNewParamsAccessGoogleTypeGoogleApps IdentityProviderNewParamsAccessGoogleType = "google-apps" + IdentityProviderNewParamsAccessGoogleTypeGoogle IdentityProviderNewParamsAccessGoogleType = "google" + IdentityProviderNewParamsAccessGoogleTypeLinkedin IdentityProviderNewParamsAccessGoogleType = "linkedin" + IdentityProviderNewParamsAccessGoogleTypeOidc IdentityProviderNewParamsAccessGoogleType = "oidc" + IdentityProviderNewParamsAccessGoogleTypeOkta IdentityProviderNewParamsAccessGoogleType = "okta" + IdentityProviderNewParamsAccessGoogleTypeOnelogin IdentityProviderNewParamsAccessGoogleType = "onelogin" + IdentityProviderNewParamsAccessGoogleTypePingone IdentityProviderNewParamsAccessGoogleType = "pingone" + IdentityProviderNewParamsAccessGoogleTypeYandex IdentityProviderNewParamsAccessGoogleType = "yandex" +) + +func (r IdentityProviderNewParamsAccessGoogleType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessGoogleTypeOnetimepin, IdentityProviderNewParamsAccessGoogleTypeAzureAd, IdentityProviderNewParamsAccessGoogleTypeSaml, IdentityProviderNewParamsAccessGoogleTypeCentrify, IdentityProviderNewParamsAccessGoogleTypeFacebook, IdentityProviderNewParamsAccessGoogleTypeGitHub, IdentityProviderNewParamsAccessGoogleTypeGoogleApps, IdentityProviderNewParamsAccessGoogleTypeGoogle, IdentityProviderNewParamsAccessGoogleTypeLinkedin, IdentityProviderNewParamsAccessGoogleTypeOidc, IdentityProviderNewParamsAccessGoogleTypeOkta, IdentityProviderNewParamsAccessGoogleTypeOnelogin, IdentityProviderNewParamsAccessGoogleTypePingone, IdentityProviderNewParamsAccessGoogleTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessGoogleApps struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessGoogleAppsConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessGoogleAppsType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessGoogleAppsScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessGoogleApps) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessGoogleApps) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessGoogleApps) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r IdentityProviderNewParamsAccessGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessGoogleAppsType string + +const ( + IdentityProviderNewParamsAccessGoogleAppsTypeOnetimepin IdentityProviderNewParamsAccessGoogleAppsType = "onetimepin" + IdentityProviderNewParamsAccessGoogleAppsTypeAzureAd IdentityProviderNewParamsAccessGoogleAppsType = "azureAD" + IdentityProviderNewParamsAccessGoogleAppsTypeSaml IdentityProviderNewParamsAccessGoogleAppsType = "saml" + IdentityProviderNewParamsAccessGoogleAppsTypeCentrify IdentityProviderNewParamsAccessGoogleAppsType = "centrify" + IdentityProviderNewParamsAccessGoogleAppsTypeFacebook IdentityProviderNewParamsAccessGoogleAppsType = "facebook" + IdentityProviderNewParamsAccessGoogleAppsTypeGitHub IdentityProviderNewParamsAccessGoogleAppsType = "github" + IdentityProviderNewParamsAccessGoogleAppsTypeGoogleApps IdentityProviderNewParamsAccessGoogleAppsType = "google-apps" + IdentityProviderNewParamsAccessGoogleAppsTypeGoogle IdentityProviderNewParamsAccessGoogleAppsType = "google" + IdentityProviderNewParamsAccessGoogleAppsTypeLinkedin IdentityProviderNewParamsAccessGoogleAppsType = "linkedin" + IdentityProviderNewParamsAccessGoogleAppsTypeOidc IdentityProviderNewParamsAccessGoogleAppsType = "oidc" + IdentityProviderNewParamsAccessGoogleAppsTypeOkta IdentityProviderNewParamsAccessGoogleAppsType = "okta" + IdentityProviderNewParamsAccessGoogleAppsTypeOnelogin IdentityProviderNewParamsAccessGoogleAppsType = "onelogin" + IdentityProviderNewParamsAccessGoogleAppsTypePingone IdentityProviderNewParamsAccessGoogleAppsType = "pingone" + IdentityProviderNewParamsAccessGoogleAppsTypeYandex IdentityProviderNewParamsAccessGoogleAppsType = "yandex" +) + +func (r IdentityProviderNewParamsAccessGoogleAppsType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessGoogleAppsTypeOnetimepin, IdentityProviderNewParamsAccessGoogleAppsTypeAzureAd, IdentityProviderNewParamsAccessGoogleAppsTypeSaml, IdentityProviderNewParamsAccessGoogleAppsTypeCentrify, IdentityProviderNewParamsAccessGoogleAppsTypeFacebook, IdentityProviderNewParamsAccessGoogleAppsTypeGitHub, IdentityProviderNewParamsAccessGoogleAppsTypeGoogleApps, IdentityProviderNewParamsAccessGoogleAppsTypeGoogle, IdentityProviderNewParamsAccessGoogleAppsTypeLinkedin, IdentityProviderNewParamsAccessGoogleAppsTypeOidc, IdentityProviderNewParamsAccessGoogleAppsTypeOkta, IdentityProviderNewParamsAccessGoogleAppsTypeOnelogin, IdentityProviderNewParamsAccessGoogleAppsTypePingone, IdentityProviderNewParamsAccessGoogleAppsTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessLinkedin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessLinkedinConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessLinkedinType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessLinkedinScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessLinkedin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessLinkedin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessLinkedin) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderNewParamsAccessLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessLinkedinType string + +const ( + IdentityProviderNewParamsAccessLinkedinTypeOnetimepin IdentityProviderNewParamsAccessLinkedinType = "onetimepin" + IdentityProviderNewParamsAccessLinkedinTypeAzureAd IdentityProviderNewParamsAccessLinkedinType = "azureAD" + IdentityProviderNewParamsAccessLinkedinTypeSaml IdentityProviderNewParamsAccessLinkedinType = "saml" + IdentityProviderNewParamsAccessLinkedinTypeCentrify IdentityProviderNewParamsAccessLinkedinType = "centrify" + IdentityProviderNewParamsAccessLinkedinTypeFacebook IdentityProviderNewParamsAccessLinkedinType = "facebook" + IdentityProviderNewParamsAccessLinkedinTypeGitHub IdentityProviderNewParamsAccessLinkedinType = "github" + IdentityProviderNewParamsAccessLinkedinTypeGoogleApps IdentityProviderNewParamsAccessLinkedinType = "google-apps" + IdentityProviderNewParamsAccessLinkedinTypeGoogle IdentityProviderNewParamsAccessLinkedinType = "google" + IdentityProviderNewParamsAccessLinkedinTypeLinkedin IdentityProviderNewParamsAccessLinkedinType = "linkedin" + IdentityProviderNewParamsAccessLinkedinTypeOidc IdentityProviderNewParamsAccessLinkedinType = "oidc" + IdentityProviderNewParamsAccessLinkedinTypeOkta IdentityProviderNewParamsAccessLinkedinType = "okta" + IdentityProviderNewParamsAccessLinkedinTypeOnelogin IdentityProviderNewParamsAccessLinkedinType = "onelogin" + IdentityProviderNewParamsAccessLinkedinTypePingone IdentityProviderNewParamsAccessLinkedinType = "pingone" + IdentityProviderNewParamsAccessLinkedinTypeYandex IdentityProviderNewParamsAccessLinkedinType = "yandex" +) + +func (r IdentityProviderNewParamsAccessLinkedinType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessLinkedinTypeOnetimepin, IdentityProviderNewParamsAccessLinkedinTypeAzureAd, IdentityProviderNewParamsAccessLinkedinTypeSaml, IdentityProviderNewParamsAccessLinkedinTypeCentrify, IdentityProviderNewParamsAccessLinkedinTypeFacebook, IdentityProviderNewParamsAccessLinkedinTypeGitHub, IdentityProviderNewParamsAccessLinkedinTypeGoogleApps, IdentityProviderNewParamsAccessLinkedinTypeGoogle, IdentityProviderNewParamsAccessLinkedinTypeLinkedin, IdentityProviderNewParamsAccessLinkedinTypeOidc, IdentityProviderNewParamsAccessLinkedinTypeOkta, IdentityProviderNewParamsAccessLinkedinTypeOnelogin, IdentityProviderNewParamsAccessLinkedinTypePingone, IdentityProviderNewParamsAccessLinkedinTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessOidc struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessOidcConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessOidcType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessOidcScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessOidc) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessOidc) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessOidc) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOidcConfig struct { + // The authorization_endpoint URL of your IdP + AuthURL param.Field[string] `json:"auth_url"` + // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens + CERTsURL param.Field[string] `json:"certs_url"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r IdentityProviderNewParamsAccessOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOidcType string + +const ( + IdentityProviderNewParamsAccessOidcTypeOnetimepin IdentityProviderNewParamsAccessOidcType = "onetimepin" + IdentityProviderNewParamsAccessOidcTypeAzureAd IdentityProviderNewParamsAccessOidcType = "azureAD" + IdentityProviderNewParamsAccessOidcTypeSaml IdentityProviderNewParamsAccessOidcType = "saml" + IdentityProviderNewParamsAccessOidcTypeCentrify IdentityProviderNewParamsAccessOidcType = "centrify" + IdentityProviderNewParamsAccessOidcTypeFacebook IdentityProviderNewParamsAccessOidcType = "facebook" + IdentityProviderNewParamsAccessOidcTypeGitHub IdentityProviderNewParamsAccessOidcType = "github" + IdentityProviderNewParamsAccessOidcTypeGoogleApps IdentityProviderNewParamsAccessOidcType = "google-apps" + IdentityProviderNewParamsAccessOidcTypeGoogle IdentityProviderNewParamsAccessOidcType = "google" + IdentityProviderNewParamsAccessOidcTypeLinkedin IdentityProviderNewParamsAccessOidcType = "linkedin" + IdentityProviderNewParamsAccessOidcTypeOidc IdentityProviderNewParamsAccessOidcType = "oidc" + IdentityProviderNewParamsAccessOidcTypeOkta IdentityProviderNewParamsAccessOidcType = "okta" + IdentityProviderNewParamsAccessOidcTypeOnelogin IdentityProviderNewParamsAccessOidcType = "onelogin" + IdentityProviderNewParamsAccessOidcTypePingone IdentityProviderNewParamsAccessOidcType = "pingone" + IdentityProviderNewParamsAccessOidcTypeYandex IdentityProviderNewParamsAccessOidcType = "yandex" +) + +func (r IdentityProviderNewParamsAccessOidcType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessOidcTypeOnetimepin, IdentityProviderNewParamsAccessOidcTypeAzureAd, IdentityProviderNewParamsAccessOidcTypeSaml, IdentityProviderNewParamsAccessOidcTypeCentrify, IdentityProviderNewParamsAccessOidcTypeFacebook, IdentityProviderNewParamsAccessOidcTypeGitHub, IdentityProviderNewParamsAccessOidcTypeGoogleApps, IdentityProviderNewParamsAccessOidcTypeGoogle, IdentityProviderNewParamsAccessOidcTypeLinkedin, IdentityProviderNewParamsAccessOidcTypeOidc, IdentityProviderNewParamsAccessOidcTypeOkta, IdentityProviderNewParamsAccessOidcTypeOnelogin, IdentityProviderNewParamsAccessOidcTypePingone, IdentityProviderNewParamsAccessOidcTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessOkta struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessOktaConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessOktaType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessOktaScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessOkta) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessOkta) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessOkta) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID param.Field[string] `json:"authorization_server_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r IdentityProviderNewParamsAccessOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOktaType string + +const ( + IdentityProviderNewParamsAccessOktaTypeOnetimepin IdentityProviderNewParamsAccessOktaType = "onetimepin" + IdentityProviderNewParamsAccessOktaTypeAzureAd IdentityProviderNewParamsAccessOktaType = "azureAD" + IdentityProviderNewParamsAccessOktaTypeSaml IdentityProviderNewParamsAccessOktaType = "saml" + IdentityProviderNewParamsAccessOktaTypeCentrify IdentityProviderNewParamsAccessOktaType = "centrify" + IdentityProviderNewParamsAccessOktaTypeFacebook IdentityProviderNewParamsAccessOktaType = "facebook" + IdentityProviderNewParamsAccessOktaTypeGitHub IdentityProviderNewParamsAccessOktaType = "github" + IdentityProviderNewParamsAccessOktaTypeGoogleApps IdentityProviderNewParamsAccessOktaType = "google-apps" + IdentityProviderNewParamsAccessOktaTypeGoogle IdentityProviderNewParamsAccessOktaType = "google" + IdentityProviderNewParamsAccessOktaTypeLinkedin IdentityProviderNewParamsAccessOktaType = "linkedin" + IdentityProviderNewParamsAccessOktaTypeOidc IdentityProviderNewParamsAccessOktaType = "oidc" + IdentityProviderNewParamsAccessOktaTypeOkta IdentityProviderNewParamsAccessOktaType = "okta" + IdentityProviderNewParamsAccessOktaTypeOnelogin IdentityProviderNewParamsAccessOktaType = "onelogin" + IdentityProviderNewParamsAccessOktaTypePingone IdentityProviderNewParamsAccessOktaType = "pingone" + IdentityProviderNewParamsAccessOktaTypeYandex IdentityProviderNewParamsAccessOktaType = "yandex" +) + +func (r IdentityProviderNewParamsAccessOktaType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessOktaTypeOnetimepin, IdentityProviderNewParamsAccessOktaTypeAzureAd, IdentityProviderNewParamsAccessOktaTypeSaml, IdentityProviderNewParamsAccessOktaTypeCentrify, IdentityProviderNewParamsAccessOktaTypeFacebook, IdentityProviderNewParamsAccessOktaTypeGitHub, IdentityProviderNewParamsAccessOktaTypeGoogleApps, IdentityProviderNewParamsAccessOktaTypeGoogle, IdentityProviderNewParamsAccessOktaTypeLinkedin, IdentityProviderNewParamsAccessOktaTypeOidc, IdentityProviderNewParamsAccessOktaTypeOkta, IdentityProviderNewParamsAccessOktaTypeOnelogin, IdentityProviderNewParamsAccessOktaTypePingone, IdentityProviderNewParamsAccessOktaTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessOnelogin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessOneloginConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessOneloginType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessOneloginScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessOnelogin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessOnelogin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessOnelogin) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOneloginConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r IdentityProviderNewParamsAccessOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOneloginType string + +const ( + IdentityProviderNewParamsAccessOneloginTypeOnetimepin IdentityProviderNewParamsAccessOneloginType = "onetimepin" + IdentityProviderNewParamsAccessOneloginTypeAzureAd IdentityProviderNewParamsAccessOneloginType = "azureAD" + IdentityProviderNewParamsAccessOneloginTypeSaml IdentityProviderNewParamsAccessOneloginType = "saml" + IdentityProviderNewParamsAccessOneloginTypeCentrify IdentityProviderNewParamsAccessOneloginType = "centrify" + IdentityProviderNewParamsAccessOneloginTypeFacebook IdentityProviderNewParamsAccessOneloginType = "facebook" + IdentityProviderNewParamsAccessOneloginTypeGitHub IdentityProviderNewParamsAccessOneloginType = "github" + IdentityProviderNewParamsAccessOneloginTypeGoogleApps IdentityProviderNewParamsAccessOneloginType = "google-apps" + IdentityProviderNewParamsAccessOneloginTypeGoogle IdentityProviderNewParamsAccessOneloginType = "google" + IdentityProviderNewParamsAccessOneloginTypeLinkedin IdentityProviderNewParamsAccessOneloginType = "linkedin" + IdentityProviderNewParamsAccessOneloginTypeOidc IdentityProviderNewParamsAccessOneloginType = "oidc" + IdentityProviderNewParamsAccessOneloginTypeOkta IdentityProviderNewParamsAccessOneloginType = "okta" + IdentityProviderNewParamsAccessOneloginTypeOnelogin IdentityProviderNewParamsAccessOneloginType = "onelogin" + IdentityProviderNewParamsAccessOneloginTypePingone IdentityProviderNewParamsAccessOneloginType = "pingone" + IdentityProviderNewParamsAccessOneloginTypeYandex IdentityProviderNewParamsAccessOneloginType = "yandex" +) + +func (r IdentityProviderNewParamsAccessOneloginType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessOneloginTypeOnetimepin, IdentityProviderNewParamsAccessOneloginTypeAzureAd, IdentityProviderNewParamsAccessOneloginTypeSaml, IdentityProviderNewParamsAccessOneloginTypeCentrify, IdentityProviderNewParamsAccessOneloginTypeFacebook, IdentityProviderNewParamsAccessOneloginTypeGitHub, IdentityProviderNewParamsAccessOneloginTypeGoogleApps, IdentityProviderNewParamsAccessOneloginTypeGoogle, IdentityProviderNewParamsAccessOneloginTypeLinkedin, IdentityProviderNewParamsAccessOneloginTypeOidc, IdentityProviderNewParamsAccessOneloginTypeOkta, IdentityProviderNewParamsAccessOneloginTypeOnelogin, IdentityProviderNewParamsAccessOneloginTypePingone, IdentityProviderNewParamsAccessOneloginTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessPingone struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessPingoneConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessPingoneType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessPingoneScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessPingone) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessPingone) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessPingone) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessPingoneConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r IdentityProviderNewParamsAccessPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessPingoneType string + +const ( + IdentityProviderNewParamsAccessPingoneTypeOnetimepin IdentityProviderNewParamsAccessPingoneType = "onetimepin" + IdentityProviderNewParamsAccessPingoneTypeAzureAd IdentityProviderNewParamsAccessPingoneType = "azureAD" + IdentityProviderNewParamsAccessPingoneTypeSaml IdentityProviderNewParamsAccessPingoneType = "saml" + IdentityProviderNewParamsAccessPingoneTypeCentrify IdentityProviderNewParamsAccessPingoneType = "centrify" + IdentityProviderNewParamsAccessPingoneTypeFacebook IdentityProviderNewParamsAccessPingoneType = "facebook" + IdentityProviderNewParamsAccessPingoneTypeGitHub IdentityProviderNewParamsAccessPingoneType = "github" + IdentityProviderNewParamsAccessPingoneTypeGoogleApps IdentityProviderNewParamsAccessPingoneType = "google-apps" + IdentityProviderNewParamsAccessPingoneTypeGoogle IdentityProviderNewParamsAccessPingoneType = "google" + IdentityProviderNewParamsAccessPingoneTypeLinkedin IdentityProviderNewParamsAccessPingoneType = "linkedin" + IdentityProviderNewParamsAccessPingoneTypeOidc IdentityProviderNewParamsAccessPingoneType = "oidc" + IdentityProviderNewParamsAccessPingoneTypeOkta IdentityProviderNewParamsAccessPingoneType = "okta" + IdentityProviderNewParamsAccessPingoneTypeOnelogin IdentityProviderNewParamsAccessPingoneType = "onelogin" + IdentityProviderNewParamsAccessPingoneTypePingone IdentityProviderNewParamsAccessPingoneType = "pingone" + IdentityProviderNewParamsAccessPingoneTypeYandex IdentityProviderNewParamsAccessPingoneType = "yandex" +) + +func (r IdentityProviderNewParamsAccessPingoneType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessPingoneTypeOnetimepin, IdentityProviderNewParamsAccessPingoneTypeAzureAd, IdentityProviderNewParamsAccessPingoneTypeSaml, IdentityProviderNewParamsAccessPingoneTypeCentrify, IdentityProviderNewParamsAccessPingoneTypeFacebook, IdentityProviderNewParamsAccessPingoneTypeGitHub, IdentityProviderNewParamsAccessPingoneTypeGoogleApps, IdentityProviderNewParamsAccessPingoneTypeGoogle, IdentityProviderNewParamsAccessPingoneTypeLinkedin, IdentityProviderNewParamsAccessPingoneTypeOidc, IdentityProviderNewParamsAccessPingoneTypeOkta, IdentityProviderNewParamsAccessPingoneTypeOnelogin, IdentityProviderNewParamsAccessPingoneTypePingone, IdentityProviderNewParamsAccessPingoneTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessSaml struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessSamlConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessSamlType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessSamlScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessSaml) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessSaml) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessSaml) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessSamlConfig struct { // A list of SAML attribute names that will be added to your signed JWT token and // can be used in SAML policy rules. Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` + // Add a list of attribute names that will be returned in the response header from + // the Access callback. + HeaderAttributes param.Field[[]IdentityProviderNewParamsAccessSamlConfigHeaderAttribute] `json:"header_attributes"` + // X509 certificate to verify the signature in the SAML authentication response + IDPPublicCERTs param.Field[[]string] `json:"idp_public_certs"` + // IdP Entity ID or Issuer URL + IssuerURL param.Field[string] `json:"issuer_url"` + // Sign the SAML authentication request with Access credentials. To verify the + // signature, use the public key from the Access certs endpoints. + SignRequest param.Field[bool] `json:"sign_request"` + // URL to send the SAML authentication requests to + SSOTargetURL param.Field[string] `json:"sso_target_url"` +} + +func (r IdentityProviderNewParamsAccessSamlConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessSamlConfigHeaderAttribute struct { + // attribute name from the IDP + AttributeName param.Field[string] `json:"attribute_name"` + // header that will be added on the request to the origin + HeaderName param.Field[string] `json:"header_name"` +} + +func (r IdentityProviderNewParamsAccessSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessSamlType string + +const ( + IdentityProviderNewParamsAccessSamlTypeOnetimepin IdentityProviderNewParamsAccessSamlType = "onetimepin" + IdentityProviderNewParamsAccessSamlTypeAzureAd IdentityProviderNewParamsAccessSamlType = "azureAD" + IdentityProviderNewParamsAccessSamlTypeSaml IdentityProviderNewParamsAccessSamlType = "saml" + IdentityProviderNewParamsAccessSamlTypeCentrify IdentityProviderNewParamsAccessSamlType = "centrify" + IdentityProviderNewParamsAccessSamlTypeFacebook IdentityProviderNewParamsAccessSamlType = "facebook" + IdentityProviderNewParamsAccessSamlTypeGitHub IdentityProviderNewParamsAccessSamlType = "github" + IdentityProviderNewParamsAccessSamlTypeGoogleApps IdentityProviderNewParamsAccessSamlType = "google-apps" + IdentityProviderNewParamsAccessSamlTypeGoogle IdentityProviderNewParamsAccessSamlType = "google" + IdentityProviderNewParamsAccessSamlTypeLinkedin IdentityProviderNewParamsAccessSamlType = "linkedin" + IdentityProviderNewParamsAccessSamlTypeOidc IdentityProviderNewParamsAccessSamlType = "oidc" + IdentityProviderNewParamsAccessSamlTypeOkta IdentityProviderNewParamsAccessSamlType = "okta" + IdentityProviderNewParamsAccessSamlTypeOnelogin IdentityProviderNewParamsAccessSamlType = "onelogin" + IdentityProviderNewParamsAccessSamlTypePingone IdentityProviderNewParamsAccessSamlType = "pingone" + IdentityProviderNewParamsAccessSamlTypeYandex IdentityProviderNewParamsAccessSamlType = "yandex" +) + +func (r IdentityProviderNewParamsAccessSamlType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessSamlTypeOnetimepin, IdentityProviderNewParamsAccessSamlTypeAzureAd, IdentityProviderNewParamsAccessSamlTypeSaml, IdentityProviderNewParamsAccessSamlTypeCentrify, IdentityProviderNewParamsAccessSamlTypeFacebook, IdentityProviderNewParamsAccessSamlTypeGitHub, IdentityProviderNewParamsAccessSamlTypeGoogleApps, IdentityProviderNewParamsAccessSamlTypeGoogle, IdentityProviderNewParamsAccessSamlTypeLinkedin, IdentityProviderNewParamsAccessSamlTypeOidc, IdentityProviderNewParamsAccessSamlTypeOkta, IdentityProviderNewParamsAccessSamlTypeOnelogin, IdentityProviderNewParamsAccessSamlTypePingone, IdentityProviderNewParamsAccessSamlTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessYandex struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderNewParamsAccessYandexConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessYandexType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessYandexScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessYandex) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessYandex) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessYandex) ImplementsIdentityProviderNewParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderNewParamsAccessYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessYandexType string + +const ( + IdentityProviderNewParamsAccessYandexTypeOnetimepin IdentityProviderNewParamsAccessYandexType = "onetimepin" + IdentityProviderNewParamsAccessYandexTypeAzureAd IdentityProviderNewParamsAccessYandexType = "azureAD" + IdentityProviderNewParamsAccessYandexTypeSaml IdentityProviderNewParamsAccessYandexType = "saml" + IdentityProviderNewParamsAccessYandexTypeCentrify IdentityProviderNewParamsAccessYandexType = "centrify" + IdentityProviderNewParamsAccessYandexTypeFacebook IdentityProviderNewParamsAccessYandexType = "facebook" + IdentityProviderNewParamsAccessYandexTypeGitHub IdentityProviderNewParamsAccessYandexType = "github" + IdentityProviderNewParamsAccessYandexTypeGoogleApps IdentityProviderNewParamsAccessYandexType = "google-apps" + IdentityProviderNewParamsAccessYandexTypeGoogle IdentityProviderNewParamsAccessYandexType = "google" + IdentityProviderNewParamsAccessYandexTypeLinkedin IdentityProviderNewParamsAccessYandexType = "linkedin" + IdentityProviderNewParamsAccessYandexTypeOidc IdentityProviderNewParamsAccessYandexType = "oidc" + IdentityProviderNewParamsAccessYandexTypeOkta IdentityProviderNewParamsAccessYandexType = "okta" + IdentityProviderNewParamsAccessYandexTypeOnelogin IdentityProviderNewParamsAccessYandexType = "onelogin" + IdentityProviderNewParamsAccessYandexTypePingone IdentityProviderNewParamsAccessYandexType = "pingone" + IdentityProviderNewParamsAccessYandexTypeYandex IdentityProviderNewParamsAccessYandexType = "yandex" +) + +func (r IdentityProviderNewParamsAccessYandexType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessYandexTypeOnetimepin, IdentityProviderNewParamsAccessYandexTypeAzureAd, IdentityProviderNewParamsAccessYandexTypeSaml, IdentityProviderNewParamsAccessYandexTypeCentrify, IdentityProviderNewParamsAccessYandexTypeFacebook, IdentityProviderNewParamsAccessYandexTypeGitHub, IdentityProviderNewParamsAccessYandexTypeGoogleApps, IdentityProviderNewParamsAccessYandexTypeGoogle, IdentityProviderNewParamsAccessYandexTypeLinkedin, IdentityProviderNewParamsAccessYandexTypeOidc, IdentityProviderNewParamsAccessYandexTypeOkta, IdentityProviderNewParamsAccessYandexTypeOnelogin, IdentityProviderNewParamsAccessYandexTypePingone, IdentityProviderNewParamsAccessYandexTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewParamsAccessOnetimepin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[interface{}] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderNewParamsAccessOnetimepinType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderNewParamsAccessOnetimepinScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderNewParamsAccessOnetimepin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderNewParamsAccessOnetimepin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderNewParamsAccessOnetimepin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderNewParamsAccessOnetimepin) ImplementsIdentityProviderNewParams() { + +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderNewParamsAccessOnetimepinType string + +const ( + IdentityProviderNewParamsAccessOnetimepinTypeOnetimepin IdentityProviderNewParamsAccessOnetimepinType = "onetimepin" + IdentityProviderNewParamsAccessOnetimepinTypeAzureAd IdentityProviderNewParamsAccessOnetimepinType = "azureAD" + IdentityProviderNewParamsAccessOnetimepinTypeSaml IdentityProviderNewParamsAccessOnetimepinType = "saml" + IdentityProviderNewParamsAccessOnetimepinTypeCentrify IdentityProviderNewParamsAccessOnetimepinType = "centrify" + IdentityProviderNewParamsAccessOnetimepinTypeFacebook IdentityProviderNewParamsAccessOnetimepinType = "facebook" + IdentityProviderNewParamsAccessOnetimepinTypeGitHub IdentityProviderNewParamsAccessOnetimepinType = "github" + IdentityProviderNewParamsAccessOnetimepinTypeGoogleApps IdentityProviderNewParamsAccessOnetimepinType = "google-apps" + IdentityProviderNewParamsAccessOnetimepinTypeGoogle IdentityProviderNewParamsAccessOnetimepinType = "google" + IdentityProviderNewParamsAccessOnetimepinTypeLinkedin IdentityProviderNewParamsAccessOnetimepinType = "linkedin" + IdentityProviderNewParamsAccessOnetimepinTypeOidc IdentityProviderNewParamsAccessOnetimepinType = "oidc" + IdentityProviderNewParamsAccessOnetimepinTypeOkta IdentityProviderNewParamsAccessOnetimepinType = "okta" + IdentityProviderNewParamsAccessOnetimepinTypeOnelogin IdentityProviderNewParamsAccessOnetimepinType = "onelogin" + IdentityProviderNewParamsAccessOnetimepinTypePingone IdentityProviderNewParamsAccessOnetimepinType = "pingone" + IdentityProviderNewParamsAccessOnetimepinTypeYandex IdentityProviderNewParamsAccessOnetimepinType = "yandex" +) + +func (r IdentityProviderNewParamsAccessOnetimepinType) IsKnown() bool { + switch r { + case IdentityProviderNewParamsAccessOnetimepinTypeOnetimepin, IdentityProviderNewParamsAccessOnetimepinTypeAzureAd, IdentityProviderNewParamsAccessOnetimepinTypeSaml, IdentityProviderNewParamsAccessOnetimepinTypeCentrify, IdentityProviderNewParamsAccessOnetimepinTypeFacebook, IdentityProviderNewParamsAccessOnetimepinTypeGitHub, IdentityProviderNewParamsAccessOnetimepinTypeGoogleApps, IdentityProviderNewParamsAccessOnetimepinTypeGoogle, IdentityProviderNewParamsAccessOnetimepinTypeLinkedin, IdentityProviderNewParamsAccessOnetimepinTypeOidc, IdentityProviderNewParamsAccessOnetimepinTypeOkta, IdentityProviderNewParamsAccessOnetimepinTypeOnelogin, IdentityProviderNewParamsAccessOnetimepinTypePingone, IdentityProviderNewParamsAccessOnetimepinTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderNewParamsAccessOnetimepinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderNewParamsAccessOnetimepinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderNewResponseEnvelope struct { + Errors []IdentityProviderNewResponseEnvelopeErrors `json:"errors,required"` + Messages []IdentityProviderNewResponseEnvelopeMessages `json:"messages,required"` + Result AccessIdentityProviders `json:"result,required"` + // Whether the API call was successful + Success IdentityProviderNewResponseEnvelopeSuccess `json:"success,required"` + JSON identityProviderNewResponseEnvelopeJSON `json:"-"` +} + +// identityProviderNewResponseEnvelopeJSON contains the JSON metadata for the +// struct [IdentityProviderNewResponseEnvelope] +type identityProviderNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON identityProviderNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// identityProviderNewResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [IdentityProviderNewResponseEnvelopeErrors] +type identityProviderNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderNewResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON identityProviderNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// identityProviderNewResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [IdentityProviderNewResponseEnvelopeMessages] +type identityProviderNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderNewResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type IdentityProviderNewResponseEnvelopeSuccess bool + +const ( + IdentityProviderNewResponseEnvelopeSuccessTrue IdentityProviderNewResponseEnvelopeSuccess = true +) + +func (r IdentityProviderNewResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case IdentityProviderNewResponseEnvelopeSuccessTrue: + return true + } + return false +} + +// This interface is a union satisfied by one of the following: +// [IdentityProviderUpdateParamsAccessAzureAd], +// [IdentityProviderUpdateParamsAccessCentrify], +// [IdentityProviderUpdateParamsAccessFacebook], +// [IdentityProviderUpdateParamsAccessGitHub], +// [IdentityProviderUpdateParamsAccessGoogle], +// [IdentityProviderUpdateParamsAccessGoogleApps], +// [IdentityProviderUpdateParamsAccessLinkedin], +// [IdentityProviderUpdateParamsAccessOidc], +// [IdentityProviderUpdateParamsAccessOkta], +// [IdentityProviderUpdateParamsAccessOnelogin], +// [IdentityProviderUpdateParamsAccessPingone], +// [IdentityProviderUpdateParamsAccessSaml], +// [IdentityProviderUpdateParamsAccessYandex], +// [IdentityProviderUpdateParamsAccessOnetimepin]. +type IdentityProviderUpdateParams interface { + ImplementsIdentityProviderUpdateParams() + + getAccountID() param.Field[string] + + getZoneID() param.Field[string] +} + +type IdentityProviderUpdateParamsAccessAzureAd struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessAzureAdConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessAzureAdType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessAzureAdScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessAzureAd) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessAzureAd) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessAzureAd) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessAzureAd) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessAzureAdConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // Should Cloudflare try to load authentication contexts from your account + ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` + // Your Azure directory uuid + DirectoryID param.Field[string] `json:"directory_id"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Indicates the type of user interaction that is required. prompt=login forces the + // user to enter their credentials on that request, negating single-sign on. + // prompt=none is the opposite. It ensures that the user isn't presented with any + // interactive prompt. If the request can't be completed silently by using + // single-sign on, the Microsoft identity platform returns an interaction_required + // error. prompt=select_account interrupts single sign-on providing account + // selection experience listing all the accounts either in session or any + // remembered account or an option to choose to use a different account altogether. + Prompt param.Field[IdentityProviderUpdateParamsAccessAzureAdConfigPrompt] `json:"prompt"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r IdentityProviderUpdateParamsAccessAzureAdConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Indicates the type of user interaction that is required. prompt=login forces the +// user to enter their credentials on that request, negating single-sign on. +// prompt=none is the opposite. It ensures that the user isn't presented with any +// interactive prompt. If the request can't be completed silently by using +// single-sign on, the Microsoft identity platform returns an interaction_required +// error. prompt=select_account interrupts single sign-on providing account +// selection experience listing all the accounts either in session or any +// remembered account or an option to choose to use a different account altogether. +type IdentityProviderUpdateParamsAccessAzureAdConfigPrompt string + +const ( + IdentityProviderUpdateParamsAccessAzureAdConfigPromptLogin IdentityProviderUpdateParamsAccessAzureAdConfigPrompt = "login" + IdentityProviderUpdateParamsAccessAzureAdConfigPromptSelectAccount IdentityProviderUpdateParamsAccessAzureAdConfigPrompt = "select_account" + IdentityProviderUpdateParamsAccessAzureAdConfigPromptNone IdentityProviderUpdateParamsAccessAzureAdConfigPrompt = "none" +) + +func (r IdentityProviderUpdateParamsAccessAzureAdConfigPrompt) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessAzureAdConfigPromptLogin, IdentityProviderUpdateParamsAccessAzureAdConfigPromptSelectAccount, IdentityProviderUpdateParamsAccessAzureAdConfigPromptNone: + return true + } + return false +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessAzureAdType string + +const ( + IdentityProviderUpdateParamsAccessAzureAdTypeOnetimepin IdentityProviderUpdateParamsAccessAzureAdType = "onetimepin" + IdentityProviderUpdateParamsAccessAzureAdTypeAzureAd IdentityProviderUpdateParamsAccessAzureAdType = "azureAD" + IdentityProviderUpdateParamsAccessAzureAdTypeSaml IdentityProviderUpdateParamsAccessAzureAdType = "saml" + IdentityProviderUpdateParamsAccessAzureAdTypeCentrify IdentityProviderUpdateParamsAccessAzureAdType = "centrify" + IdentityProviderUpdateParamsAccessAzureAdTypeFacebook IdentityProviderUpdateParamsAccessAzureAdType = "facebook" + IdentityProviderUpdateParamsAccessAzureAdTypeGitHub IdentityProviderUpdateParamsAccessAzureAdType = "github" + IdentityProviderUpdateParamsAccessAzureAdTypeGoogleApps IdentityProviderUpdateParamsAccessAzureAdType = "google-apps" + IdentityProviderUpdateParamsAccessAzureAdTypeGoogle IdentityProviderUpdateParamsAccessAzureAdType = "google" + IdentityProviderUpdateParamsAccessAzureAdTypeLinkedin IdentityProviderUpdateParamsAccessAzureAdType = "linkedin" + IdentityProviderUpdateParamsAccessAzureAdTypeOidc IdentityProviderUpdateParamsAccessAzureAdType = "oidc" + IdentityProviderUpdateParamsAccessAzureAdTypeOkta IdentityProviderUpdateParamsAccessAzureAdType = "okta" + IdentityProviderUpdateParamsAccessAzureAdTypeOnelogin IdentityProviderUpdateParamsAccessAzureAdType = "onelogin" + IdentityProviderUpdateParamsAccessAzureAdTypePingone IdentityProviderUpdateParamsAccessAzureAdType = "pingone" + IdentityProviderUpdateParamsAccessAzureAdTypeYandex IdentityProviderUpdateParamsAccessAzureAdType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessAzureAdType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessAzureAdTypeOnetimepin, IdentityProviderUpdateParamsAccessAzureAdTypeAzureAd, IdentityProviderUpdateParamsAccessAzureAdTypeSaml, IdentityProviderUpdateParamsAccessAzureAdTypeCentrify, IdentityProviderUpdateParamsAccessAzureAdTypeFacebook, IdentityProviderUpdateParamsAccessAzureAdTypeGitHub, IdentityProviderUpdateParamsAccessAzureAdTypeGoogleApps, IdentityProviderUpdateParamsAccessAzureAdTypeGoogle, IdentityProviderUpdateParamsAccessAzureAdTypeLinkedin, IdentityProviderUpdateParamsAccessAzureAdTypeOidc, IdentityProviderUpdateParamsAccessAzureAdTypeOkta, IdentityProviderUpdateParamsAccessAzureAdTypeOnelogin, IdentityProviderUpdateParamsAccessAzureAdTypePingone, IdentityProviderUpdateParamsAccessAzureAdTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessAzureAdScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessAzureAdScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessCentrify struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessCentrifyConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessCentrifyType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessCentrifyScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessCentrify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessCentrify) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessCentrify) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessCentrify) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessCentrifyConfig struct { + // Your centrify account url + CentrifyAccount param.Field[string] `json:"centrify_account"` + // Your centrify app id + CentrifyAppID param.Field[string] `json:"centrify_app_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r IdentityProviderUpdateParamsAccessCentrifyConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessCentrifyType string + +const ( + IdentityProviderUpdateParamsAccessCentrifyTypeOnetimepin IdentityProviderUpdateParamsAccessCentrifyType = "onetimepin" + IdentityProviderUpdateParamsAccessCentrifyTypeAzureAd IdentityProviderUpdateParamsAccessCentrifyType = "azureAD" + IdentityProviderUpdateParamsAccessCentrifyTypeSaml IdentityProviderUpdateParamsAccessCentrifyType = "saml" + IdentityProviderUpdateParamsAccessCentrifyTypeCentrify IdentityProviderUpdateParamsAccessCentrifyType = "centrify" + IdentityProviderUpdateParamsAccessCentrifyTypeFacebook IdentityProviderUpdateParamsAccessCentrifyType = "facebook" + IdentityProviderUpdateParamsAccessCentrifyTypeGitHub IdentityProviderUpdateParamsAccessCentrifyType = "github" + IdentityProviderUpdateParamsAccessCentrifyTypeGoogleApps IdentityProviderUpdateParamsAccessCentrifyType = "google-apps" + IdentityProviderUpdateParamsAccessCentrifyTypeGoogle IdentityProviderUpdateParamsAccessCentrifyType = "google" + IdentityProviderUpdateParamsAccessCentrifyTypeLinkedin IdentityProviderUpdateParamsAccessCentrifyType = "linkedin" + IdentityProviderUpdateParamsAccessCentrifyTypeOidc IdentityProviderUpdateParamsAccessCentrifyType = "oidc" + IdentityProviderUpdateParamsAccessCentrifyTypeOkta IdentityProviderUpdateParamsAccessCentrifyType = "okta" + IdentityProviderUpdateParamsAccessCentrifyTypeOnelogin IdentityProviderUpdateParamsAccessCentrifyType = "onelogin" + IdentityProviderUpdateParamsAccessCentrifyTypePingone IdentityProviderUpdateParamsAccessCentrifyType = "pingone" + IdentityProviderUpdateParamsAccessCentrifyTypeYandex IdentityProviderUpdateParamsAccessCentrifyType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessCentrifyType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessCentrifyTypeOnetimepin, IdentityProviderUpdateParamsAccessCentrifyTypeAzureAd, IdentityProviderUpdateParamsAccessCentrifyTypeSaml, IdentityProviderUpdateParamsAccessCentrifyTypeCentrify, IdentityProviderUpdateParamsAccessCentrifyTypeFacebook, IdentityProviderUpdateParamsAccessCentrifyTypeGitHub, IdentityProviderUpdateParamsAccessCentrifyTypeGoogleApps, IdentityProviderUpdateParamsAccessCentrifyTypeGoogle, IdentityProviderUpdateParamsAccessCentrifyTypeLinkedin, IdentityProviderUpdateParamsAccessCentrifyTypeOidc, IdentityProviderUpdateParamsAccessCentrifyTypeOkta, IdentityProviderUpdateParamsAccessCentrifyTypeOnelogin, IdentityProviderUpdateParamsAccessCentrifyTypePingone, IdentityProviderUpdateParamsAccessCentrifyTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessCentrifyScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessCentrifyScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessFacebook struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessFacebookConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessFacebookType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessFacebookScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessFacebook) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessFacebook) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessFacebook) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessFacebook) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessFacebookConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderUpdateParamsAccessFacebookConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessFacebookType string + +const ( + IdentityProviderUpdateParamsAccessFacebookTypeOnetimepin IdentityProviderUpdateParamsAccessFacebookType = "onetimepin" + IdentityProviderUpdateParamsAccessFacebookTypeAzureAd IdentityProviderUpdateParamsAccessFacebookType = "azureAD" + IdentityProviderUpdateParamsAccessFacebookTypeSaml IdentityProviderUpdateParamsAccessFacebookType = "saml" + IdentityProviderUpdateParamsAccessFacebookTypeCentrify IdentityProviderUpdateParamsAccessFacebookType = "centrify" + IdentityProviderUpdateParamsAccessFacebookTypeFacebook IdentityProviderUpdateParamsAccessFacebookType = "facebook" + IdentityProviderUpdateParamsAccessFacebookTypeGitHub IdentityProviderUpdateParamsAccessFacebookType = "github" + IdentityProviderUpdateParamsAccessFacebookTypeGoogleApps IdentityProviderUpdateParamsAccessFacebookType = "google-apps" + IdentityProviderUpdateParamsAccessFacebookTypeGoogle IdentityProviderUpdateParamsAccessFacebookType = "google" + IdentityProviderUpdateParamsAccessFacebookTypeLinkedin IdentityProviderUpdateParamsAccessFacebookType = "linkedin" + IdentityProviderUpdateParamsAccessFacebookTypeOidc IdentityProviderUpdateParamsAccessFacebookType = "oidc" + IdentityProviderUpdateParamsAccessFacebookTypeOkta IdentityProviderUpdateParamsAccessFacebookType = "okta" + IdentityProviderUpdateParamsAccessFacebookTypeOnelogin IdentityProviderUpdateParamsAccessFacebookType = "onelogin" + IdentityProviderUpdateParamsAccessFacebookTypePingone IdentityProviderUpdateParamsAccessFacebookType = "pingone" + IdentityProviderUpdateParamsAccessFacebookTypeYandex IdentityProviderUpdateParamsAccessFacebookType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessFacebookType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessFacebookTypeOnetimepin, IdentityProviderUpdateParamsAccessFacebookTypeAzureAd, IdentityProviderUpdateParamsAccessFacebookTypeSaml, IdentityProviderUpdateParamsAccessFacebookTypeCentrify, IdentityProviderUpdateParamsAccessFacebookTypeFacebook, IdentityProviderUpdateParamsAccessFacebookTypeGitHub, IdentityProviderUpdateParamsAccessFacebookTypeGoogleApps, IdentityProviderUpdateParamsAccessFacebookTypeGoogle, IdentityProviderUpdateParamsAccessFacebookTypeLinkedin, IdentityProviderUpdateParamsAccessFacebookTypeOidc, IdentityProviderUpdateParamsAccessFacebookTypeOkta, IdentityProviderUpdateParamsAccessFacebookTypeOnelogin, IdentityProviderUpdateParamsAccessFacebookTypePingone, IdentityProviderUpdateParamsAccessFacebookTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessFacebookScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessFacebookScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessGitHub struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessGitHubConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessGitHubType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessGitHubScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessGitHub) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessGitHub) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessGitHub) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessGitHub) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGitHubConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderUpdateParamsAccessGitHubConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGitHubType string + +const ( + IdentityProviderUpdateParamsAccessGitHubTypeOnetimepin IdentityProviderUpdateParamsAccessGitHubType = "onetimepin" + IdentityProviderUpdateParamsAccessGitHubTypeAzureAd IdentityProviderUpdateParamsAccessGitHubType = "azureAD" + IdentityProviderUpdateParamsAccessGitHubTypeSaml IdentityProviderUpdateParamsAccessGitHubType = "saml" + IdentityProviderUpdateParamsAccessGitHubTypeCentrify IdentityProviderUpdateParamsAccessGitHubType = "centrify" + IdentityProviderUpdateParamsAccessGitHubTypeFacebook IdentityProviderUpdateParamsAccessGitHubType = "facebook" + IdentityProviderUpdateParamsAccessGitHubTypeGitHub IdentityProviderUpdateParamsAccessGitHubType = "github" + IdentityProviderUpdateParamsAccessGitHubTypeGoogleApps IdentityProviderUpdateParamsAccessGitHubType = "google-apps" + IdentityProviderUpdateParamsAccessGitHubTypeGoogle IdentityProviderUpdateParamsAccessGitHubType = "google" + IdentityProviderUpdateParamsAccessGitHubTypeLinkedin IdentityProviderUpdateParamsAccessGitHubType = "linkedin" + IdentityProviderUpdateParamsAccessGitHubTypeOidc IdentityProviderUpdateParamsAccessGitHubType = "oidc" + IdentityProviderUpdateParamsAccessGitHubTypeOkta IdentityProviderUpdateParamsAccessGitHubType = "okta" + IdentityProviderUpdateParamsAccessGitHubTypeOnelogin IdentityProviderUpdateParamsAccessGitHubType = "onelogin" + IdentityProviderUpdateParamsAccessGitHubTypePingone IdentityProviderUpdateParamsAccessGitHubType = "pingone" + IdentityProviderUpdateParamsAccessGitHubTypeYandex IdentityProviderUpdateParamsAccessGitHubType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessGitHubType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessGitHubTypeOnetimepin, IdentityProviderUpdateParamsAccessGitHubTypeAzureAd, IdentityProviderUpdateParamsAccessGitHubTypeSaml, IdentityProviderUpdateParamsAccessGitHubTypeCentrify, IdentityProviderUpdateParamsAccessGitHubTypeFacebook, IdentityProviderUpdateParamsAccessGitHubTypeGitHub, IdentityProviderUpdateParamsAccessGitHubTypeGoogleApps, IdentityProviderUpdateParamsAccessGitHubTypeGoogle, IdentityProviderUpdateParamsAccessGitHubTypeLinkedin, IdentityProviderUpdateParamsAccessGitHubTypeOidc, IdentityProviderUpdateParamsAccessGitHubTypeOkta, IdentityProviderUpdateParamsAccessGitHubTypeOnelogin, IdentityProviderUpdateParamsAccessGitHubTypePingone, IdentityProviderUpdateParamsAccessGitHubTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessGitHubScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessGitHubScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessGoogle struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessGoogleConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessGoogleType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessGoogleScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessGoogle) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessGoogle) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessGoogle) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessGoogle) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGoogleConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r IdentityProviderUpdateParamsAccessGoogleConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGoogleType string + +const ( + IdentityProviderUpdateParamsAccessGoogleTypeOnetimepin IdentityProviderUpdateParamsAccessGoogleType = "onetimepin" + IdentityProviderUpdateParamsAccessGoogleTypeAzureAd IdentityProviderUpdateParamsAccessGoogleType = "azureAD" + IdentityProviderUpdateParamsAccessGoogleTypeSaml IdentityProviderUpdateParamsAccessGoogleType = "saml" + IdentityProviderUpdateParamsAccessGoogleTypeCentrify IdentityProviderUpdateParamsAccessGoogleType = "centrify" + IdentityProviderUpdateParamsAccessGoogleTypeFacebook IdentityProviderUpdateParamsAccessGoogleType = "facebook" + IdentityProviderUpdateParamsAccessGoogleTypeGitHub IdentityProviderUpdateParamsAccessGoogleType = "github" + IdentityProviderUpdateParamsAccessGoogleTypeGoogleApps IdentityProviderUpdateParamsAccessGoogleType = "google-apps" + IdentityProviderUpdateParamsAccessGoogleTypeGoogle IdentityProviderUpdateParamsAccessGoogleType = "google" + IdentityProviderUpdateParamsAccessGoogleTypeLinkedin IdentityProviderUpdateParamsAccessGoogleType = "linkedin" + IdentityProviderUpdateParamsAccessGoogleTypeOidc IdentityProviderUpdateParamsAccessGoogleType = "oidc" + IdentityProviderUpdateParamsAccessGoogleTypeOkta IdentityProviderUpdateParamsAccessGoogleType = "okta" + IdentityProviderUpdateParamsAccessGoogleTypeOnelogin IdentityProviderUpdateParamsAccessGoogleType = "onelogin" + IdentityProviderUpdateParamsAccessGoogleTypePingone IdentityProviderUpdateParamsAccessGoogleType = "pingone" + IdentityProviderUpdateParamsAccessGoogleTypeYandex IdentityProviderUpdateParamsAccessGoogleType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessGoogleType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessGoogleTypeOnetimepin, IdentityProviderUpdateParamsAccessGoogleTypeAzureAd, IdentityProviderUpdateParamsAccessGoogleTypeSaml, IdentityProviderUpdateParamsAccessGoogleTypeCentrify, IdentityProviderUpdateParamsAccessGoogleTypeFacebook, IdentityProviderUpdateParamsAccessGoogleTypeGitHub, IdentityProviderUpdateParamsAccessGoogleTypeGoogleApps, IdentityProviderUpdateParamsAccessGoogleTypeGoogle, IdentityProviderUpdateParamsAccessGoogleTypeLinkedin, IdentityProviderUpdateParamsAccessGoogleTypeOidc, IdentityProviderUpdateParamsAccessGoogleTypeOkta, IdentityProviderUpdateParamsAccessGoogleTypeOnelogin, IdentityProviderUpdateParamsAccessGoogleTypePingone, IdentityProviderUpdateParamsAccessGoogleTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessGoogleScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessGoogleScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessGoogleApps struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessGoogleAppsConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessGoogleAppsType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessGoogleAppsScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessGoogleApps) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessGoogleApps) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessGoogleApps) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessGoogleApps) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGoogleAppsConfig struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` +} + +func (r IdentityProviderUpdateParamsAccessGoogleAppsConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessGoogleAppsType string + +const ( + IdentityProviderUpdateParamsAccessGoogleAppsTypeOnetimepin IdentityProviderUpdateParamsAccessGoogleAppsType = "onetimepin" + IdentityProviderUpdateParamsAccessGoogleAppsTypeAzureAd IdentityProviderUpdateParamsAccessGoogleAppsType = "azureAD" + IdentityProviderUpdateParamsAccessGoogleAppsTypeSaml IdentityProviderUpdateParamsAccessGoogleAppsType = "saml" + IdentityProviderUpdateParamsAccessGoogleAppsTypeCentrify IdentityProviderUpdateParamsAccessGoogleAppsType = "centrify" + IdentityProviderUpdateParamsAccessGoogleAppsTypeFacebook IdentityProviderUpdateParamsAccessGoogleAppsType = "facebook" + IdentityProviderUpdateParamsAccessGoogleAppsTypeGitHub IdentityProviderUpdateParamsAccessGoogleAppsType = "github" + IdentityProviderUpdateParamsAccessGoogleAppsTypeGoogleApps IdentityProviderUpdateParamsAccessGoogleAppsType = "google-apps" + IdentityProviderUpdateParamsAccessGoogleAppsTypeGoogle IdentityProviderUpdateParamsAccessGoogleAppsType = "google" + IdentityProviderUpdateParamsAccessGoogleAppsTypeLinkedin IdentityProviderUpdateParamsAccessGoogleAppsType = "linkedin" + IdentityProviderUpdateParamsAccessGoogleAppsTypeOidc IdentityProviderUpdateParamsAccessGoogleAppsType = "oidc" + IdentityProviderUpdateParamsAccessGoogleAppsTypeOkta IdentityProviderUpdateParamsAccessGoogleAppsType = "okta" + IdentityProviderUpdateParamsAccessGoogleAppsTypeOnelogin IdentityProviderUpdateParamsAccessGoogleAppsType = "onelogin" + IdentityProviderUpdateParamsAccessGoogleAppsTypePingone IdentityProviderUpdateParamsAccessGoogleAppsType = "pingone" + IdentityProviderUpdateParamsAccessGoogleAppsTypeYandex IdentityProviderUpdateParamsAccessGoogleAppsType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessGoogleAppsType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessGoogleAppsTypeOnetimepin, IdentityProviderUpdateParamsAccessGoogleAppsTypeAzureAd, IdentityProviderUpdateParamsAccessGoogleAppsTypeSaml, IdentityProviderUpdateParamsAccessGoogleAppsTypeCentrify, IdentityProviderUpdateParamsAccessGoogleAppsTypeFacebook, IdentityProviderUpdateParamsAccessGoogleAppsTypeGitHub, IdentityProviderUpdateParamsAccessGoogleAppsTypeGoogleApps, IdentityProviderUpdateParamsAccessGoogleAppsTypeGoogle, IdentityProviderUpdateParamsAccessGoogleAppsTypeLinkedin, IdentityProviderUpdateParamsAccessGoogleAppsTypeOidc, IdentityProviderUpdateParamsAccessGoogleAppsTypeOkta, IdentityProviderUpdateParamsAccessGoogleAppsTypeOnelogin, IdentityProviderUpdateParamsAccessGoogleAppsTypePingone, IdentityProviderUpdateParamsAccessGoogleAppsTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessGoogleAppsScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessGoogleAppsScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessLinkedin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessLinkedinConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessLinkedinType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessLinkedinScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessLinkedin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessLinkedin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessLinkedin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessLinkedin) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessLinkedinConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderUpdateParamsAccessLinkedinConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessLinkedinType string + +const ( + IdentityProviderUpdateParamsAccessLinkedinTypeOnetimepin IdentityProviderUpdateParamsAccessLinkedinType = "onetimepin" + IdentityProviderUpdateParamsAccessLinkedinTypeAzureAd IdentityProviderUpdateParamsAccessLinkedinType = "azureAD" + IdentityProviderUpdateParamsAccessLinkedinTypeSaml IdentityProviderUpdateParamsAccessLinkedinType = "saml" + IdentityProviderUpdateParamsAccessLinkedinTypeCentrify IdentityProviderUpdateParamsAccessLinkedinType = "centrify" + IdentityProviderUpdateParamsAccessLinkedinTypeFacebook IdentityProviderUpdateParamsAccessLinkedinType = "facebook" + IdentityProviderUpdateParamsAccessLinkedinTypeGitHub IdentityProviderUpdateParamsAccessLinkedinType = "github" + IdentityProviderUpdateParamsAccessLinkedinTypeGoogleApps IdentityProviderUpdateParamsAccessLinkedinType = "google-apps" + IdentityProviderUpdateParamsAccessLinkedinTypeGoogle IdentityProviderUpdateParamsAccessLinkedinType = "google" + IdentityProviderUpdateParamsAccessLinkedinTypeLinkedin IdentityProviderUpdateParamsAccessLinkedinType = "linkedin" + IdentityProviderUpdateParamsAccessLinkedinTypeOidc IdentityProviderUpdateParamsAccessLinkedinType = "oidc" + IdentityProviderUpdateParamsAccessLinkedinTypeOkta IdentityProviderUpdateParamsAccessLinkedinType = "okta" + IdentityProviderUpdateParamsAccessLinkedinTypeOnelogin IdentityProviderUpdateParamsAccessLinkedinType = "onelogin" + IdentityProviderUpdateParamsAccessLinkedinTypePingone IdentityProviderUpdateParamsAccessLinkedinType = "pingone" + IdentityProviderUpdateParamsAccessLinkedinTypeYandex IdentityProviderUpdateParamsAccessLinkedinType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessLinkedinType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessLinkedinTypeOnetimepin, IdentityProviderUpdateParamsAccessLinkedinTypeAzureAd, IdentityProviderUpdateParamsAccessLinkedinTypeSaml, IdentityProviderUpdateParamsAccessLinkedinTypeCentrify, IdentityProviderUpdateParamsAccessLinkedinTypeFacebook, IdentityProviderUpdateParamsAccessLinkedinTypeGitHub, IdentityProviderUpdateParamsAccessLinkedinTypeGoogleApps, IdentityProviderUpdateParamsAccessLinkedinTypeGoogle, IdentityProviderUpdateParamsAccessLinkedinTypeLinkedin, IdentityProviderUpdateParamsAccessLinkedinTypeOidc, IdentityProviderUpdateParamsAccessLinkedinTypeOkta, IdentityProviderUpdateParamsAccessLinkedinTypeOnelogin, IdentityProviderUpdateParamsAccessLinkedinTypePingone, IdentityProviderUpdateParamsAccessLinkedinTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessLinkedinScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessLinkedinScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessOidc struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessOidcConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessOidcType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessOidcScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessOidc) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessOidc) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessOidc) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessOidc) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOidcConfig struct { // The authorization_endpoint URL of your IdP AuthURL param.Field[string] `json:"auth_url"` - // Your okta authorization server id - AuthorizationServerID param.Field[string] `json:"authorization_server_id"` - // Your centrify account url - CentrifyAccount param.Field[string] `json:"centrify_account"` - // Your centrify app id - CentrifyAppID param.Field[string] `json:"centrify_app_id"` // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens CERTsURL param.Field[string] `json:"certs_url"` // Custom claims @@ -4777,119 +7043,717 @@ type IdentityProviderUpdateParamsConfig struct { ClientID param.Field[string] `json:"client_id"` // Your OAuth Client Secret ClientSecret param.Field[string] `json:"client_secret"` - // Should Cloudflare try to load authentication contexts from your account - ConditionalAccessEnabled param.Field[bool] `json:"conditional_access_enabled"` - // Your Azure directory uuid - DirectoryID param.Field[string] `json:"directory_id"` - // The attribute name for email in the SAML response. - EmailAttributeName param.Field[string] `json:"email_attribute_name"` // The claim name for email in the id_token response. EmailClaimName param.Field[string] `json:"email_claim_name"` + // OAuth scopes + Scopes param.Field[[]string] `json:"scopes"` + // The token_endpoint URL of your IdP + TokenURL param.Field[string] `json:"token_url"` +} + +func (r IdentityProviderUpdateParamsAccessOidcConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOidcType string + +const ( + IdentityProviderUpdateParamsAccessOidcTypeOnetimepin IdentityProviderUpdateParamsAccessOidcType = "onetimepin" + IdentityProviderUpdateParamsAccessOidcTypeAzureAd IdentityProviderUpdateParamsAccessOidcType = "azureAD" + IdentityProviderUpdateParamsAccessOidcTypeSaml IdentityProviderUpdateParamsAccessOidcType = "saml" + IdentityProviderUpdateParamsAccessOidcTypeCentrify IdentityProviderUpdateParamsAccessOidcType = "centrify" + IdentityProviderUpdateParamsAccessOidcTypeFacebook IdentityProviderUpdateParamsAccessOidcType = "facebook" + IdentityProviderUpdateParamsAccessOidcTypeGitHub IdentityProviderUpdateParamsAccessOidcType = "github" + IdentityProviderUpdateParamsAccessOidcTypeGoogleApps IdentityProviderUpdateParamsAccessOidcType = "google-apps" + IdentityProviderUpdateParamsAccessOidcTypeGoogle IdentityProviderUpdateParamsAccessOidcType = "google" + IdentityProviderUpdateParamsAccessOidcTypeLinkedin IdentityProviderUpdateParamsAccessOidcType = "linkedin" + IdentityProviderUpdateParamsAccessOidcTypeOidc IdentityProviderUpdateParamsAccessOidcType = "oidc" + IdentityProviderUpdateParamsAccessOidcTypeOkta IdentityProviderUpdateParamsAccessOidcType = "okta" + IdentityProviderUpdateParamsAccessOidcTypeOnelogin IdentityProviderUpdateParamsAccessOidcType = "onelogin" + IdentityProviderUpdateParamsAccessOidcTypePingone IdentityProviderUpdateParamsAccessOidcType = "pingone" + IdentityProviderUpdateParamsAccessOidcTypeYandex IdentityProviderUpdateParamsAccessOidcType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessOidcType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessOidcTypeOnetimepin, IdentityProviderUpdateParamsAccessOidcTypeAzureAd, IdentityProviderUpdateParamsAccessOidcTypeSaml, IdentityProviderUpdateParamsAccessOidcTypeCentrify, IdentityProviderUpdateParamsAccessOidcTypeFacebook, IdentityProviderUpdateParamsAccessOidcTypeGitHub, IdentityProviderUpdateParamsAccessOidcTypeGoogleApps, IdentityProviderUpdateParamsAccessOidcTypeGoogle, IdentityProviderUpdateParamsAccessOidcTypeLinkedin, IdentityProviderUpdateParamsAccessOidcTypeOidc, IdentityProviderUpdateParamsAccessOidcTypeOkta, IdentityProviderUpdateParamsAccessOidcTypeOnelogin, IdentityProviderUpdateParamsAccessOidcTypePingone, IdentityProviderUpdateParamsAccessOidcTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessOidcScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessOidcScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessOkta struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessOktaConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessOktaType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessOktaScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessOkta) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessOkta) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessOkta) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessOkta) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOktaConfig struct { + // Your okta authorization server id + AuthorizationServerID param.Field[string] `json:"authorization_server_id"` + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` +} + +func (r IdentityProviderUpdateParamsAccessOktaConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOktaType string + +const ( + IdentityProviderUpdateParamsAccessOktaTypeOnetimepin IdentityProviderUpdateParamsAccessOktaType = "onetimepin" + IdentityProviderUpdateParamsAccessOktaTypeAzureAd IdentityProviderUpdateParamsAccessOktaType = "azureAD" + IdentityProviderUpdateParamsAccessOktaTypeSaml IdentityProviderUpdateParamsAccessOktaType = "saml" + IdentityProviderUpdateParamsAccessOktaTypeCentrify IdentityProviderUpdateParamsAccessOktaType = "centrify" + IdentityProviderUpdateParamsAccessOktaTypeFacebook IdentityProviderUpdateParamsAccessOktaType = "facebook" + IdentityProviderUpdateParamsAccessOktaTypeGitHub IdentityProviderUpdateParamsAccessOktaType = "github" + IdentityProviderUpdateParamsAccessOktaTypeGoogleApps IdentityProviderUpdateParamsAccessOktaType = "google-apps" + IdentityProviderUpdateParamsAccessOktaTypeGoogle IdentityProviderUpdateParamsAccessOktaType = "google" + IdentityProviderUpdateParamsAccessOktaTypeLinkedin IdentityProviderUpdateParamsAccessOktaType = "linkedin" + IdentityProviderUpdateParamsAccessOktaTypeOidc IdentityProviderUpdateParamsAccessOktaType = "oidc" + IdentityProviderUpdateParamsAccessOktaTypeOkta IdentityProviderUpdateParamsAccessOktaType = "okta" + IdentityProviderUpdateParamsAccessOktaTypeOnelogin IdentityProviderUpdateParamsAccessOktaType = "onelogin" + IdentityProviderUpdateParamsAccessOktaTypePingone IdentityProviderUpdateParamsAccessOktaType = "pingone" + IdentityProviderUpdateParamsAccessOktaTypeYandex IdentityProviderUpdateParamsAccessOktaType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessOktaType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessOktaTypeOnetimepin, IdentityProviderUpdateParamsAccessOktaTypeAzureAd, IdentityProviderUpdateParamsAccessOktaTypeSaml, IdentityProviderUpdateParamsAccessOktaTypeCentrify, IdentityProviderUpdateParamsAccessOktaTypeFacebook, IdentityProviderUpdateParamsAccessOktaTypeGitHub, IdentityProviderUpdateParamsAccessOktaTypeGoogleApps, IdentityProviderUpdateParamsAccessOktaTypeGoogle, IdentityProviderUpdateParamsAccessOktaTypeLinkedin, IdentityProviderUpdateParamsAccessOktaTypeOidc, IdentityProviderUpdateParamsAccessOktaTypeOkta, IdentityProviderUpdateParamsAccessOktaTypeOnelogin, IdentityProviderUpdateParamsAccessOktaTypePingone, IdentityProviderUpdateParamsAccessOktaTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessOktaScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessOktaScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessOnelogin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessOneloginConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessOneloginType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessOneloginScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessOnelogin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessOnelogin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessOnelogin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessOnelogin) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOneloginConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` +} + +func (r IdentityProviderUpdateParamsAccessOneloginConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessOneloginType string + +const ( + IdentityProviderUpdateParamsAccessOneloginTypeOnetimepin IdentityProviderUpdateParamsAccessOneloginType = "onetimepin" + IdentityProviderUpdateParamsAccessOneloginTypeAzureAd IdentityProviderUpdateParamsAccessOneloginType = "azureAD" + IdentityProviderUpdateParamsAccessOneloginTypeSaml IdentityProviderUpdateParamsAccessOneloginType = "saml" + IdentityProviderUpdateParamsAccessOneloginTypeCentrify IdentityProviderUpdateParamsAccessOneloginType = "centrify" + IdentityProviderUpdateParamsAccessOneloginTypeFacebook IdentityProviderUpdateParamsAccessOneloginType = "facebook" + IdentityProviderUpdateParamsAccessOneloginTypeGitHub IdentityProviderUpdateParamsAccessOneloginType = "github" + IdentityProviderUpdateParamsAccessOneloginTypeGoogleApps IdentityProviderUpdateParamsAccessOneloginType = "google-apps" + IdentityProviderUpdateParamsAccessOneloginTypeGoogle IdentityProviderUpdateParamsAccessOneloginType = "google" + IdentityProviderUpdateParamsAccessOneloginTypeLinkedin IdentityProviderUpdateParamsAccessOneloginType = "linkedin" + IdentityProviderUpdateParamsAccessOneloginTypeOidc IdentityProviderUpdateParamsAccessOneloginType = "oidc" + IdentityProviderUpdateParamsAccessOneloginTypeOkta IdentityProviderUpdateParamsAccessOneloginType = "okta" + IdentityProviderUpdateParamsAccessOneloginTypeOnelogin IdentityProviderUpdateParamsAccessOneloginType = "onelogin" + IdentityProviderUpdateParamsAccessOneloginTypePingone IdentityProviderUpdateParamsAccessOneloginType = "pingone" + IdentityProviderUpdateParamsAccessOneloginTypeYandex IdentityProviderUpdateParamsAccessOneloginType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessOneloginType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessOneloginTypeOnetimepin, IdentityProviderUpdateParamsAccessOneloginTypeAzureAd, IdentityProviderUpdateParamsAccessOneloginTypeSaml, IdentityProviderUpdateParamsAccessOneloginTypeCentrify, IdentityProviderUpdateParamsAccessOneloginTypeFacebook, IdentityProviderUpdateParamsAccessOneloginTypeGitHub, IdentityProviderUpdateParamsAccessOneloginTypeGoogleApps, IdentityProviderUpdateParamsAccessOneloginTypeGoogle, IdentityProviderUpdateParamsAccessOneloginTypeLinkedin, IdentityProviderUpdateParamsAccessOneloginTypeOidc, IdentityProviderUpdateParamsAccessOneloginTypeOkta, IdentityProviderUpdateParamsAccessOneloginTypeOnelogin, IdentityProviderUpdateParamsAccessOneloginTypePingone, IdentityProviderUpdateParamsAccessOneloginTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessOneloginScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessOneloginScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessPingone struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessPingoneConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessPingoneType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessPingoneScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessPingone) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessPingone) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessPingone) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessPingone) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessPingoneConfig struct { + // Custom claims + Claims param.Field[[]string] `json:"claims"` + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` + // The claim name for email in the id_token response. + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your PingOne environment identifier + PingEnvID param.Field[string] `json:"ping_env_id"` +} + +func (r IdentityProviderUpdateParamsAccessPingoneConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessPingoneType string + +const ( + IdentityProviderUpdateParamsAccessPingoneTypeOnetimepin IdentityProviderUpdateParamsAccessPingoneType = "onetimepin" + IdentityProviderUpdateParamsAccessPingoneTypeAzureAd IdentityProviderUpdateParamsAccessPingoneType = "azureAD" + IdentityProviderUpdateParamsAccessPingoneTypeSaml IdentityProviderUpdateParamsAccessPingoneType = "saml" + IdentityProviderUpdateParamsAccessPingoneTypeCentrify IdentityProviderUpdateParamsAccessPingoneType = "centrify" + IdentityProviderUpdateParamsAccessPingoneTypeFacebook IdentityProviderUpdateParamsAccessPingoneType = "facebook" + IdentityProviderUpdateParamsAccessPingoneTypeGitHub IdentityProviderUpdateParamsAccessPingoneType = "github" + IdentityProviderUpdateParamsAccessPingoneTypeGoogleApps IdentityProviderUpdateParamsAccessPingoneType = "google-apps" + IdentityProviderUpdateParamsAccessPingoneTypeGoogle IdentityProviderUpdateParamsAccessPingoneType = "google" + IdentityProviderUpdateParamsAccessPingoneTypeLinkedin IdentityProviderUpdateParamsAccessPingoneType = "linkedin" + IdentityProviderUpdateParamsAccessPingoneTypeOidc IdentityProviderUpdateParamsAccessPingoneType = "oidc" + IdentityProviderUpdateParamsAccessPingoneTypeOkta IdentityProviderUpdateParamsAccessPingoneType = "okta" + IdentityProviderUpdateParamsAccessPingoneTypeOnelogin IdentityProviderUpdateParamsAccessPingoneType = "onelogin" + IdentityProviderUpdateParamsAccessPingoneTypePingone IdentityProviderUpdateParamsAccessPingoneType = "pingone" + IdentityProviderUpdateParamsAccessPingoneTypeYandex IdentityProviderUpdateParamsAccessPingoneType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessPingoneType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessPingoneTypeOnetimepin, IdentityProviderUpdateParamsAccessPingoneTypeAzureAd, IdentityProviderUpdateParamsAccessPingoneTypeSaml, IdentityProviderUpdateParamsAccessPingoneTypeCentrify, IdentityProviderUpdateParamsAccessPingoneTypeFacebook, IdentityProviderUpdateParamsAccessPingoneTypeGitHub, IdentityProviderUpdateParamsAccessPingoneTypeGoogleApps, IdentityProviderUpdateParamsAccessPingoneTypeGoogle, IdentityProviderUpdateParamsAccessPingoneTypeLinkedin, IdentityProviderUpdateParamsAccessPingoneTypeOidc, IdentityProviderUpdateParamsAccessPingoneTypeOkta, IdentityProviderUpdateParamsAccessPingoneTypeOnelogin, IdentityProviderUpdateParamsAccessPingoneTypePingone, IdentityProviderUpdateParamsAccessPingoneTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessPingoneScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessPingoneScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessSaml struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessSamlConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessSamlType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessSamlScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessSaml) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessSaml) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessSaml) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessSaml) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessSamlConfig struct { + // A list of SAML attribute names that will be added to your signed JWT token and + // can be used in SAML policy rules. + Attributes param.Field[[]string] `json:"attributes"` + // The attribute name for email in the SAML response. + EmailAttributeName param.Field[string] `json:"email_attribute_name"` // Add a list of attribute names that will be returned in the response header from // the Access callback. - HeaderAttributes param.Field[[]IdentityProviderUpdateParamsConfigHeaderAttribute] `json:"header_attributes"` + HeaderAttributes param.Field[[]IdentityProviderUpdateParamsAccessSamlConfigHeaderAttribute] `json:"header_attributes"` // X509 certificate to verify the signature in the SAML authentication response IDPPublicCERTs param.Field[[]string] `json:"idp_public_certs"` // IdP Entity ID or Issuer URL IssuerURL param.Field[string] `json:"issuer_url"` - // Your okta account url - OktaAccount param.Field[string] `json:"okta_account"` - // Your OneLogin account url - OneloginAccount param.Field[string] `json:"onelogin_account"` - // Your PingOne environment identifier - PingEnvID param.Field[string] `json:"ping_env_id"` - // Indicates the type of user interaction that is required. prompt=login forces the - // user to enter their credentials on that request, negating single-sign on. - // prompt=none is the opposite. It ensures that the user isn't presented with any - // interactive prompt. If the request can't be completed silently by using - // single-sign on, the Microsoft identity platform returns an interaction_required - // error. prompt=select_account interrupts single sign-on providing account - // selection experience listing all the accounts either in session or any - // remembered account or an option to choose to use a different account altogether. - Prompt param.Field[IdentityProviderUpdateParamsConfigPrompt] `json:"prompt"` - // OAuth scopes - Scopes param.Field[[]string] `json:"scopes"` // Sign the SAML authentication request with Access credentials. To verify the // signature, use the public key from the Access certs endpoints. SignRequest param.Field[bool] `json:"sign_request"` // URL to send the SAML authentication requests to SSOTargetURL param.Field[string] `json:"sso_target_url"` - // Should Cloudflare try to load groups from your account - SupportGroups param.Field[bool] `json:"support_groups"` - // The token_endpoint URL of your IdP - TokenURL param.Field[string] `json:"token_url"` } -func (r IdentityProviderUpdateParamsConfig) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderUpdateParamsAccessSamlConfig) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type IdentityProviderUpdateParamsConfigHeaderAttribute struct { +type IdentityProviderUpdateParamsAccessSamlConfigHeaderAttribute struct { // attribute name from the IDP AttributeName param.Field[string] `json:"attribute_name"` // header that will be added on the request to the origin HeaderName param.Field[string] `json:"header_name"` } -func (r IdentityProviderUpdateParamsConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderUpdateParamsAccessSamlConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Indicates the type of user interaction that is required. prompt=login forces the -// user to enter their credentials on that request, negating single-sign on. -// prompt=none is the opposite. It ensures that the user isn't presented with any -// interactive prompt. If the request can't be completed silently by using -// single-sign on, the Microsoft identity platform returns an interaction_required -// error. prompt=select_account interrupts single sign-on providing account -// selection experience listing all the accounts either in session or any -// remembered account or an option to choose to use a different account altogether. -type IdentityProviderUpdateParamsConfigPrompt string +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessSamlType string + +const ( + IdentityProviderUpdateParamsAccessSamlTypeOnetimepin IdentityProviderUpdateParamsAccessSamlType = "onetimepin" + IdentityProviderUpdateParamsAccessSamlTypeAzureAd IdentityProviderUpdateParamsAccessSamlType = "azureAD" + IdentityProviderUpdateParamsAccessSamlTypeSaml IdentityProviderUpdateParamsAccessSamlType = "saml" + IdentityProviderUpdateParamsAccessSamlTypeCentrify IdentityProviderUpdateParamsAccessSamlType = "centrify" + IdentityProviderUpdateParamsAccessSamlTypeFacebook IdentityProviderUpdateParamsAccessSamlType = "facebook" + IdentityProviderUpdateParamsAccessSamlTypeGitHub IdentityProviderUpdateParamsAccessSamlType = "github" + IdentityProviderUpdateParamsAccessSamlTypeGoogleApps IdentityProviderUpdateParamsAccessSamlType = "google-apps" + IdentityProviderUpdateParamsAccessSamlTypeGoogle IdentityProviderUpdateParamsAccessSamlType = "google" + IdentityProviderUpdateParamsAccessSamlTypeLinkedin IdentityProviderUpdateParamsAccessSamlType = "linkedin" + IdentityProviderUpdateParamsAccessSamlTypeOidc IdentityProviderUpdateParamsAccessSamlType = "oidc" + IdentityProviderUpdateParamsAccessSamlTypeOkta IdentityProviderUpdateParamsAccessSamlType = "okta" + IdentityProviderUpdateParamsAccessSamlTypeOnelogin IdentityProviderUpdateParamsAccessSamlType = "onelogin" + IdentityProviderUpdateParamsAccessSamlTypePingone IdentityProviderUpdateParamsAccessSamlType = "pingone" + IdentityProviderUpdateParamsAccessSamlTypeYandex IdentityProviderUpdateParamsAccessSamlType = "yandex" +) + +func (r IdentityProviderUpdateParamsAccessSamlType) IsKnown() bool { + switch r { + case IdentityProviderUpdateParamsAccessSamlTypeOnetimepin, IdentityProviderUpdateParamsAccessSamlTypeAzureAd, IdentityProviderUpdateParamsAccessSamlTypeSaml, IdentityProviderUpdateParamsAccessSamlTypeCentrify, IdentityProviderUpdateParamsAccessSamlTypeFacebook, IdentityProviderUpdateParamsAccessSamlTypeGitHub, IdentityProviderUpdateParamsAccessSamlTypeGoogleApps, IdentityProviderUpdateParamsAccessSamlTypeGoogle, IdentityProviderUpdateParamsAccessSamlTypeLinkedin, IdentityProviderUpdateParamsAccessSamlTypeOidc, IdentityProviderUpdateParamsAccessSamlTypeOkta, IdentityProviderUpdateParamsAccessSamlTypeOnelogin, IdentityProviderUpdateParamsAccessSamlTypePingone, IdentityProviderUpdateParamsAccessSamlTypeYandex: + return true + } + return false +} + +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessSamlScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessSamlScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessYandex struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[IdentityProviderUpdateParamsAccessYandexConfig] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessYandexType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessYandexScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessYandex) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessYandex) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessYandex) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessYandex) ImplementsIdentityProviderUpdateParams() { + +} + +// The configuration parameters for the identity provider. To view the required +// parameters for a specific provider, refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessYandexConfig struct { + // Your OAuth Client ID + ClientID param.Field[string] `json:"client_id"` + // Your OAuth Client Secret + ClientSecret param.Field[string] `json:"client_secret"` +} + +func (r IdentityProviderUpdateParamsAccessYandexConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of identity provider. To determine the value for a specific provider, +// refer to our +// [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). +type IdentityProviderUpdateParamsAccessYandexType string const ( - IdentityProviderUpdateParamsConfigPromptLogin IdentityProviderUpdateParamsConfigPrompt = "login" - IdentityProviderUpdateParamsConfigPromptSelectAccount IdentityProviderUpdateParamsConfigPrompt = "select_account" - IdentityProviderUpdateParamsConfigPromptNone IdentityProviderUpdateParamsConfigPrompt = "none" + IdentityProviderUpdateParamsAccessYandexTypeOnetimepin IdentityProviderUpdateParamsAccessYandexType = "onetimepin" + IdentityProviderUpdateParamsAccessYandexTypeAzureAd IdentityProviderUpdateParamsAccessYandexType = "azureAD" + IdentityProviderUpdateParamsAccessYandexTypeSaml IdentityProviderUpdateParamsAccessYandexType = "saml" + IdentityProviderUpdateParamsAccessYandexTypeCentrify IdentityProviderUpdateParamsAccessYandexType = "centrify" + IdentityProviderUpdateParamsAccessYandexTypeFacebook IdentityProviderUpdateParamsAccessYandexType = "facebook" + IdentityProviderUpdateParamsAccessYandexTypeGitHub IdentityProviderUpdateParamsAccessYandexType = "github" + IdentityProviderUpdateParamsAccessYandexTypeGoogleApps IdentityProviderUpdateParamsAccessYandexType = "google-apps" + IdentityProviderUpdateParamsAccessYandexTypeGoogle IdentityProviderUpdateParamsAccessYandexType = "google" + IdentityProviderUpdateParamsAccessYandexTypeLinkedin IdentityProviderUpdateParamsAccessYandexType = "linkedin" + IdentityProviderUpdateParamsAccessYandexTypeOidc IdentityProviderUpdateParamsAccessYandexType = "oidc" + IdentityProviderUpdateParamsAccessYandexTypeOkta IdentityProviderUpdateParamsAccessYandexType = "okta" + IdentityProviderUpdateParamsAccessYandexTypeOnelogin IdentityProviderUpdateParamsAccessYandexType = "onelogin" + IdentityProviderUpdateParamsAccessYandexTypePingone IdentityProviderUpdateParamsAccessYandexType = "pingone" + IdentityProviderUpdateParamsAccessYandexTypeYandex IdentityProviderUpdateParamsAccessYandexType = "yandex" ) -func (r IdentityProviderUpdateParamsConfigPrompt) IsKnown() bool { +func (r IdentityProviderUpdateParamsAccessYandexType) IsKnown() bool { switch r { - case IdentityProviderUpdateParamsConfigPromptLogin, IdentityProviderUpdateParamsConfigPromptSelectAccount, IdentityProviderUpdateParamsConfigPromptNone: + case IdentityProviderUpdateParamsAccessYandexTypeOnetimepin, IdentityProviderUpdateParamsAccessYandexTypeAzureAd, IdentityProviderUpdateParamsAccessYandexTypeSaml, IdentityProviderUpdateParamsAccessYandexTypeCentrify, IdentityProviderUpdateParamsAccessYandexTypeFacebook, IdentityProviderUpdateParamsAccessYandexTypeGitHub, IdentityProviderUpdateParamsAccessYandexTypeGoogleApps, IdentityProviderUpdateParamsAccessYandexTypeGoogle, IdentityProviderUpdateParamsAccessYandexTypeLinkedin, IdentityProviderUpdateParamsAccessYandexTypeOidc, IdentityProviderUpdateParamsAccessYandexTypeOkta, IdentityProviderUpdateParamsAccessYandexTypeOnelogin, IdentityProviderUpdateParamsAccessYandexTypePingone, IdentityProviderUpdateParamsAccessYandexTypeYandex: return true } return false } +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessYandexScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled param.Field[bool] `json:"enabled"` + // A flag to revoke a user's session in Access and force a reauthentication on the + // user's Gateway session when they have been added or removed from a group in the + // Identity Provider. + GroupMemberDeprovision param.Field[bool] `json:"group_member_deprovision"` + // A flag to remove a user's seat in Zero Trust when they have been deprovisioned + // in the Identity Provider. This cannot be enabled unless user_deprovision is also + // enabled. + SeatDeprovision param.Field[bool] `json:"seat_deprovision"` + // A read-only token generated when the SCIM integration is enabled for the first + // time. It is redacted on subsequent requests. If you lose this you will need to + // refresh it token at /access/identity_providers/:idpID/refresh_scim_secret. + Secret param.Field[string] `json:"secret"` + // A flag to enable revoking a user's session in Access and Gateway when they have + // been deprovisioned in the Identity Provider. + UserDeprovision param.Field[bool] `json:"user_deprovision"` +} + +func (r IdentityProviderUpdateParamsAccessYandexScimConfig) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderUpdateParamsAccessOnetimepin struct { + // The configuration parameters for the identity provider. To view the required + // parameters for a specific provider, refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Config param.Field[interface{}] `json:"config,required"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The type of identity provider. To determine the value for a specific provider, + // refer to our + // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + Type param.Field[IdentityProviderUpdateParamsAccessOnetimepinType] `json:"type,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"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[IdentityProviderUpdateParamsAccessOnetimepinScimConfig] `json:"scim_config"` +} + +func (r IdentityProviderUpdateParamsAccessOnetimepin) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderUpdateParamsAccessOnetimepin) getAccountID() param.Field[string] { + return r.AccountID +} + +func (r IdentityProviderUpdateParamsAccessOnetimepin) getZoneID() param.Field[string] { + return r.ZoneID +} + +func (IdentityProviderUpdateParamsAccessOnetimepin) ImplementsIdentityProviderUpdateParams() { + +} + // The type of identity provider. To determine the value for a specific provider, // refer to our // [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). -type IdentityProviderUpdateParamsType string +type IdentityProviderUpdateParamsAccessOnetimepinType string const ( - IdentityProviderUpdateParamsTypeOnetimepin IdentityProviderUpdateParamsType = "onetimepin" - IdentityProviderUpdateParamsTypeAzureAd IdentityProviderUpdateParamsType = "azureAD" - IdentityProviderUpdateParamsTypeSaml IdentityProviderUpdateParamsType = "saml" - IdentityProviderUpdateParamsTypeCentrify IdentityProviderUpdateParamsType = "centrify" - IdentityProviderUpdateParamsTypeFacebook IdentityProviderUpdateParamsType = "facebook" - IdentityProviderUpdateParamsTypeGitHub IdentityProviderUpdateParamsType = "github" - IdentityProviderUpdateParamsTypeGoogleApps IdentityProviderUpdateParamsType = "google-apps" - IdentityProviderUpdateParamsTypeGoogle IdentityProviderUpdateParamsType = "google" - IdentityProviderUpdateParamsTypeLinkedin IdentityProviderUpdateParamsType = "linkedin" - IdentityProviderUpdateParamsTypeOidc IdentityProviderUpdateParamsType = "oidc" - IdentityProviderUpdateParamsTypeOkta IdentityProviderUpdateParamsType = "okta" - IdentityProviderUpdateParamsTypeOnelogin IdentityProviderUpdateParamsType = "onelogin" - IdentityProviderUpdateParamsTypePingone IdentityProviderUpdateParamsType = "pingone" - IdentityProviderUpdateParamsTypeYandex IdentityProviderUpdateParamsType = "yandex" + IdentityProviderUpdateParamsAccessOnetimepinTypeOnetimepin IdentityProviderUpdateParamsAccessOnetimepinType = "onetimepin" + IdentityProviderUpdateParamsAccessOnetimepinTypeAzureAd IdentityProviderUpdateParamsAccessOnetimepinType = "azureAD" + IdentityProviderUpdateParamsAccessOnetimepinTypeSaml IdentityProviderUpdateParamsAccessOnetimepinType = "saml" + IdentityProviderUpdateParamsAccessOnetimepinTypeCentrify IdentityProviderUpdateParamsAccessOnetimepinType = "centrify" + IdentityProviderUpdateParamsAccessOnetimepinTypeFacebook IdentityProviderUpdateParamsAccessOnetimepinType = "facebook" + IdentityProviderUpdateParamsAccessOnetimepinTypeGitHub IdentityProviderUpdateParamsAccessOnetimepinType = "github" + IdentityProviderUpdateParamsAccessOnetimepinTypeGoogleApps IdentityProviderUpdateParamsAccessOnetimepinType = "google-apps" + IdentityProviderUpdateParamsAccessOnetimepinTypeGoogle IdentityProviderUpdateParamsAccessOnetimepinType = "google" + IdentityProviderUpdateParamsAccessOnetimepinTypeLinkedin IdentityProviderUpdateParamsAccessOnetimepinType = "linkedin" + IdentityProviderUpdateParamsAccessOnetimepinTypeOidc IdentityProviderUpdateParamsAccessOnetimepinType = "oidc" + IdentityProviderUpdateParamsAccessOnetimepinTypeOkta IdentityProviderUpdateParamsAccessOnetimepinType = "okta" + IdentityProviderUpdateParamsAccessOnetimepinTypeOnelogin IdentityProviderUpdateParamsAccessOnetimepinType = "onelogin" + IdentityProviderUpdateParamsAccessOnetimepinTypePingone IdentityProviderUpdateParamsAccessOnetimepinType = "pingone" + IdentityProviderUpdateParamsAccessOnetimepinTypeYandex IdentityProviderUpdateParamsAccessOnetimepinType = "yandex" ) -func (r IdentityProviderUpdateParamsType) IsKnown() bool { +func (r IdentityProviderUpdateParamsAccessOnetimepinType) IsKnown() bool { switch r { - case IdentityProviderUpdateParamsTypeOnetimepin, IdentityProviderUpdateParamsTypeAzureAd, IdentityProviderUpdateParamsTypeSaml, IdentityProviderUpdateParamsTypeCentrify, IdentityProviderUpdateParamsTypeFacebook, IdentityProviderUpdateParamsTypeGitHub, IdentityProviderUpdateParamsTypeGoogleApps, IdentityProviderUpdateParamsTypeGoogle, IdentityProviderUpdateParamsTypeLinkedin, IdentityProviderUpdateParamsTypeOidc, IdentityProviderUpdateParamsTypeOkta, IdentityProviderUpdateParamsTypeOnelogin, IdentityProviderUpdateParamsTypePingone, IdentityProviderUpdateParamsTypeYandex: + case IdentityProviderUpdateParamsAccessOnetimepinTypeOnetimepin, IdentityProviderUpdateParamsAccessOnetimepinTypeAzureAd, IdentityProviderUpdateParamsAccessOnetimepinTypeSaml, IdentityProviderUpdateParamsAccessOnetimepinTypeCentrify, IdentityProviderUpdateParamsAccessOnetimepinTypeFacebook, IdentityProviderUpdateParamsAccessOnetimepinTypeGitHub, IdentityProviderUpdateParamsAccessOnetimepinTypeGoogleApps, IdentityProviderUpdateParamsAccessOnetimepinTypeGoogle, IdentityProviderUpdateParamsAccessOnetimepinTypeLinkedin, IdentityProviderUpdateParamsAccessOnetimepinTypeOidc, IdentityProviderUpdateParamsAccessOnetimepinTypeOkta, IdentityProviderUpdateParamsAccessOnetimepinTypeOnelogin, IdentityProviderUpdateParamsAccessOnetimepinTypePingone, IdentityProviderUpdateParamsAccessOnetimepinTypeYandex: return true } return false } -type IdentityProviderUpdateParamsScimConfig struct { +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type IdentityProviderUpdateParamsAccessOnetimepinScimConfig struct { // A flag to enable or disable SCIM for the identity provider. Enabled param.Field[bool] `json:"enabled"` // A flag to revoke a user's session in Access and force a reauthentication on the @@ -4909,7 +7773,7 @@ type IdentityProviderUpdateParamsScimConfig struct { UserDeprovision param.Field[bool] `json:"user_deprovision"` } -func (r IdentityProviderUpdateParamsScimConfig) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderUpdateParamsAccessOnetimepinScimConfig) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } diff --git a/zero_trust/identityprovider_test.go b/zero_trust/identityprovider_test.go index 4cc03b41eba..23d3ef9623a 100644 --- a/zero_trust/identityprovider_test.go +++ b/zero_trust/identityprovider_test.go @@ -28,49 +28,22 @@ func TestIdentityProviderNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.ZeroTrust.IdentityProviders.New(context.TODO(), zero_trust.IdentityProviderNewParams{ - Config: cloudflare.F(zero_trust.IdentityProviderNewParamsConfig{ + _, err := client.ZeroTrust.IdentityProviders.New(context.TODO(), zero_trust.IdentityProviderNewParamsAccessAzureAd{ + Config: cloudflare.F(zero_trust.IdentityProviderNewParamsAccessAzureAdConfig{ ClientID: cloudflare.F(""), ClientSecret: cloudflare.F(""), Claims: cloudflare.F([]string{"email_verified", "preferred_username", "custom_claim_name"}), EmailClaimName: cloudflare.F("custom_claim_name"), ConditionalAccessEnabled: cloudflare.F(true), DirectoryID: cloudflare.F(""), - Prompt: cloudflare.F(zero_trust.IdentityProviderNewParamsConfigPromptLogin), + Prompt: cloudflare.F(zero_trust.IdentityProviderNewParamsAccessAzureAdConfigPromptLogin), SupportGroups: cloudflare.F(true), - CentrifyAccount: cloudflare.F("https://abc123.my.centrify.com/"), - CentrifyAppID: cloudflare.F("exampleapp"), - AppsDomain: cloudflare.F("mycompany.com"), - AuthURL: cloudflare.F("https://accounts.google.com/o/oauth2/auth"), - CERTsURL: cloudflare.F("https://www.googleapis.com/oauth2/v3/certs"), - Scopes: cloudflare.F([]string{"openid", "email", "profile"}), - TokenURL: cloudflare.F("https://accounts.google.com/o/oauth2/token"), - AuthorizationServerID: cloudflare.F("aus9o8wzkhckw9TLa0h7z"), - OktaAccount: cloudflare.F("https://dev-abc123.oktapreview.com"), - OneloginAccount: cloudflare.F("https://mycompany.onelogin.com"), - PingEnvID: cloudflare.F("342b5660-0c32-4936-a5a4-ce21fae57b0a"), - Attributes: cloudflare.F([]string{"group", "department_code", "divison"}), - EmailAttributeName: cloudflare.F("Email"), - HeaderAttributes: cloudflare.F([]zero_trust.IdentityProviderNewParamsConfigHeaderAttribute{{ - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }, { - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }, { - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }}), - IDPPublicCERTs: cloudflare.F([]string{"string", "string", "string"}), - IssuerURL: cloudflare.F("https://whoami.com"), - SignRequest: cloudflare.F(true), - SSOTargetURL: cloudflare.F("https://edgeaccess.org/idp/saml/login"), }), Name: cloudflare.F("Widget Corps IDP"), - Type: cloudflare.F(zero_trust.IdentityProviderNewParamsTypeOnetimepin), + Type: cloudflare.F(zero_trust.IdentityProviderNewParamsAccessAzureAdTypeOnetimepin), AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ScimConfig: cloudflare.F(zero_trust.IdentityProviderNewParamsScimConfig{ + ScimConfig: cloudflare.F(zero_trust.IdentityProviderNewParamsAccessAzureAdScimConfig{ Enabled: cloudflare.F(true), GroupMemberDeprovision: cloudflare.F(true), SeatDeprovision: cloudflare.F(true), @@ -104,49 +77,22 @@ func TestIdentityProviderUpdateWithOptionalParams(t *testing.T) { _, err := client.ZeroTrust.IdentityProviders.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - zero_trust.IdentityProviderUpdateParams{ - Config: cloudflare.F(zero_trust.IdentityProviderUpdateParamsConfig{ + zero_trust.IdentityProviderUpdateParamsAccessAzureAd{ + Config: cloudflare.F(zero_trust.IdentityProviderUpdateParamsAccessAzureAdConfig{ ClientID: cloudflare.F(""), ClientSecret: cloudflare.F(""), Claims: cloudflare.F([]string{"email_verified", "preferred_username", "custom_claim_name"}), EmailClaimName: cloudflare.F("custom_claim_name"), ConditionalAccessEnabled: cloudflare.F(true), DirectoryID: cloudflare.F(""), - Prompt: cloudflare.F(zero_trust.IdentityProviderUpdateParamsConfigPromptLogin), + Prompt: cloudflare.F(zero_trust.IdentityProviderUpdateParamsAccessAzureAdConfigPromptLogin), SupportGroups: cloudflare.F(true), - CentrifyAccount: cloudflare.F("https://abc123.my.centrify.com/"), - CentrifyAppID: cloudflare.F("exampleapp"), - AppsDomain: cloudflare.F("mycompany.com"), - AuthURL: cloudflare.F("https://accounts.google.com/o/oauth2/auth"), - CERTsURL: cloudflare.F("https://www.googleapis.com/oauth2/v3/certs"), - Scopes: cloudflare.F([]string{"openid", "email", "profile"}), - TokenURL: cloudflare.F("https://accounts.google.com/o/oauth2/token"), - AuthorizationServerID: cloudflare.F("aus9o8wzkhckw9TLa0h7z"), - OktaAccount: cloudflare.F("https://dev-abc123.oktapreview.com"), - OneloginAccount: cloudflare.F("https://mycompany.onelogin.com"), - PingEnvID: cloudflare.F("342b5660-0c32-4936-a5a4-ce21fae57b0a"), - Attributes: cloudflare.F([]string{"group", "department_code", "divison"}), - EmailAttributeName: cloudflare.F("Email"), - HeaderAttributes: cloudflare.F([]zero_trust.IdentityProviderUpdateParamsConfigHeaderAttribute{{ - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }, { - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }, { - AttributeName: cloudflare.F("string"), - HeaderName: cloudflare.F("string"), - }}), - IDPPublicCERTs: cloudflare.F([]string{"string", "string", "string"}), - IssuerURL: cloudflare.F("https://whoami.com"), - SignRequest: cloudflare.F(true), - SSOTargetURL: cloudflare.F("https://edgeaccess.org/idp/saml/login"), }), Name: cloudflare.F("Widget Corps IDP"), - Type: cloudflare.F(zero_trust.IdentityProviderUpdateParamsTypeOnetimepin), + Type: cloudflare.F(zero_trust.IdentityProviderUpdateParamsAccessAzureAdTypeOnetimepin), AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ScimConfig: cloudflare.F(zero_trust.IdentityProviderUpdateParamsScimConfig{ + ScimConfig: cloudflare.F(zero_trust.IdentityProviderUpdateParamsAccessAzureAdScimConfig{ Enabled: cloudflare.F(true), GroupMemberDeprovision: cloudflare.F(true), SeatDeprovision: cloudflare.F(true),