From 63baef8324adbf09013a9f3f06a31c970434b64c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:32:43 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#1730) --- accounts/account.go | 95 +- accounts/account_test.go | 14 +- accounts/aliases.go | 18 - accounts/member.go | 85 +- accounts/member_test.go | 18 +- accounts/role.go | 26 +- acm/aliases.go | 18 - addressing/addressmap.go | 4 +- addressing/addressmap_test.go | 2 +- addressing/addressmapaccount.go | 8 +- addressing/addressmapaccount_test.go | 4 +- addressing/addressmapip.go | 8 +- addressing/addressmapip_test.go | 4 +- addressing/addressmapzone.go | 8 +- addressing/addressmapzone_test.go | 4 +- addressing/aliases.go | 18 - addressing/prefix.go | 4 +- addressing/prefix_test.go | 2 +- addressing/prefixdelegation.go | 4 +- addressing/prefixdelegation_test.go | 2 +- alerting/aliases.go | 18 - aliases.go | 18 - api.md | 423 +- argo/aliases.go | 18 - argo/smartrouting.go | 52 +- argo/tieredcaching.go | 52 +- audit_logs/aliases.go | 18 - billing/aliases.go | 18 - billing/profile.go | 26 +- bot_management/aliases.go | 18 - bot_management/botmanagement.go | 276 +- bot_management/botmanagement_test.go | 10 +- brand_protection/aliases.go | 18 - cache/aliases.go | 18 - cache/cache.go | 121 +- cache/cache_test.go | 6 +- cache/cachereserve.go | 16 +- cache/cachereserve_test.go | 2 +- cache/smarttieredcache.go | 81 +- cache/smarttieredcache_test.go | 2 +- cache/variant.go | 36 +- cache/variant_test.go | 2 +- calls/aliases.go | 18 - certificate_authorities/aliases.go | 18 - .../hostnameassociation.go | 22 +- .../hostnameassociation_test.go | 8 +- challenges/aliases.go | 18 - client_certificates/aliases.go | 18 - cloudforce_one/aliases.go | 18 - cloudforce_one/requestpriority.go | 94 +- cloudforce_one/requestpriority_test.go | 20 +- custom_certificates/aliases.go | 18 - custom_certificates/customcertificate.go | 87 +- custom_certificates/customcertificate_test.go | 6 +- custom_hostnames/aliases.go | 18 - custom_hostnames/customhostname.go | 1364 ++++- custom_hostnames/customhostname_test.go | 14 +- custom_hostnames/fallbackorigin.go | 81 +- custom_hostnames/fallbackorigin_test.go | 2 +- custom_nameservers/aliases.go | 18 - custom_nameservers/customnameserver.go | 8 +- custom_nameservers/customnameserver_test.go | 4 +- d1/aliases.go | 18 - d1/database.go | 26 +- dcv_delegation/aliases.go | 18 - diagnostics/aliases.go | 18 - dns/aliases.go | 18 - dns/analyticsreport.go | 27 +- dns/analyticsreportbytime.go | 8 +- dns/dns.go | 72 +- dns/firewall.go | 58 +- dns/firewall_test.go | 34 +- dns/record.go | 5195 ++++------------- dns/record_test.go | 64 +- dnssec/aliases.go | 18 - dnssec/dnssec.go | 4 +- dnssec/dnssec_test.go | 2 +- durable_objects/aliases.go | 18 - email_routing/aliases.go | 18 - email_routing/emailrouting.go | 5 +- email_routing/emailrouting_test.go | 4 +- filters/aliases.go | 18 - filters/filter.go | 6 +- filters/filter_test.go | 6 +- firewall/accessrule.go | 79 +- firewall/accessrule_test.go | 2 +- firewall/aliases.go | 18 - firewall/lockdown.go | 6 +- firewall/lockdown_test.go | 6 +- firewall/rule.go | 6 +- firewall/rule_test.go | 6 +- firewall/uarule.go | 81 +- firewall/uarule_test.go | 6 +- firewall/wafoverride.go | 6 +- firewall/wafoverride_test.go | 6 +- firewall/wafpackagegroup.go | 52 +- firewall/wafpackagerule.go | 25 +- healthchecks/aliases.go | 18 - healthchecks/healthcheck.go | 162 +- healthchecks/healthcheck_test.go | 198 +- healthchecks/preview.go | 43 +- healthchecks/preview_test.go | 68 +- hostnames/aliases.go | 18 - hyperdrive/aliases.go | 18 - hyperdrive/config.go | 27 +- images/aliases.go | 18 - images/v1.go | 28 +- images/v1_test.go | 2 +- images/v1variant.go | 31 +- images/v1variant_test.go | 2 +- intel/aliases.go | 18 - internal/shared/shared.go | 69 - internal/shared/union.go | 124 +- ips/aliases.go | 18 - keyless_certificates/aliases.go | 18 - keyless_certificates/keylesscertificate.go | 6 +- .../keylesscertificate_test.go | 4 +- kv/aliases.go | 18 - kv/namespace.go | 4 +- kv/namespace_test.go | 2 +- kv/namespacebulk.go | 8 +- kv/namespacebulk_test.go | 6 +- kv/namespacevalue.go | 4 +- kv/namespacevalue_test.go | 2 +- load_balancers/aliases.go | 18 - load_balancers/loadbalancer.go | 4 +- load_balancers/loadbalancer_test.go | 2 +- load_balancers/monitor.go | 4 +- load_balancers/monitor_test.go | 2 +- load_balancers/pool.go | 4 +- load_balancers/pool_test.go | 2 +- load_balancers/region.go | 25 +- logpush/aliases.go | 18 - logpush/job.go | 2 +- logpush/job_test.go | 2 +- logs/aliases.go | 18 - logs/controlcmbconfig.go | 18 +- logs/controlcmbconfig_test.go | 6 +- magic_network_monitoring/aliases.go | 18 - magic_network_monitoring/config.go | 16 +- magic_network_monitoring/config_test.go | 8 +- magic_network_monitoring/rule.go | 16 +- magic_network_monitoring/rule_test.go | 8 +- magic_network_monitoring/ruleadvertisement.go | 4 +- .../ruleadvertisement_test.go | 2 +- magic_transit/aliases.go | 18 - magic_transit/gretunnel.go | 8 +- magic_transit/gretunnel_test.go | 4 +- magic_transit/ipsectunnel.go | 8 +- magic_transit/ipsectunnel_test.go | 4 +- magic_transit/route.go | 8 +- magic_transit/route_test.go | 4 +- magic_transit/site.go | 4 +- magic_transit/site_test.go | 2 +- magic_transit/siteacl.go | 24 +- magic_transit/siteacl_test.go | 2 +- magic_transit/sitelan.go | 4 +- magic_transit/sitelan_test.go | 2 +- magic_transit/sitewan.go | 4 +- magic_transit/sitewan_test.go | 2 +- managed_headers/aliases.go | 18 - memberships/aliases.go | 18 - memberships/membership.go | 54 +- memberships/membership_test.go | 2 +- mtls_certificates/aliases.go | 18 - mtls_certificates/mtlscertificate.go | 4 +- mtls_certificates/mtlscertificate_test.go | 2 +- origin_ca_certificates/aliases.go | 18 - origin_ca_certificates/origincacertificate.go | 56 +- .../origincacertificate_test.go | 2 +- origin_post_quantum_encryption/aliases.go | 18 - .../originpostquantumencryption.go | 54 +- origin_tls_client_auth/aliases.go | 18 - origin_tls_client_auth/hostnamecertificate.go | 4 +- .../hostnamecertificate_test.go | 2 +- origin_tls_client_auth/origintlsclientauth.go | 84 +- .../origintlsclientauth_test.go | 2 +- page_shield/aliases.go | 18 - pagerules/aliases.go | 18 - pagerules/pagerule.go | 106 +- pagerules/pagerule_test.go | 2 +- pages/aliases.go | 18 - pages/project.go | 590 +- pages/project_test.go | 274 +- pages/projectdeployment.go | 12 +- pages/projectdeployment_test.go | 6 +- pages/projectdomain.go | 12 +- pages/projectdomain_test.go | 8 +- pcaps/aliases.go | 18 - pcaps/pcap.go | 144 +- pcaps/pcap_test.go | 28 +- plans/aliases.go | 18 - queues/aliases.go | 18 - queues/consumer.go | 12 +- queues/consumer_test.go | 10 +- queues/queue.go | 12 +- queues/queue_test.go | 10 +- r2/aliases.go | 18 - r2/sippy.go | 103 +- r2/sippy_test.go | 28 +- radar/aliases.go | 18 - rate_limits/aliases.go | 18 - rate_limits/ratelimit.go | 83 +- rate_limits/ratelimit_test.go | 6 +- rate_plans/aliases.go | 18 - registrar/aliases.go | 18 - request_tracers/aliases.go | 18 - rules/aliases.go | 18 - rules/list.go | 4 +- rules/list_test.go | 2 +- rules/listitem.go | 8 +- rules/listitem_test.go | 8 +- rulesets/aliases.go | 18 - rulesets/phase.go | 7 +- rulesets/phase_test.go | 7 +- rulesets/phaseversion.go | 3 +- rulesets/rule.go | 1367 +---- rulesets/rule_test.go | 39 +- rulesets/ruleset.go | 11 +- rulesets/ruleset_test.go | 13 +- rulesets/version.go | 3 +- rulesets/versionbytag.go | 3 +- rum/aliases.go | 18 - secondary_dns/acl.go | 34 +- secondary_dns/acl_test.go | 10 +- secondary_dns/aliases.go | 18 - secondary_dns/forceaxfr.go | 4 +- secondary_dns/forceaxfr_test.go | 2 +- secondary_dns/incoming.go | 4 +- secondary_dns/incoming_test.go | 2 +- secondary_dns/outgoing.go | 16 +- secondary_dns/outgoing_test.go | 8 +- secondary_dns/peer.go | 50 +- secondary_dns/peer_test.go | 18 +- secondary_dns/tsig.go | 35 +- secondary_dns/tsig_test.go | 18 +- snippets/aliases.go | 18 - spectrum/aliases.go | 18 - spectrum/app.go | 28 +- spectrum/app_test.go | 2 +- speed/aliases.go | 18 - ssl/aliases.go | 18 - ssl/analyze.go | 28 +- ssl/analyze_test.go | 2 +- ssl/certificatepack.go | 35 +- ssl/certificatepack_test.go | 4 +- ssl/universalsetting.go | 16 +- ssl/universalsetting_test.go | 6 +- storage/aliases.go | 18 - stream/aliases.go | 18 - stream/caption.go | 29 +- stream/caption_test.go | 2 +- stream/download.go | 52 +- stream/download_test.go | 2 +- stream/key.go | 8 +- stream/key_test.go | 4 +- stream/liveinput.go | 4 +- stream/liveinput_test.go | 2 +- stream/liveinputoutput.go | 4 +- stream/liveinputoutput_test.go | 2 +- stream/stream.go | 8 +- stream/stream_test.go | 4 +- stream/watermark.go | 52 +- stream/watermark_test.go | 2 +- stream/webhook.go | 53 +- stream/webhook_test.go | 2 +- subscriptions/aliases.go | 18 - subscriptions/subscription.go | 246 +- subscriptions/subscription_test.go | 127 +- url_normalization/aliases.go | 18 - url_scanner/aliases.go | 18 - user/aliases.go | 18 - user/billingprofile.go | 27 +- user/invite.go | 50 +- user/organization.go | 29 +- user/organization_test.go | 2 +- user/subscription.go | 239 +- user/subscription_test.go | 126 +- user/token.go | 52 +- user/token_test.go | 2 +- user/tokenvalue.go | 3 +- user/tokenvalue_test.go | 2 +- user/user.go | 50 +- vectorize/aliases.go | 18 - vectorize/index.go | 31 +- vectorize/index_test.go | 4 +- waiting_rooms/aliases.go | 18 - waiting_rooms/event.go | 154 +- waiting_rooms/event_test.go | 92 +- waiting_rooms/eventdetail.go | 52 + waiting_rooms/rule.go | 8 +- waiting_rooms/rule_test.go | 6 +- waiting_rooms/waitingroom.go | 1154 +--- waiting_rooms/waitingroom_test.go | 194 +- warp_connector/aliases.go | 18 - warp_connector/warpconnector.go | 4 +- warp_connector/warpconnector_test.go | 2 +- web3/aliases.go | 18 - web3/hostname.go | 2 +- web3/hostname_test.go | 2 +- ...stnameipfsuniversalpathcontentlistentry.go | 2 +- ...eipfsuniversalpathcontentlistentry_test.go | 2 +- workers/accountsetting.go | 2 +- workers/accountsetting_test.go | 2 +- workers/ai.go | 252 +- workers/ai_test.go | 6 +- workers/aliases.go | 18 - workers/domain.go | 4 +- workers/domain_test.go | 2 +- workers/script.go | 131 +- workers/script_test.go | 124 +- workers/scriptcontent.go | 6 +- workers/scriptcontent_test.go | 3 +- workers/scriptschedule.go | 2 +- workers/scriptschedule_test.go | 2 +- workers/scriptsetting.go | 9 +- workers/scriptsetting_test.go | 30 +- workers/scripttail.go | 8 +- workers/scripttail_test.go | 4 +- workers/subdomain.go | 2 +- workers/subdomain_test.go | 2 +- workers/worker.go | 24 +- workers_for_platforms/aliases.go | 18 - .../dispatchnamespacescript.go | 117 +- .../dispatchnamespacescript_test.go | 122 +- .../dispatchnamespacescriptcontent.go | 6 +- .../dispatchnamespacescriptcontent_test.go | 4 +- zero_trust/accessapplication.go | 1924 ++---- zero_trust/accessapplication_test.go | 136 +- zero_trust/accessapplicationca.go | 52 +- zero_trust/accessbookmark.go | 7 +- zero_trust/accessbookmark_test.go | 6 +- zero_trust/accesscustompage.go | 69 +- zero_trust/accesscustompage_test.go | 20 +- zero_trust/aliases.go | 18 - zero_trust/device.go | 27 +- zero_trust/devicedextest.go | 54 +- zero_trust/devicedextest_test.go | 96 +- zero_trust/devicenetwork.go | 4 +- zero_trust/devicenetwork_test.go | 2 +- zero_trust/devicepolicy.go | 4 +- zero_trust/devicepolicy_test.go | 2 +- zero_trust/devicepolicyexclude.go | 4 +- zero_trust/devicepolicyexclude_test.go | 4 +- zero_trust/devicepolicyfallbackdomain.go | 4 +- zero_trust/devicepolicyfallbackdomain_test.go | 4 +- zero_trust/devicepolicyinclude.go | 4 +- zero_trust/devicepolicyinclude_test.go | 4 +- zero_trust/deviceposture.go | 4 +- zero_trust/deviceposture_test.go | 2 +- zero_trust/devicepostureintegration.go | 31 +- zero_trust/devicepostureintegration_test.go | 2 +- zero_trust/devicerevoke.go | 29 +- zero_trust/devicerevoke_test.go | 2 +- zero_trust/devicesetting.go | 14 +- zero_trust/devicesetting_test.go | 12 +- zero_trust/deviceunrevoke.go | 29 +- zero_trust/deviceunrevoke_test.go | 2 +- zero_trust/dlpdatasetupload.go | 4 +- zero_trust/dlpdatasetupload_test.go | 2 +- zero_trust/dlpprofilecustom.go | 4 +- zero_trust/dlpprofilecustom_test.go | 2 +- zero_trust/gatewaylist.go | 31 +- zero_trust/gatewaylist_test.go | 2 +- zero_trust/gatewaylocation.go | 31 +- zero_trust/gatewaylocation_test.go | 2 +- zero_trust/gatewaylogging.go | 22 +- zero_trust/gatewaylogging_test.go | 14 +- zero_trust/gatewayproxyendpoint.go | 31 +- zero_trust/gatewayproxyendpoint_test.go | 2 +- zero_trust/gatewayrule.go | 31 +- zero_trust/gatewayrule_test.go | 2 +- zero_trust/identityprovider.go | 3193 ++++------ zero_trust/identityprovider_test.go | 84 +- zero_trust/networkvirtualnetwork.go | 4 +- zero_trust/networkvirtualnetwork_test.go | 2 +- zero_trust/seat.go | 2 +- zero_trust/seat_test.go | 4 +- zero_trust/tunnel.go | 4 +- zero_trust/tunnel_test.go | 2 +- zero_trust/tunnelconnection.go | 4 +- zero_trust/tunnelconnection_test.go | 2 +- zones/aliases.go | 18 - zones/dnssetting.go | 16 +- zones/dnssetting_test.go | 8 +- zones/subscription.go | 126 +- zones/subscription_test.go | 63 +- 387 files changed, 9644 insertions(+), 15223 deletions(-) diff --git a/accounts/account.go b/accounts/account.go index d69ca4d8827..2c5c9edd162 100644 --- a/accounts/account.go +++ b/accounts/account.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,6 +17,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // AccountService contains methods and other services that help with interacting @@ -40,7 +42,7 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) { } // Update an existing account. -func (r *AccountService) Update(ctx context.Context, params AccountUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccountService) Update(ctx context.Context, params AccountUpdateParams, opts ...option.RequestOption) (res *AccountUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccountUpdateResponseEnvelope path := fmt.Sprintf("accounts/%v", params.AccountID) @@ -76,7 +78,7 @@ func (r *AccountService) ListAutoPaging(ctx context.Context, query AccountListPa } // Get information about a specific account that you are a member of. -func (r *AccountService) Get(ctx context.Context, query AccountGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccountService) Get(ctx context.Context, query AccountGetParams, opts ...option.RequestOption) (res *AccountGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccountGetResponseEnvelope path := fmt.Sprintf("accounts/%v", query.AccountID) @@ -185,22 +187,19 @@ func (r AccountSettingsDefaultNameservers) IsKnown() bool { return false } -type AccountListResponse = interface{} - -type AccountUpdateParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` +type AccountParam struct { // Account name Name param.Field[string] `json:"name,required"` // Account settings - Settings param.Field[AccountUpdateParamsSettings] `json:"settings"` + Settings param.Field[AccountSettingsParam] `json:"settings"` } -func (r AccountUpdateParams) MarshalJSON() (data []byte, err error) { +func (r AccountParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Account settings -type AccountUpdateParamsSettings struct { +type AccountSettingsParam struct { // Specifies the default nameservers to be used for new zones added to this // account. // @@ -211,7 +210,7 @@ type AccountUpdateParamsSettings struct { // See // [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) // for more information. - DefaultNameservers param.Field[AccountUpdateParamsSettingsDefaultNameservers] `json:"default_nameservers"` + DefaultNameservers param.Field[AccountSettingsDefaultNameservers] `json:"default_nameservers"` // Indicates whether membership in this account requires that Two-Factor // Authentication is enabled EnforceTwofactor param.Field[bool] `json:"enforce_twofactor"` @@ -222,40 +221,58 @@ type AccountUpdateParamsSettings struct { UseAccountCustomNSByDefault param.Field[bool] `json:"use_account_custom_ns_by_default"` } -func (r AccountUpdateParamsSettings) MarshalJSON() (data []byte, err error) { +func (r AccountSettingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Specifies the default nameservers to be used for new zones added to this -// account. -// -// - `cloudflare.standard` for Cloudflare-branded nameservers -// - `custom.account` for account custom nameservers -// - `custom.tenant` for tenant custom nameservers -// -// See -// [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) -// for more information. -type AccountUpdateParamsSettingsDefaultNameservers string +// Union satisfied by [accounts.AccountUpdateResponseUnknown] or +// [shared.UnionString]. +type AccountUpdateResponseUnion interface { + ImplementsAccountsAccountUpdateResponseUnion() +} -const ( - AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard AccountUpdateParamsSettingsDefaultNameservers = "cloudflare.standard" - AccountUpdateParamsSettingsDefaultNameserversCustomAccount AccountUpdateParamsSettingsDefaultNameservers = "custom.account" - AccountUpdateParamsSettingsDefaultNameserversCustomTenant AccountUpdateParamsSettingsDefaultNameservers = "custom.tenant" -) +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} -func (r AccountUpdateParamsSettingsDefaultNameservers) IsKnown() bool { - switch r { - case AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard, AccountUpdateParamsSettingsDefaultNameserversCustomAccount, AccountUpdateParamsSettingsDefaultNameserversCustomTenant: - return true - } - return false +type AccountListResponse = interface{} + +// Union satisfied by [accounts.AccountGetResponseUnknown] or [shared.UnionString]. +type AccountGetResponseUnion interface { + ImplementsAccountsAccountGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccountGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type AccountUpdateParams struct { + AccountID param.Field[interface{}] `path:"account_id,required"` + Account AccountParam `json:"account,required"` +} + +func (r AccountUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Account) } type AccountUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccountUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success AccountUpdateResponseEnvelopeSuccess `json:"success,required"` JSON accountUpdateResponseEnvelopeJSON `json:"-"` @@ -335,9 +352,9 @@ type AccountGetParams struct { } type AccountGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccountGetResponseUnion `json:"result,required"` // Whether the API call was successful Success AccountGetResponseEnvelopeSuccess `json:"success,required"` JSON accountGetResponseEnvelopeJSON `json:"-"` diff --git a/accounts/account_test.go b/accounts/account_test.go index 200d595b12f..498f9e3410f 100644 --- a/accounts/account_test.go +++ b/accounts/account_test.go @@ -30,12 +30,14 @@ func TestAccountUpdateWithOptionalParams(t *testing.T) { ) _, err := client.Accounts.Update(context.TODO(), accounts.AccountUpdateParams{ AccountID: cloudflare.F[any](map[string]interface{}{}), - Name: cloudflare.F("Demo Account"), - Settings: cloudflare.F(accounts.AccountUpdateParamsSettings{ - DefaultNameservers: cloudflare.F(accounts.AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard), - EnforceTwofactor: cloudflare.F(true), - UseAccountCustomNSByDefault: cloudflare.F(true), - }), + Account: accounts.AccountParam{ + Name: cloudflare.F("Demo Account"), + Settings: cloudflare.F(accounts.AccountSettingsParam{ + DefaultNameservers: cloudflare.F(accounts.AccountSettingsDefaultNameserversCloudflareStandard), + EnforceTwofactor: cloudflare.F(true), + UseAccountCustomNSByDefault: cloudflare.F(true), + }), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/accounts/aliases.go b/accounts/aliases.go index 1a132996d4e..b9759132dbc 100644 --- a/accounts/aliases.go +++ b/accounts/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/accounts/member.go b/accounts/member.go index c87849e4c3e..3c7d5708b3b 100644 --- a/accounts/member.go +++ b/accounts/member.go @@ -244,6 +244,56 @@ func (r memberUserJSON) RawJSON() string { return r.raw } +type MemberParam struct { + // Roles assigned to this member. + Roles param.Field[[]MemberRoleParam] `json:"roles,required"` +} + +func (r MemberParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MemberRoleParam struct { + // Role identifier tag. + ID param.Field[string] `json:"id,required"` +} + +func (r MemberRoleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MemberRolesPermissionsParam struct { + Analytics param.Field[PermissionGrantParam] `json:"analytics"` + Billing param.Field[PermissionGrantParam] `json:"billing"` + CachePurge param.Field[PermissionGrantParam] `json:"cache_purge"` + DNS param.Field[PermissionGrantParam] `json:"dns"` + DNSRecords param.Field[PermissionGrantParam] `json:"dns_records"` + Lb param.Field[PermissionGrantParam] `json:"lb"` + Logs param.Field[PermissionGrantParam] `json:"logs"` + Organization param.Field[PermissionGrantParam] `json:"organization"` + SSL param.Field[PermissionGrantParam] `json:"ssl"` + WAF param.Field[PermissionGrantParam] `json:"waf"` + ZoneSettings param.Field[PermissionGrantParam] `json:"zone_settings"` + Zones param.Field[PermissionGrantParam] `json:"zones"` +} + +func (r MemberRolesPermissionsParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MemberUserParam struct { + // The contact email address of the user. + Email param.Field[string] `json:"email,required"` + // User's first name + FirstName param.Field[string] `json:"first_name"` + // User's last name + LastName param.Field[string] `json:"last_name"` +} + +func (r MemberUserParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type MemberWithInviteCode struct { // Membership identifier tag. ID string `json:"id,required"` @@ -560,40 +610,11 @@ func (r MemberNewResponseEnvelopeSuccess) IsKnown() bool { type MemberUpdateParams struct { AccountID param.Field[interface{}] `path:"account_id,required"` - // Roles assigned to this member. - Roles param.Field[[]MemberUpdateParamsRole] `json:"roles,required"` + Member MemberParam `json:"member,required"` } func (r MemberUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MemberUpdateParamsRole struct { - // Role identifier tag. - ID param.Field[string] `json:"id,required"` -} - -func (r MemberUpdateParamsRole) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MemberUpdateParamsRolesPermissions struct { - Analytics param.Field[PermissionGrantParam] `json:"analytics"` - Billing param.Field[PermissionGrantParam] `json:"billing"` - CachePurge param.Field[PermissionGrantParam] `json:"cache_purge"` - DNS param.Field[PermissionGrantParam] `json:"dns"` - DNSRecords param.Field[PermissionGrantParam] `json:"dns_records"` - Lb param.Field[PermissionGrantParam] `json:"lb"` - Logs param.Field[PermissionGrantParam] `json:"logs"` - Organization param.Field[PermissionGrantParam] `json:"organization"` - SSL param.Field[PermissionGrantParam] `json:"ssl"` - WAF param.Field[PermissionGrantParam] `json:"waf"` - ZoneSettings param.Field[PermissionGrantParam] `json:"zone_settings"` - Zones param.Field[PermissionGrantParam] `json:"zones"` -} - -func (r MemberUpdateParamsRolesPermissions) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.Member) } type MemberUpdateResponseEnvelope struct { @@ -714,7 +735,7 @@ func (r MemberListParamsStatus) IsKnown() bool { type MemberDeleteParams struct { AccountID param.Field[interface{}] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r MemberDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/accounts/member_test.go b/accounts/member_test.go index 8bd5143efdf..99eaf4bf67e 100644 --- a/accounts/member_test.go +++ b/accounts/member_test.go @@ -62,13 +62,15 @@ func TestMemberUpdate(t *testing.T) { "4536bcfad5faccb111b47003c79917fa", accounts.MemberUpdateParams{ AccountID: cloudflare.F[any](map[string]interface{}{}), - Roles: cloudflare.F([]accounts.MemberUpdateParamsRole{{ - ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), - }, { - ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), - }, { - ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), - }}), + Member: accounts.MemberParam{ + Roles: cloudflare.F([]accounts.MemberRoleParam{{ + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + }, { + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + }, { + ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), + }}), + }, }, ) if err != nil { @@ -130,7 +132,7 @@ func TestMemberDelete(t *testing.T) { "4536bcfad5faccb111b47003c79917fa", accounts.MemberDeleteParams{ AccountID: cloudflare.F[any](map[string]interface{}{}), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/accounts/role.go b/accounts/role.go index b37b0faa5ee..aa97a07bfaf 100644 --- a/accounts/role.go +++ b/accounts/role.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/user" + "github.com/tidwall/gjson" ) // RoleService contains methods and other services that help with interacting with @@ -57,7 +59,7 @@ func (r *RoleService) ListAutoPaging(ctx context.Context, query RoleListParams, } // Get information about a specific role for an account. -func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGetParams, opts ...option.RequestOption) (res *RoleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RoleGetResponseEnvelope path := fmt.Sprintf("accounts/%v/roles/%v", query.AccountID, roleID) @@ -131,6 +133,22 @@ func (r roleListResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [accounts.RoleGetResponseUnknown] or [shared.UnionString]. +type RoleGetResponseUnion interface { + ImplementsAccountsRoleGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RoleGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type RoleListParams struct { AccountID param.Field[interface{}] `path:"account_id,required"` } @@ -140,9 +158,9 @@ type RoleGetParams struct { } type RoleGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result RoleGetResponseUnion `json:"result,required"` // Whether the API call was successful Success RoleGetResponseEnvelopeSuccess `json:"success,required"` JSON roleGetResponseEnvelopeJSON `json:"-"` diff --git a/acm/aliases.go b/acm/aliases.go index 3c8070788e1..cfa1e0a4275 100644 --- a/acm/aliases.go +++ b/acm/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/addressing/addressmap.go b/addressing/addressmap.go index b7d42ee8e73..83e28d9eea9 100644 --- a/addressing/addressmap.go +++ b/addressing/addressmap.go @@ -507,8 +507,8 @@ type AddressMapListParams struct { type AddressMapDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/addressmap_test.go b/addressing/addressmap_test.go index f7f303a5060..301c5faef90 100644 --- a/addressing/addressmap_test.go +++ b/addressing/addressmap_test.go @@ -87,7 +87,7 @@ func TestAddressMapDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/addressmapaccount.go b/addressing/addressmapaccount.go index 28ce40d4bcf..1559ef6fe0c 100644 --- a/addressing/addressmapaccount.go +++ b/addressing/addressmapaccount.go @@ -114,8 +114,8 @@ func (r AddressMapAccountDeleteResponseArray) ImplementsAddressingAddressMapAcco type AddressMapAccountUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapAccountUpdateParams) MarshalJSON() (data []byte, err error) { @@ -200,8 +200,8 @@ func (r addressMapAccountUpdateResponseEnvelopeResultInfoJSON) RawJSON() string type AddressMapAccountDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapAccountDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/addressmapaccount_test.go b/addressing/addressmapaccount_test.go index 973b2494f12..697d6f70988 100644 --- a/addressing/addressmapaccount_test.go +++ b/addressing/addressmapaccount_test.go @@ -33,7 +33,7 @@ func TestAddressMapAccountUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapAccountUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -64,7 +64,7 @@ func TestAddressMapAccountDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapAccountDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/addressmapip.go b/addressing/addressmapip.go index fc8e0808868..8fb1b5cf7b1 100644 --- a/addressing/addressmapip.go +++ b/addressing/addressmapip.go @@ -112,8 +112,8 @@ func (r AddressMapIPDeleteResponseArray) ImplementsAddressingAddressMapIPDeleteR type AddressMapIPUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapIPUpdateParams) MarshalJSON() (data []byte, err error) { @@ -198,8 +198,8 @@ func (r addressMapIPUpdateResponseEnvelopeResultInfoJSON) RawJSON() string { type AddressMapIPDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapIPDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/addressmapip_test.go b/addressing/addressmapip_test.go index b6968ebcb54..4f0c3ebe7d3 100644 --- a/addressing/addressmapip_test.go +++ b/addressing/addressmapip_test.go @@ -34,7 +34,7 @@ func TestAddressMapIPUpdate(t *testing.T) { "192.0.2.1", addressing.AddressMapIPUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -66,7 +66,7 @@ func TestAddressMapIPDelete(t *testing.T) { "192.0.2.1", addressing.AddressMapIPDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/addressmapzone.go b/addressing/addressmapzone.go index 0c108188ee5..399d72e74fe 100644 --- a/addressing/addressmapzone.go +++ b/addressing/addressmapzone.go @@ -114,8 +114,8 @@ type AddressMapZoneUpdateParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapZoneUpdateParams) MarshalJSON() (data []byte, err error) { @@ -202,8 +202,8 @@ type AddressMapZoneDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r AddressMapZoneDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/addressmapzone_test.go b/addressing/addressmapzone_test.go index 18396112e66..4268fa43c9d 100644 --- a/addressing/addressmapzone_test.go +++ b/addressing/addressmapzone_test.go @@ -34,7 +34,7 @@ func TestAddressMapZoneUpdate(t *testing.T) { addressing.AddressMapZoneUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -66,7 +66,7 @@ func TestAddressMapZoneDelete(t *testing.T) { addressing.AddressMapZoneDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/aliases.go b/addressing/aliases.go index 55104654748..d80577d3bda 100644 --- a/addressing/aliases.go +++ b/addressing/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/addressing/prefix.go b/addressing/prefix.go index 7abace874da..8de13ef17d9 100644 --- a/addressing/prefix.go +++ b/addressing/prefix.go @@ -263,8 +263,8 @@ type PrefixListParams struct { type PrefixDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r PrefixDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/prefix_test.go b/addressing/prefix_test.go index a1c7160017c..7cee67a6a5d 100644 --- a/addressing/prefix_test.go +++ b/addressing/prefix_test.go @@ -88,7 +88,7 @@ func TestPrefixDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/prefixdelegation.go b/addressing/prefixdelegation.go index 3116dbd4159..79d1f536dc0 100644 --- a/addressing/prefixdelegation.go +++ b/addressing/prefixdelegation.go @@ -202,8 +202,8 @@ type PrefixDelegationListParams struct { type PrefixDelegationDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r PrefixDelegationDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/addressing/prefixdelegation_test.go b/addressing/prefixdelegation_test.go index 55309b63816..670d919c955 100644 --- a/addressing/prefixdelegation_test.go +++ b/addressing/prefixdelegation_test.go @@ -96,7 +96,7 @@ func TestPrefixDelegationDelete(t *testing.T) { "d933b1530bc56c9953cf8ce166da8004", addressing.PrefixDelegationDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/alerting/aliases.go b/alerting/aliases.go index 606cca63253..5497f611d38 100644 --- a/alerting/aliases.go +++ b/alerting/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/aliases.go b/aliases.go index 48986a3a1fc..2da909ed08c 100644 --- a/aliases.go +++ b/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/api.md b/api.md index afef3080fa9..80fa623e48c 100644 --- a/api.md +++ b/api.md @@ -1,31 +1,37 @@ # Shared Params Types - shared.ResponseInfoParam -- shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam -- shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param # Shared Response Types - shared.ErrorData - shared.ResponseInfo -- shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c -- shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion # Accounts +Params Types: + +- accounts.AccountParam + Response Types: - accounts.Account +- accounts.AccountUpdateResponseUnion - accounts.AccountListResponse +- accounts.AccountGetResponseUnion Methods: -- client.Accounts.Update(ctx context.Context, params accounts.AccountUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Accounts.Update(ctx context.Context, params accounts.AccountUpdateParams) (accounts.AccountUpdateResponseUnion, error) - client.Accounts.List(ctx context.Context, query accounts.AccountListParams) (pagination.V4PagePaginationArray[accounts.AccountListResponse], error) -- client.Accounts.Get(ctx context.Context, query accounts.AccountGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Accounts.Get(ctx context.Context, query accounts.AccountGetParams) (accounts.AccountGetResponseUnion, error) ## Members +Params Types: + +- accounts.MemberParam + Response Types: - accounts.Member @@ -52,25 +58,28 @@ Response Types: - accounts.PermissionGrant - accounts.RoleListResponse +- accounts.RoleGetResponseUnion Methods: - client.Accounts.Roles.List(ctx context.Context, query accounts.RoleListParams) (pagination.SinglePage[accounts.RoleListResponse], error) -- client.Accounts.Roles.Get(ctx context.Context, roleID interface{}, query accounts.RoleGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Accounts.Roles.Get(ctx context.Context, roleID interface{}, query accounts.RoleGetParams) (accounts.RoleGetResponseUnion, error) # OriginCACertificates Response Types: - origin_ca_certificates.OriginCACertificate +- origin_ca_certificates.OriginCACertificateNewResponseUnion - origin_ca_certificates.OriginCACertificateDeleteResponse +- origin_ca_certificates.OriginCACertificateGetResponseUnion Methods: -- client.OriginCACertificates.New(ctx context.Context, body origin_ca_certificates.OriginCACertificateNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.OriginCACertificates.New(ctx context.Context, body origin_ca_certificates.OriginCACertificateNewParams) (origin_ca_certificates.OriginCACertificateNewResponseUnion, error) - client.OriginCACertificates.List(ctx context.Context, query origin_ca_certificates.OriginCACertificateListParams) (pagination.SinglePage[origin_ca_certificates.OriginCACertificate], error) - client.OriginCACertificates.Delete(ctx context.Context, certificateID string, body origin_ca_certificates.OriginCACertificateDeleteParams) (origin_ca_certificates.OriginCACertificateDeleteResponse, error) -- client.OriginCACertificates.Get(ctx context.Context, certificateID string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.OriginCACertificates.Get(ctx context.Context, certificateID string) (origin_ca_certificates.OriginCACertificateGetResponseUnion, error) # IPs @@ -89,21 +98,28 @@ Methods: Response Types: - memberships.Membership +- memberships.MembershipUpdateResponseUnion - memberships.MembershipDeleteResponse +- memberships.MembershipGetResponseUnion Methods: -- client.Memberships.Update(ctx context.Context, membershipID string, body memberships.MembershipUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Memberships.Update(ctx context.Context, membershipID string, body memberships.MembershipUpdateParams) (memberships.MembershipUpdateResponseUnion, error) - client.Memberships.List(ctx context.Context, query memberships.MembershipListParams) (pagination.V4PagePaginationArray[memberships.Membership], error) - client.Memberships.Delete(ctx context.Context, membershipID string, body memberships.MembershipDeleteParams) (memberships.MembershipDeleteResponse, error) -- client.Memberships.Get(ctx context.Context, membershipID string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Memberships.Get(ctx context.Context, membershipID string) (memberships.MembershipGetResponseUnion, error) # User +Response Types: + +- user.UserEditResponseUnion +- user.UserGetResponseUnion + Methods: -- client.User.Edit(ctx context.Context, body user.UserEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.User.Get(ctx context.Context) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Edit(ctx context.Context, body user.UserEditParams) (user.UserEditResponseUnion, error) +- client.User.Get(ctx context.Context) (user.UserGetResponseUnion, error) ## AuditLogs @@ -129,21 +145,27 @@ Methods: ### Profile +Response Types: + +- user.BillingProfileGetResponseUnion + Methods: -- client.User.Billing.Profile.Get(ctx context.Context) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Billing.Profile.Get(ctx context.Context) (user.BillingProfileGetResponseUnion, error) ## Invites Response Types: - user.Invite +- user.InviteEditResponseUnion +- user.InviteGetResponseUnion Methods: - client.User.Invites.List(ctx context.Context) (pagination.SinglePage[user.Invite], error) -- client.User.Invites.Edit(ctx context.Context, inviteID string, body user.InviteEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.User.Invites.Get(ctx context.Context, inviteID string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Invites.Edit(ctx context.Context, inviteID string, body user.InviteEditParams) (user.InviteEditResponseUnion, error) +- client.User.Invites.Get(ctx context.Context, inviteID string) (user.InviteGetResponseUnion, error) ## Organizations @@ -151,25 +173,32 @@ Response Types: - user.Organization - user.OrganizationDeleteResponse +- user.OrganizationGetResponseUnion Methods: - client.User.Organizations.List(ctx context.Context, query user.OrganizationListParams) (pagination.V4PagePaginationArray[user.Organization], error) - client.User.Organizations.Delete(ctx context.Context, organizationID string, body user.OrganizationDeleteParams) (user.OrganizationDeleteResponse, error) -- client.User.Organizations.Get(ctx context.Context, organizationID string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Organizations.Get(ctx context.Context, organizationID string) (user.OrganizationGetResponseUnion, error) ## Subscriptions +Params Types: + +- user.SubscriptionParam + Response Types: - user.Subscription +- user.SubscriptionUpdateResponseUnion - user.SubscriptionDeleteResponse +- user.SubscriptionEditResponseUnion Methods: -- client.User.Subscriptions.Update(ctx context.Context, identifier string, body user.SubscriptionUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Subscriptions.Update(ctx context.Context, identifier string, body user.SubscriptionUpdateParams) (user.SubscriptionUpdateResponseUnion, error) - client.User.Subscriptions.Delete(ctx context.Context, identifier string, body user.SubscriptionDeleteParams) (user.SubscriptionDeleteResponse, error) -- client.User.Subscriptions.Edit(ctx context.Context, identifier string, body user.SubscriptionEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Subscriptions.Edit(ctx context.Context, identifier string, body user.SubscriptionEditParams) (user.SubscriptionEditResponseUnion, error) - client.User.Subscriptions.Get(ctx context.Context) ([]user.Subscription, error) ## Tokens @@ -183,17 +212,19 @@ Response Types: - user.Policy - user.TokenNewResponse +- user.TokenUpdateResponseUnion - user.TokenListResponse - user.TokenDeleteResponse +- user.TokenGetResponseUnion - user.TokenVerifyResponse Methods: - client.User.Tokens.New(ctx context.Context, body user.TokenNewParams) (user.TokenNewResponse, error) -- client.User.Tokens.Update(ctx context.Context, tokenID interface{}, body user.TokenUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Tokens.Update(ctx context.Context, tokenID interface{}, body user.TokenUpdateParams) (user.TokenUpdateResponseUnion, error) - client.User.Tokens.List(ctx context.Context, query user.TokenListParams) (pagination.V4PagePaginationArray[user.TokenListResponse], error) - client.User.Tokens.Delete(ctx context.Context, tokenID interface{}, body user.TokenDeleteParams) (user.TokenDeleteResponse, error) -- client.User.Tokens.Get(ctx context.Context, tokenID interface{}) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.User.Tokens.Get(ctx context.Context, tokenID interface{}) (user.TokenGetResponseUnion, error) - client.User.Tokens.Verify(ctx context.Context) (user.TokenVerifyResponse, error) ### PermissionGroups @@ -246,6 +277,7 @@ Methods: Params Types: +- zones.DNSSettingParam - zones.NameserverParam Response Types: @@ -884,11 +916,16 @@ Methods: ## Subscriptions +Response Types: + +- zones.SubscriptionNewResponseUnion +- zones.SubscriptionGetResponseUnion + Methods: -- client.Zones.Subscriptions.New(ctx context.Context, identifier string, body zones.SubscriptionNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Zones.Subscriptions.New(ctx context.Context, identifier string, body zones.SubscriptionNewParams) (zones.SubscriptionNewResponseUnion, error) - client.Zones.Subscriptions.List(ctx context.Context, accountIdentifier string) (pagination.SinglePage[user.Subscription], error) -- client.Zones.Subscriptions.Get(ctx context.Context, identifier string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Zones.Subscriptions.Get(ctx context.Context, identifier string) (zones.SubscriptionGetResponseUnion, error) # LoadBalancers @@ -1029,11 +1066,12 @@ Methods: Response Types: +- load_balancers.RegionListResponseUnion - load_balancers.RegionGetResponseUnion Methods: -- client.LoadBalancers.Regions.List(ctx context.Context, params load_balancers.RegionListParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.LoadBalancers.Regions.List(ctx context.Context, params load_balancers.RegionListParams) (load_balancers.RegionListResponseUnion, error) - client.LoadBalancers.Regions.Get(ctx context.Context, regionID load_balancers.RegionGetParamsRegionID, query load_balancers.RegionGetParams) (load_balancers.RegionGetResponseUnion, error) ## Searches @@ -1061,7 +1099,7 @@ Methods: Response Types: - cache.CacheReserve -- cache.UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d +- cache.CacheReserveClear - cache.CacheReserveClearResponse - cache.CacheReserveEditResponse - cache.CacheReserveGetResponse @@ -1076,24 +1114,30 @@ Methods: ## SmartTieredCache +Response Types: + +- cache.SmartTieredCacheDeleteResponseUnion +- cache.SmartTieredCacheEditResponseUnion +- cache.SmartTieredCacheGetResponseUnion + Methods: -- client.Cache.SmartTieredCache.Delete(ctx context.Context, params cache.SmartTieredCacheDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Cache.SmartTieredCache.Edit(ctx context.Context, params cache.SmartTieredCacheEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Cache.SmartTieredCache.Get(ctx context.Context, query cache.SmartTieredCacheGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Cache.SmartTieredCache.Delete(ctx context.Context, params cache.SmartTieredCacheDeleteParams) (cache.SmartTieredCacheDeleteResponseUnion, error) +- client.Cache.SmartTieredCache.Edit(ctx context.Context, params cache.SmartTieredCacheEditParams) (cache.SmartTieredCacheEditResponseUnion, error) +- client.Cache.SmartTieredCache.Get(ctx context.Context, query cache.SmartTieredCacheGetParams) (cache.SmartTieredCacheGetResponseUnion, error) ## Variants Response Types: -- cache.CacheVariants -- cache.UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 +- cache.CacheVariant +- cache.CacheVariantIdentifier - cache.VariantEditResponse - cache.VariantGetResponse Methods: -- client.Cache.Variants.Delete(ctx context.Context, params cache.VariantDeleteParams) (cache.CacheVariants, error) +- client.Cache.Variants.Delete(ctx context.Context, params cache.VariantDeleteParams) (cache.CacheVariant, error) - client.Cache.Variants.Edit(ctx context.Context, params cache.VariantEditParams) (cache.VariantEditResponse, error) - client.Cache.Variants.Get(ctx context.Context, query cache.VariantGetParams) (cache.VariantGetResponse, error) @@ -1114,9 +1158,13 @@ Methods: ## Analyze +Response Types: + +- ssl.AnalyzeNewResponseUnion + Methods: -- client.SSL.Analyze.New(ctx context.Context, params ssl.AnalyzeNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.SSL.Analyze.New(ctx context.Context, params ssl.AnalyzeNewParams) (ssl.AnalyzeNewResponseUnion, error) ## CertificatePacks @@ -1130,13 +1178,14 @@ Response Types: - ssl.CertificatePackListResponse - ssl.CertificatePackDeleteResponse - ssl.CertificatePackEditResponse +- ssl.CertificatePackGetResponseUnion Methods: - client.SSL.CertificatePacks.List(ctx context.Context, params ssl.CertificatePackListParams) (pagination.SinglePage[ssl.CertificatePackListResponse], error) - client.SSL.CertificatePacks.Delete(ctx context.Context, certificatePackID string, params ssl.CertificatePackDeleteParams) (ssl.CertificatePackDeleteResponse, error) - client.SSL.CertificatePacks.Edit(ctx context.Context, certificatePackID string, params ssl.CertificatePackEditParams) (ssl.CertificatePackEditResponse, error) -- client.SSL.CertificatePacks.Get(ctx context.Context, certificatePackID string, query ssl.CertificatePackGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.SSL.CertificatePacks.Get(ctx context.Context, certificatePackID string, query ssl.CertificatePackGetParams) (ssl.CertificatePackGetResponseUnion, error) ### Order @@ -1172,6 +1221,10 @@ Methods: ### Settings +Params Types: + +- ssl.UniversalSSLSettingsParam + Response Types: - ssl.UniversalSSLSettings @@ -1197,15 +1250,18 @@ Methods: Response Types: +- subscriptions.SubscriptionNewResponseUnion +- subscriptions.SubscriptionUpdateResponseUnion - subscriptions.SubscriptionDeleteResponse +- subscriptions.SubscriptionGetResponseUnion Methods: -- client.Subscriptions.New(ctx context.Context, identifier string, body subscriptions.SubscriptionNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body subscriptions.SubscriptionUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Subscriptions.New(ctx context.Context, identifier string, body subscriptions.SubscriptionNewParams) (subscriptions.SubscriptionNewResponseUnion, error) +- client.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body subscriptions.SubscriptionUpdateParams) (subscriptions.SubscriptionUpdateResponseUnion, error) - client.Subscriptions.List(ctx context.Context, accountIdentifier string) (pagination.SinglePage[user.Subscription], error) - client.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body subscriptions.SubscriptionDeleteParams) (subscriptions.SubscriptionDeleteResponse, error) -- client.Subscriptions.Get(ctx context.Context, identifier string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Subscriptions.Get(ctx context.Context, identifier string) (subscriptions.SubscriptionGetResponseUnion, error) # ACM @@ -1225,17 +1281,27 @@ Methods: ## SmartRouting +Response Types: + +- argo.SmartRoutingEditResponseUnion +- argo.SmartRoutingGetResponseUnion + Methods: -- client.Argo.SmartRouting.Edit(ctx context.Context, params argo.SmartRoutingEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Argo.SmartRouting.Get(ctx context.Context, query argo.SmartRoutingGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Argo.SmartRouting.Edit(ctx context.Context, params argo.SmartRoutingEditParams) (argo.SmartRoutingEditResponseUnion, error) +- client.Argo.SmartRouting.Get(ctx context.Context, query argo.SmartRoutingGetParams) (argo.SmartRoutingGetResponseUnion, error) ## TieredCaching +Response Types: + +- argo.TieredCachingEditResponseUnion +- argo.TieredCachingGetResponseUnion + Methods: -- client.Argo.TieredCaching.Edit(ctx context.Context, params argo.TieredCachingEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Argo.TieredCaching.Get(ctx context.Context, query argo.TieredCachingGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Argo.TieredCaching.Edit(ctx context.Context, params argo.TieredCachingEditParams) (argo.TieredCachingEditResponseUnion, error) +- client.Argo.TieredCaching.Get(ctx context.Context, query argo.TieredCachingGetParams) (argo.TieredCachingGetResponseUnion, error) # Plans @@ -1266,6 +1332,7 @@ Methods: Params Types: - certificate_authorities.HostnameAssociationParam +- certificate_authorities.TLSHostnameAssociationParam Response Types: @@ -1302,15 +1369,18 @@ Response Types: - custom_certificates.CustomCertificate - custom_certificates.GeoRestrictions +- custom_certificates.CustomCertificateNewResponseUnion - custom_certificates.CustomCertificateDeleteResponse +- custom_certificates.CustomCertificateEditResponseUnion +- custom_certificates.CustomCertificateGetResponseUnion Methods: -- client.CustomCertificates.New(ctx context.Context, params custom_certificates.CustomCertificateNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.CustomCertificates.New(ctx context.Context, params custom_certificates.CustomCertificateNewParams) (custom_certificates.CustomCertificateNewResponseUnion, error) - client.CustomCertificates.List(ctx context.Context, params custom_certificates.CustomCertificateListParams) (pagination.V4PagePaginationArray[custom_certificates.CustomCertificate], error) - client.CustomCertificates.Delete(ctx context.Context, customCertificateID string, params custom_certificates.CustomCertificateDeleteParams) (custom_certificates.CustomCertificateDeleteResponse, error) -- client.CustomCertificates.Edit(ctx context.Context, customCertificateID string, params custom_certificates.CustomCertificateEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.CustomCertificates.Get(ctx context.Context, customCertificateID string, query custom_certificates.CustomCertificateGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.CustomCertificates.Edit(ctx context.Context, customCertificateID string, params custom_certificates.CustomCertificateEditParams) (custom_certificates.CustomCertificateEditResponseUnion, error) +- client.CustomCertificates.Get(ctx context.Context, customCertificateID string, query custom_certificates.CustomCertificateGetParams) (custom_certificates.CustomCertificateGetResponseUnion, error) ## Prioritize @@ -1322,33 +1392,42 @@ Methods: Params Types: -- custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -- custom_hostnames.UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 -- custom_hostnames.UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 +- custom_hostnames.BundleMethod +- custom_hostnames.DCVMethod +- custom_hostnames.DomainValidationType Response Types: -- custom_hostnames.CustomHostname -- custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 -- custom_hostnames.UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 -- custom_hostnames.UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 +- custom_hostnames.BundleMethod +- custom_hostnames.DCVMethod +- custom_hostnames.DomainValidationType +- custom_hostnames.CustomHostnameNewResponse +- custom_hostnames.CustomHostnameListResponse - custom_hostnames.CustomHostnameDeleteResponse +- custom_hostnames.CustomHostnameEditResponse +- custom_hostnames.CustomHostnameGetResponse Methods: -- client.CustomHostnames.New(ctx context.Context, params custom_hostnames.CustomHostnameNewParams) (custom_hostnames.CustomHostname, error) -- client.CustomHostnames.List(ctx context.Context, params custom_hostnames.CustomHostnameListParams) (pagination.V4PagePaginationArray[custom_hostnames.CustomHostname], error) +- client.CustomHostnames.New(ctx context.Context, params custom_hostnames.CustomHostnameNewParams) (custom_hostnames.CustomHostnameNewResponse, error) +- client.CustomHostnames.List(ctx context.Context, params custom_hostnames.CustomHostnameListParams) (pagination.V4PagePaginationArray[custom_hostnames.CustomHostnameListResponse], error) - client.CustomHostnames.Delete(ctx context.Context, customHostnameID string, params custom_hostnames.CustomHostnameDeleteParams) (custom_hostnames.CustomHostnameDeleteResponse, error) -- client.CustomHostnames.Edit(ctx context.Context, customHostnameID string, params custom_hostnames.CustomHostnameEditParams) (custom_hostnames.CustomHostname, error) -- client.CustomHostnames.Get(ctx context.Context, customHostnameID string, query custom_hostnames.CustomHostnameGetParams) (custom_hostnames.CustomHostname, error) +- client.CustomHostnames.Edit(ctx context.Context, customHostnameID string, params custom_hostnames.CustomHostnameEditParams) (custom_hostnames.CustomHostnameEditResponse, error) +- client.CustomHostnames.Get(ctx context.Context, customHostnameID string, query custom_hostnames.CustomHostnameGetParams) (custom_hostnames.CustomHostnameGetResponse, error) ## FallbackOrigin +Response Types: + +- custom_hostnames.FallbackOriginUpdateResponseUnion +- custom_hostnames.FallbackOriginDeleteResponseUnion +- custom_hostnames.FallbackOriginGetResponseUnion + Methods: -- client.CustomHostnames.FallbackOrigin.Update(ctx context.Context, params custom_hostnames.FallbackOriginUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, params custom_hostnames.FallbackOriginDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.CustomHostnames.FallbackOrigin.Get(ctx context.Context, query custom_hostnames.FallbackOriginGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.CustomHostnames.FallbackOrigin.Update(ctx context.Context, params custom_hostnames.FallbackOriginUpdateParams) (custom_hostnames.FallbackOriginUpdateResponseUnion, error) +- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, params custom_hostnames.FallbackOriginDeleteParams) (custom_hostnames.FallbackOriginDeleteResponseUnion, error) +- client.CustomHostnames.FallbackOrigin.Get(ctx context.Context, query custom_hostnames.FallbackOriginGetParams) (custom_hostnames.FallbackOriginGetResponseUnion, error) # CustomNameservers @@ -1369,16 +1448,37 @@ Methods: Response Types: -- dns.UnnamedSchemaRef6595695ff25b0614667b25f66b7bbaba -- dns.UnnamedSchemaRef65be9614de145bf4a58d0fddf46df7ca -- dns.UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2 +- dns.DNSAnalyticsNominalMetric +- dns.DNSAnalyticsQuery ## Records Params Types: +- dns.ARecordParam +- dns.AAAARecordParam +- dns.CAARecordParam +- dns.CERTRecordParam +- dns.CNAMERecordParam +- dns.DNSKEYRecordParam +- dns.DSRecordParam +- dns.HTTPSRecordParam +- dns.LOCRecordParam +- dns.MXRecordParam +- dns.NAPTRRecordParam +- dns.NSRecordParam +- dns.PTRRecordParam +- dns.RecordUnionParam +- dns.RecordMetadataParam - dns.RecordTagsParam +- dns.SMIMEARecordParam +- dns.SRVRecordParam +- dns.SSHFPRecordParam +- dns.SVCBRecordParam +- dns.TLSARecordParam - dns.TTLUnionParam +- dns.TXTRecordParam +- dns.URIRecordParam Response Types: @@ -1396,6 +1496,8 @@ Response Types: - dns.NSRecord - dns.PTRRecord - dns.Record +- dns.RecordMetadata +- dns.RecordProcessTiming - dns.RecordTags - dns.SMIMEARecord - dns.SRVRecord @@ -1404,8 +1506,6 @@ Response Types: - dns.TLSARecord - dns.TTLUnion - dns.TXTRecord -- dns.UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb -- dns.UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd - dns.URIRecord - dns.RecordDeleteResponse - dns.RecordImportResponse @@ -1450,6 +1550,7 @@ Methods: Params Types: - dns.AttackMitigationParam +- dns.FirewallParam - dns.FirewallIPsUnionParam - dns.UpstreamIPsUnionParam @@ -1639,31 +1740,37 @@ Params Types: Response Types: +- firewall.AccessRuleNewResponseUnion - firewall.AccessRuleListResponse - firewall.AccessRuleDeleteResponse +- firewall.AccessRuleEditResponseUnion +- firewall.AccessRuleGetResponseUnion Methods: -- client.Firewall.AccessRules.New(ctx context.Context, params firewall.AccessRuleNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.AccessRules.New(ctx context.Context, params firewall.AccessRuleNewParams) (firewall.AccessRuleNewResponseUnion, error) - client.Firewall.AccessRules.List(ctx context.Context, params firewall.AccessRuleListParams) (pagination.V4PagePaginationArray[firewall.AccessRuleListResponse], error) - client.Firewall.AccessRules.Delete(ctx context.Context, identifier interface{}, params firewall.AccessRuleDeleteParams) (firewall.AccessRuleDeleteResponse, error) -- client.Firewall.AccessRules.Edit(ctx context.Context, identifier interface{}, params firewall.AccessRuleEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Firewall.AccessRules.Get(ctx context.Context, identifier interface{}, query firewall.AccessRuleGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.AccessRules.Edit(ctx context.Context, identifier interface{}, params firewall.AccessRuleEditParams) (firewall.AccessRuleEditResponseUnion, error) +- client.Firewall.AccessRules.Get(ctx context.Context, identifier interface{}, query firewall.AccessRuleGetParams) (firewall.AccessRuleGetResponseUnion, error) ## UARules Response Types: +- firewall.UARuleNewResponseUnion +- firewall.UARuleUpdateResponseUnion - firewall.UARuleListResponse - firewall.UARuleDeleteResponse +- firewall.UARuleGetResponseUnion Methods: -- client.Firewall.UARules.New(ctx context.Context, zoneIdentifier string, body firewall.UARuleNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Firewall.UARules.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.UARuleUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.UARules.New(ctx context.Context, zoneIdentifier string, body firewall.UARuleNewParams) (firewall.UARuleNewResponseUnion, error) +- client.Firewall.UARules.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.UARuleUpdateParams) (firewall.UARuleUpdateResponseUnion, error) - client.Firewall.UARules.List(ctx context.Context, zoneIdentifier string, query firewall.UARuleListParams) (pagination.V4PagePaginationArray[firewall.UARuleListResponse], error) - client.Firewall.UARules.Delete(ctx context.Context, zoneIdentifier string, id string, body firewall.UARuleDeleteParams) (firewall.UARuleDeleteResponse, error) -- client.Firewall.UARules.Get(ctx context.Context, zoneIdentifier string, id string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.UARules.Get(ctx context.Context, zoneIdentifier string, id string) (firewall.UARuleGetResponseUnion, error) ## WAF @@ -1702,12 +1809,14 @@ Methods: Response Types: - firewall.Group +- firewall.WAFPackageGroupEditResponseUnion +- firewall.WAFPackageGroupGetResponseUnion Methods: - client.Firewall.WAF.Packages.Groups.List(ctx context.Context, packageID string, params firewall.WAFPackageGroupListParams) (pagination.V4PagePaginationArray[firewall.Group], error) -- client.Firewall.WAF.Packages.Groups.Edit(ctx context.Context, packageID string, groupID string, params firewall.WAFPackageGroupEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Firewall.WAF.Packages.Groups.Get(ctx context.Context, packageID string, groupID string, query firewall.WAFPackageGroupGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.WAF.Packages.Groups.Edit(ctx context.Context, packageID string, groupID string, params firewall.WAFPackageGroupEditParams) (firewall.WAFPackageGroupEditResponseUnion, error) +- client.Firewall.WAF.Packages.Groups.Get(ctx context.Context, packageID string, groupID string, query firewall.WAFPackageGroupGetParams) (firewall.WAFPackageGroupGetResponseUnion, error) #### Rules @@ -1717,12 +1826,13 @@ Response Types: - firewall.UnnamedSchemaRef532d8b97684c9032dd36bae8acddebf5 - firewall.WAFPackageRuleListResponse - firewall.WAFPackageRuleEditResponse +- firewall.WAFPackageRuleGetResponseUnion Methods: - client.Firewall.WAF.Packages.Rules.List(ctx context.Context, packageID string, params firewall.WAFPackageRuleListParams) (pagination.V4PagePaginationArray[firewall.WAFPackageRuleListResponse], error) - client.Firewall.WAF.Packages.Rules.Edit(ctx context.Context, packageID string, ruleID string, params firewall.WAFPackageRuleEditParams) (firewall.WAFPackageRuleEditResponse, error) -- client.Firewall.WAF.Packages.Rules.Get(ctx context.Context, packageID string, ruleID string, query firewall.WAFPackageRuleGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Firewall.WAF.Packages.Rules.Get(ctx context.Context, packageID string, ruleID string, query firewall.WAFPackageRuleGetParams) (firewall.WAFPackageRuleGetResponseUnion, error) # Healthchecks @@ -1730,6 +1840,7 @@ Params Types: - healthchecks.CheckRegion - healthchecks.HTTPConfigurationParam +- healthchecks.QueryHealthcheckParam - healthchecks.TCPConfigurationParam Response Types: @@ -1883,6 +1994,10 @@ Methods: #### Config +Params Types: + +- logs.CmbConfigParam + Response Types: - logs.CmbConfig @@ -1929,13 +2044,16 @@ Methods: Response Types: - origin_tls_client_auth.ZoneAuthenticatedOriginPull +- origin_tls_client_auth.OriginTLSClientAuthNewResponseUnion +- origin_tls_client_auth.OriginTLSClientAuthDeleteResponseUnion +- origin_tls_client_auth.OriginTLSClientAuthGetResponseUnion Methods: -- client.OriginTLSClientAuth.New(ctx context.Context, params origin_tls_client_auth.OriginTLSClientAuthNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.OriginTLSClientAuth.New(ctx context.Context, params origin_tls_client_auth.OriginTLSClientAuthNewParams) (origin_tls_client_auth.OriginTLSClientAuthNewResponseUnion, error) - client.OriginTLSClientAuth.List(ctx context.Context, query origin_tls_client_auth.OriginTLSClientAuthListParams) (pagination.SinglePage[origin_tls_client_auth.ZoneAuthenticatedOriginPull], error) -- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, params origin_tls_client_auth.OriginTLSClientAuthDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.OriginTLSClientAuth.Get(ctx context.Context, certificateID string, query origin_tls_client_auth.OriginTLSClientAuthGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, params origin_tls_client_auth.OriginTLSClientAuthDeleteParams) (origin_tls_client_auth.OriginTLSClientAuthDeleteResponseUnion, error) +- client.OriginTLSClientAuth.Get(ctx context.Context, certificateID string, query origin_tls_client_auth.OriginTLSClientAuthGetParams) (origin_tls_client_auth.OriginTLSClientAuthGetResponseUnion, error) ## Hostnames @@ -1986,16 +2104,20 @@ Response Types: - pagerules.PageRule - pagerules.Route - pagerules.Targes +- pagerules.PageruleNewResponseUnion +- pagerules.PageruleUpdateResponseUnion - pagerules.PageruleDeleteResponse +- pagerules.PageruleEditResponseUnion +- pagerules.PageruleGetResponseUnion Methods: -- client.Pagerules.New(ctx context.Context, params pagerules.PageruleNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Pagerules.Update(ctx context.Context, pageruleID string, params pagerules.PageruleUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Pagerules.New(ctx context.Context, params pagerules.PageruleNewParams) (pagerules.PageruleNewResponseUnion, error) +- client.Pagerules.Update(ctx context.Context, pageruleID string, params pagerules.PageruleUpdateParams) (pagerules.PageruleUpdateResponseUnion, error) - client.Pagerules.List(ctx context.Context, params pagerules.PageruleListParams) ([]pagerules.PageRule, error) - client.Pagerules.Delete(ctx context.Context, pageruleID string, params pagerules.PageruleDeleteParams) (pagerules.PageruleDeleteResponse, error) -- client.Pagerules.Edit(ctx context.Context, pageruleID string, params pagerules.PageruleEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.Pagerules.Get(ctx context.Context, pageruleID string, query pagerules.PageruleGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Pagerules.Edit(ctx context.Context, pageruleID string, params pagerules.PageruleEditParams) (pagerules.PageruleEditResponseUnion, error) +- client.Pagerules.Get(ctx context.Context, pageruleID string, query pagerules.PageruleGetParams) (pagerules.PageruleGetResponseUnion, error) ## Settings @@ -2018,15 +2140,18 @@ Response Types: - rate_limits.Action - rate_limits.Methods - rate_limits.RateLimit +- rate_limits.RateLimitNewResponseUnion - rate_limits.RateLimitDeleteResponse +- rate_limits.RateLimitEditResponseUnion +- rate_limits.RateLimitGetResponseUnion Methods: -- client.RateLimits.New(ctx context.Context, zoneIdentifier string, body rate_limits.RateLimitNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.RateLimits.New(ctx context.Context, zoneIdentifier string, body rate_limits.RateLimitNewParams) (rate_limits.RateLimitNewResponseUnion, error) - client.RateLimits.List(ctx context.Context, zoneIdentifier string, query rate_limits.RateLimitListParams) (pagination.V4PagePaginationArray[rate_limits.RateLimit], error) - client.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string, body rate_limits.RateLimitDeleteParams) (rate_limits.RateLimitDeleteResponse, error) -- client.RateLimits.Edit(ctx context.Context, zoneIdentifier string, id string, body rate_limits.RateLimitEditParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.RateLimits.Edit(ctx context.Context, zoneIdentifier string, id string, body rate_limits.RateLimitEditParams) (rate_limits.RateLimitEditResponseUnion, error) +- client.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (rate_limits.RateLimitGetResponseUnion, error) # SecondaryDNS @@ -2085,6 +2210,10 @@ Methods: ## ACLs +Params Types: + +- secondary_dns.ACLParam + Response Types: - secondary_dns.ACL @@ -2100,6 +2229,10 @@ Methods: ## Peers +Params Types: + +- secondary_dns.PeerParam + Response Types: - secondary_dns.Peer @@ -2115,6 +2248,10 @@ Methods: ## TSIGs +Params Types: + +- secondary_dns.TSIGParam + Response Types: - secondary_dns.TSIG @@ -2134,6 +2271,7 @@ Params Types: - waiting_rooms.AdditionalRoutesParam - waiting_rooms.CookieAttributesParam +- waiting_rooms.QueryParam Response Types: @@ -2179,6 +2317,10 @@ Methods: ### Details +Params Types: + +- waiting_rooms.EventQueryParam + Response Types: - waiting_rooms.EventDetailGetResponse @@ -2286,6 +2428,7 @@ Params Types: - workers.PlacementConfigurationParam - workers.SingleStepMigrationParam - workers.SteppedMigrationParam +- workers.WorkerMetadataParam Response Types: @@ -2688,6 +2831,7 @@ Params Types: - rulesets.BlockRuleParam - rulesets.ExecuteRuleParam - rulesets.LogRuleParam +- rulesets.LoggingParam - rulesets.SkipRuleParam Response Types: @@ -2695,6 +2839,7 @@ Response Types: - rulesets.BlockRule - rulesets.ExecuteRule - rulesets.LogRule +- rulesets.Logging - rulesets.SkipRule - rulesets.RuleNewResponse - rulesets.RuleDeleteResponse @@ -2804,6 +2949,7 @@ Response Types: - spectrum.AppUpdateResponse - spectrum.AppListResponse - spectrum.AppDeleteResponse +- spectrum.AppGetResponseUnion Methods: @@ -2811,7 +2957,7 @@ Methods: - client.Spectrum.Apps.Update(ctx context.Context, zone string, appID string, body spectrum.AppUpdateParams) (spectrum.AppUpdateResponse, error) - client.Spectrum.Apps.List(ctx context.Context, zone string, query spectrum.AppListParams) (pagination.V4PagePaginationArray[spectrum.AppListResponse], error) - client.Spectrum.Apps.Delete(ctx context.Context, zone string, appID string, body spectrum.AppDeleteParams) (spectrum.AppDeleteResponse, error) -- client.Spectrum.Apps.Get(ctx context.Context, zone string, appID string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Spectrum.Apps.Get(ctx context.Context, zone string, appID string) (spectrum.AppGetResponseUnion, error) # Addressing @@ -2980,9 +3126,13 @@ Methods: ## Profiles +Response Types: + +- billing.ProfileGetResponseUnion + Methods: -- client.Billing.Profiles.Get(ctx context.Context, accountIdentifier interface{}) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Billing.Profiles.Get(ctx context.Context, accountIdentifier interface{}) (billing.ProfileGetResponseUnion, error) # BrandProtection @@ -3023,12 +3173,13 @@ Response Types: - images.Image - images.V1ListResponse +- images.V1DeleteResponseUnion Methods: - client.Images.V1.New(ctx context.Context, params images.V1NewParams) (images.Image, error) - client.Images.V1.List(ctx context.Context, params images.V1ListParams) (pagination.V4PagePagination[images.V1ListResponse], error) -- client.Images.V1.Delete(ctx context.Context, imageID string, params images.V1DeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Images.V1.Delete(ctx context.Context, imageID string, params images.V1DeleteParams) (images.V1DeleteResponseUnion, error) - client.Images.V1.Edit(ctx context.Context, imageID string, params images.V1EditParams) (images.Image, error) - client.Images.V1.Get(ctx context.Context, imageID string, query images.V1GetParams) (images.Image, error) @@ -3060,6 +3211,7 @@ Response Types: - images.Variant - images.V1VariantNewResponse +- images.V1VariantDeleteResponseUnion - images.V1VariantEditResponse - images.V1VariantGetResponse @@ -3067,7 +3219,7 @@ Methods: - client.Images.V1.Variants.New(ctx context.Context, params images.V1VariantNewParams) (images.V1VariantNewResponse, error) - client.Images.V1.Variants.List(ctx context.Context, query images.V1VariantListParams) (images.Variant, error) -- client.Images.V1.Variants.Delete(ctx context.Context, variantID string, params images.V1VariantDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Images.V1.Variants.Delete(ctx context.Context, variantID string, params images.V1VariantDeleteParams) (images.V1VariantDeleteResponseUnion, error) - client.Images.V1.Variants.Edit(ctx context.Context, variantID string, params images.V1VariantEditParams) (images.V1VariantEditResponse, error) - client.Images.V1.Variants.Get(ctx context.Context, variantID string, query images.V1VariantGetParams) (images.V1VariantGetResponse, error) @@ -3407,6 +3559,7 @@ Methods: Params Types: +- magic_transit.ACLParam - magic_transit.ACLConfigurationParam - magic_transit.SubnetUnionParam - magic_transit.UnnamedSchemaRef87fa9e5fe9f6b8d607be1df57340d916 @@ -3569,6 +3722,7 @@ Methods: Params Types: - pages.DeploymentParam +- pages.ProjectParam - pages.StageParam Response Types: @@ -3890,37 +4044,42 @@ Methods: Response Types: - stream.Watermaks +- stream.WatermarkNewResponseUnion - stream.WatermarkDeleteResponseUnion +- stream.WatermarkGetResponseUnion Methods: -- client.Stream.Watermarks.New(ctx context.Context, params stream.WatermarkNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Watermarks.New(ctx context.Context, params stream.WatermarkNewParams) (stream.WatermarkNewResponseUnion, error) - client.Stream.Watermarks.List(ctx context.Context, query stream.WatermarkListParams) (pagination.SinglePage[stream.Watermaks], error) - client.Stream.Watermarks.Delete(ctx context.Context, identifier string, params stream.WatermarkDeleteParams) (stream.WatermarkDeleteResponseUnion, error) -- client.Stream.Watermarks.Get(ctx context.Context, identifier string, query stream.WatermarkGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Watermarks.Get(ctx context.Context, identifier string, query stream.WatermarkGetParams) (stream.WatermarkGetResponseUnion, error) ## Webhooks Response Types: +- stream.WebhookUpdateResponseUnion - stream.WebhookDeleteResponseUnion +- stream.WebhookGetResponseUnion Methods: -- client.Stream.Webhooks.Update(ctx context.Context, params stream.WebhookUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Webhooks.Update(ctx context.Context, params stream.WebhookUpdateParams) (stream.WebhookUpdateResponseUnion, error) - client.Stream.Webhooks.Delete(ctx context.Context, params stream.WebhookDeleteParams) (stream.WebhookDeleteResponseUnion, error) -- client.Stream.Webhooks.Get(ctx context.Context, query stream.WebhookGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Webhooks.Get(ctx context.Context, query stream.WebhookGetParams) (stream.WebhookGetResponseUnion, error) ## Captions Response Types: - stream.Caption +- stream.CaptionUpdateResponseUnion - stream.CaptionDeleteResponseUnion Methods: -- client.Stream.Captions.Update(ctx context.Context, identifier string, language string, params stream.CaptionUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Captions.Update(ctx context.Context, identifier string, language string, params stream.CaptionUpdateParams) (stream.CaptionUpdateResponseUnion, error) - client.Stream.Captions.Delete(ctx context.Context, identifier string, language string, params stream.CaptionDeleteParams) (stream.CaptionDeleteResponseUnion, error) - client.Stream.Captions.Get(ctx context.Context, identifier string, query stream.CaptionGetParams) ([]stream.Caption, error) @@ -3928,13 +4087,15 @@ Methods: Response Types: +- stream.DownloadNewResponseUnion - stream.DownloadDeleteResponseUnion +- stream.DownloadGetResponseUnion Methods: -- client.Stream.Downloads.New(ctx context.Context, identifier string, params stream.DownloadNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Downloads.New(ctx context.Context, identifier string, params stream.DownloadNewParams) (stream.DownloadNewResponseUnion, error) - client.Stream.Downloads.Delete(ctx context.Context, identifier string, body stream.DownloadDeleteParams) (stream.DownloadDeleteResponseUnion, error) -- client.Stream.Downloads.Get(ctx context.Context, identifier string, query stream.DownloadGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Stream.Downloads.Get(ctx context.Context, identifier string, query stream.DownloadGetParams) (stream.DownloadGetResponseUnion, error) ## Embed @@ -4057,12 +4218,13 @@ Response Types: - d1.QueryResult - d1.DatabaseNewResponse - d1.DatabaseListResponse +- d1.DatabaseDeleteResponseUnion Methods: - client.D1.Database.New(ctx context.Context, params d1.DatabaseNewParams) (d1.DatabaseNewResponse, error) - client.D1.Database.List(ctx context.Context, params d1.DatabaseListParams) (pagination.V4PagePaginationArray[d1.DatabaseListResponse], error) -- client.D1.Database.Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.D1.Database.Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string) (d1.DatabaseDeleteResponseUnion, error) - client.D1.Database.Get(ctx context.Context, accountIdentifier string, databaseIdentifier string) (d1.D1, error) - client.D1.Database.Query(ctx context.Context, accountIdentifier string, databaseIdentifier string, body d1.DatabaseQueryParams) ([]d1.QueryResult, error) @@ -4175,17 +4337,19 @@ Methods: Response Types: - zero_trust.Device +- zero_trust.DeviceGetResponseUnion Methods: - client.ZeroTrust.Devices.List(ctx context.Context, query zero_trust.DeviceListParams) (pagination.SinglePage[zero_trust.Device], error) -- client.ZeroTrust.Devices.Get(ctx context.Context, deviceID string, query zero_trust.DeviceGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Devices.Get(ctx context.Context, deviceID string, query zero_trust.DeviceGetParams) (zero_trust.DeviceGetResponseUnion, error) ### DEXTests Params Types: - zero_trust.SchemaDataParam +- zero_trust.SchemaHTTPParam Response Types: @@ -4320,23 +4484,32 @@ Methods: Response Types: - zero_trust.Integration +- zero_trust.DevicePostureIntegrationDeleteResponseUnion Methods: - client.ZeroTrust.Devices.Posture.Integrations.New(ctx context.Context, params zero_trust.DevicePostureIntegrationNewParams) (zero_trust.Integration, error) - client.ZeroTrust.Devices.Posture.Integrations.List(ctx context.Context, query zero_trust.DevicePostureIntegrationListParams) (pagination.SinglePage[zero_trust.Integration], error) -- client.ZeroTrust.Devices.Posture.Integrations.Delete(ctx context.Context, integrationID string, params zero_trust.DevicePostureIntegrationDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Devices.Posture.Integrations.Delete(ctx context.Context, integrationID string, params zero_trust.DevicePostureIntegrationDeleteParams) (zero_trust.DevicePostureIntegrationDeleteResponseUnion, error) - client.ZeroTrust.Devices.Posture.Integrations.Edit(ctx context.Context, integrationID string, params zero_trust.DevicePostureIntegrationEditParams) (zero_trust.Integration, error) - client.ZeroTrust.Devices.Posture.Integrations.Get(ctx context.Context, integrationID string, query zero_trust.DevicePostureIntegrationGetParams) (zero_trust.Integration, error) ### Revoke +Response Types: + +- zero_trust.DeviceRevokeNewResponseUnion + Methods: -- client.ZeroTrust.Devices.Revoke.New(ctx context.Context, params zero_trust.DeviceRevokeNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Devices.Revoke.New(ctx context.Context, params zero_trust.DeviceRevokeNewParams) (zero_trust.DeviceRevokeNewResponseUnion, error) ### Settings +Params Types: + +- zero_trust.DeviceSettingsParam + Response Types: - zero_trust.DeviceSettings @@ -4348,9 +4521,13 @@ Methods: ### Unrevoke +Response Types: + +- zero_trust.DeviceUnrevokeNewResponseUnion + Methods: -- client.ZeroTrust.Devices.Unrevoke.New(ctx context.Context, params zero_trust.DeviceUnrevokeNewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Devices.Unrevoke.New(ctx context.Context, params zero_trust.DeviceUnrevokeNewParams) (zero_trust.DeviceUnrevokeNewResponseUnion, error) ### OverrideCodes @@ -4366,7 +4543,9 @@ Methods: Params Types: +- zero_trust.AzureADParam - zero_trust.GenericOAuthConfigParam +- zero_trust.IdentityProviderUnionParam - zero_trust.IdentityProviderType - zero_trust.ScimConfigParam @@ -4436,6 +4615,7 @@ Params Types: - zero_trust.AllowedMethodsh - zero_trust.AllowedOriginshParam - zero_trust.AppIDUnionParam +- zero_trust.ApplicationUnionParam - zero_trust.CorsHeadersParam - zero_trust.CustomPageshParam - zero_trust.SAMLSaasAppParam @@ -4469,14 +4649,16 @@ Methods: Response Types: - zero_trust.CA +- zero_trust.AccessApplicationCANewResponseUnion - zero_trust.AccessApplicationCADeleteResponse +- zero_trust.AccessApplicationCAGetResponseUnion Methods: -- client.ZeroTrust.Access.Applications.CAs.New(ctx context.Context, uuid string, body zero_trust.AccessApplicationCANewParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Access.Applications.CAs.New(ctx context.Context, uuid string, body zero_trust.AccessApplicationCANewParams) (zero_trust.AccessApplicationCANewResponseUnion, error) - client.ZeroTrust.Access.Applications.CAs.List(ctx context.Context, query zero_trust.AccessApplicationCAListParams) (pagination.SinglePage[zero_trust.CA], error) - client.ZeroTrust.Access.Applications.CAs.Delete(ctx context.Context, uuid string, body zero_trust.AccessApplicationCADeleteParams) (zero_trust.AccessApplicationCADeleteResponse, error) -- client.ZeroTrust.Access.Applications.CAs.Get(ctx context.Context, uuid string, query zero_trust.AccessApplicationCAGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Access.Applications.CAs.Get(ctx context.Context, uuid string, query zero_trust.AccessApplicationCAGetParams) (zero_trust.AccessApplicationCAGetResponseUnion, error) #### UserPolicyChecks @@ -4661,6 +4843,10 @@ Methods: ### CustomPages +Params Types: + +- zero_trust.CustomPageParam + Response Types: - zero_trust.CustomPage @@ -5070,6 +5256,7 @@ Response Types: - zero_trust.GatewayListNewResponse - zero_trust.GatewayListUpdateResponse - zero_trust.GatewayListListResponse +- zero_trust.GatewayListDeleteResponseUnion - zero_trust.GatewayListEditResponse - zero_trust.GatewayListGetResponse @@ -5078,7 +5265,7 @@ Methods: - client.ZeroTrust.Gateway.Lists.New(ctx context.Context, params zero_trust.GatewayListNewParams) (zero_trust.GatewayListNewResponse, error) - client.ZeroTrust.Gateway.Lists.Update(ctx context.Context, listID string, params zero_trust.GatewayListUpdateParams) (zero_trust.GatewayListUpdateResponse, error) - client.ZeroTrust.Gateway.Lists.List(ctx context.Context, query zero_trust.GatewayListListParams) (pagination.SinglePage[zero_trust.GatewayListListResponse], error) -- client.ZeroTrust.Gateway.Lists.Delete(ctx context.Context, listID string, params zero_trust.GatewayListDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Gateway.Lists.Delete(ctx context.Context, listID string, params zero_trust.GatewayListDeleteParams) (zero_trust.GatewayListDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Lists.Edit(ctx context.Context, listID string, params zero_trust.GatewayListEditParams) (zero_trust.GatewayListEditResponse, error) - client.ZeroTrust.Gateway.Lists.Get(ctx context.Context, listID string, query zero_trust.GatewayListGetParams) (zero_trust.GatewayListGetResponse, error) @@ -5098,19 +5285,21 @@ Response Types: - zero_trust.Location - zero_trust.LocationNetwork +- zero_trust.GatewayLocationDeleteResponseUnion Methods: - client.ZeroTrust.Gateway.Locations.New(ctx context.Context, params zero_trust.GatewayLocationNewParams) (zero_trust.Location, error) - client.ZeroTrust.Gateway.Locations.Update(ctx context.Context, locationID string, params zero_trust.GatewayLocationUpdateParams) (zero_trust.Location, error) - client.ZeroTrust.Gateway.Locations.List(ctx context.Context, query zero_trust.GatewayLocationListParams) (pagination.SinglePage[zero_trust.Location], error) -- client.ZeroTrust.Gateway.Locations.Delete(ctx context.Context, locationID string, params zero_trust.GatewayLocationDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Gateway.Locations.Delete(ctx context.Context, locationID string, params zero_trust.GatewayLocationDeleteParams) (zero_trust.GatewayLocationDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Locations.Get(ctx context.Context, locationID string, query zero_trust.GatewayLocationGetParams) (zero_trust.Location, error) ### Logging Params Types: +- zero_trust.LoggingSettingParam - zero_trust.UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam Response Types: @@ -5133,12 +5322,13 @@ Response Types: - zero_trust.GatewayIPs - zero_trust.ProxyEndpoint +- zero_trust.GatewayProxyEndpointDeleteResponseUnion Methods: - client.ZeroTrust.Gateway.ProxyEndpoints.New(ctx context.Context, params zero_trust.GatewayProxyEndpointNewParams) (zero_trust.ProxyEndpoint, error) - client.ZeroTrust.Gateway.ProxyEndpoints.List(ctx context.Context, query zero_trust.GatewayProxyEndpointListParams) (pagination.SinglePage[zero_trust.ProxyEndpoint], error) -- client.ZeroTrust.Gateway.ProxyEndpoints.Delete(ctx context.Context, proxyEndpointID string, params zero_trust.GatewayProxyEndpointDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Gateway.ProxyEndpoints.Delete(ctx context.Context, proxyEndpointID string, params zero_trust.GatewayProxyEndpointDeleteParams) (zero_trust.GatewayProxyEndpointDeleteResponseUnion, error) - client.ZeroTrust.Gateway.ProxyEndpoints.Edit(ctx context.Context, proxyEndpointID string, params zero_trust.GatewayProxyEndpointEditParams) (zero_trust.ProxyEndpoint, error) - client.ZeroTrust.Gateway.ProxyEndpoints.Get(ctx context.Context, proxyEndpointID string, query zero_trust.GatewayProxyEndpointGetParams) (zero_trust.ProxyEndpoint, error) @@ -5160,13 +5350,14 @@ Response Types: - zero_trust.GatewayRule - zero_trust.RuleSetting - zero_trust.Schedule +- zero_trust.GatewayRuleDeleteResponseUnion Methods: - client.ZeroTrust.Gateway.Rules.New(ctx context.Context, params zero_trust.GatewayRuleNewParams) (zero_trust.GatewayRule, error) - client.ZeroTrust.Gateway.Rules.Update(ctx context.Context, ruleID string, params zero_trust.GatewayRuleUpdateParams) (zero_trust.GatewayRule, error) - client.ZeroTrust.Gateway.Rules.List(ctx context.Context, query zero_trust.GatewayRuleListParams) (pagination.SinglePage[zero_trust.GatewayRule], error) -- client.ZeroTrust.Gateway.Rules.Delete(ctx context.Context, ruleID string, params zero_trust.GatewayRuleDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.ZeroTrust.Gateway.Rules.Delete(ctx context.Context, ruleID string, params zero_trust.GatewayRuleDeleteParams) (zero_trust.GatewayRuleDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Rules.Get(ctx context.Context, ruleID string, query zero_trust.GatewayRuleGetParams) (zero_trust.GatewayRule, error) ## Networks @@ -5255,12 +5446,16 @@ Response Types: ## Configs +Response Types: + +- hyperdrive.ConfigDeleteResponseUnion + Methods: - client.Hyperdrive.Configs.New(ctx context.Context, params hyperdrive.ConfigNewParams) (hyperdrive.Hyperdrive, error) - client.Hyperdrive.Configs.Update(ctx context.Context, hyperdriveID string, params hyperdrive.ConfigUpdateParams) (hyperdrive.Hyperdrive, error) - client.Hyperdrive.Configs.List(ctx context.Context, query hyperdrive.ConfigListParams) (pagination.SinglePage[hyperdrive.Hyperdrive], error) -- client.Hyperdrive.Configs.Delete(ctx context.Context, hyperdriveID string, body hyperdrive.ConfigDeleteParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Hyperdrive.Configs.Delete(ctx context.Context, hyperdriveID string, body hyperdrive.ConfigDeleteParams) (hyperdrive.ConfigDeleteResponseUnion, error) - client.Hyperdrive.Configs.Edit(ctx context.Context, hyperdriveID string, params hyperdrive.ConfigEditParams) (hyperdrive.Hyperdrive, error) - client.Hyperdrive.Configs.Get(ctx context.Context, hyperdriveID string, query hyperdrive.ConfigGetParams) (hyperdrive.Hyperdrive, error) @@ -5312,6 +5507,7 @@ Response Types: - vectorize.IndexInsert - vectorize.IndexQuery - vectorize.IndexUpsert +- vectorize.IndexDeleteResponseUnion - vectorize.IndexGetByIDsResponse Methods: @@ -5319,7 +5515,7 @@ Methods: - client.Vectorize.Indexes.New(ctx context.Context, accountIdentifier string, body vectorize.IndexNewParams) (vectorize.CreateIndex, error) - client.Vectorize.Indexes.Update(ctx context.Context, accountIdentifier string, indexName string, body vectorize.IndexUpdateParams) (vectorize.CreateIndex, error) - client.Vectorize.Indexes.List(ctx context.Context, accountIdentifier string) (pagination.SinglePage[vectorize.CreateIndex], error) -- client.Vectorize.Indexes.Delete(ctx context.Context, accountIdentifier string, indexName string) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.Vectorize.Indexes.Delete(ctx context.Context, accountIdentifier string, indexName string) (vectorize.IndexDeleteResponseUnion, error) - client.Vectorize.Indexes.DeleteByIDs(ctx context.Context, accountIdentifier string, indexName string, body vectorize.IndexDeleteByIDsParams) (vectorize.IndexDeleteVectorsByID, error) - client.Vectorize.Indexes.Get(ctx context.Context, accountIdentifier string, indexName string) (vectorize.CreateIndex, error) - client.Vectorize.Indexes.GetByIDs(ctx context.Context, accountIdentifier string, indexName string, body vectorize.IndexGetByIDsParams) (vectorize.IndexGetByIDsResponse, error) @@ -6265,6 +6461,13 @@ Methods: # BotManagement +Params Types: + +- bot_management.BotFightModeConfigurationParam +- bot_management.SubscriptionConfigurationParam +- bot_management.SuperBotFightModeDefinitelyConfigurationParam +- bot_management.SuperBotFightModeLikelyConfigurationParam + Response Types: - bot_management.BotFightModeConfiguration @@ -6281,10 +6484,15 @@ Methods: # OriginPostQuantumEncryption +Response Types: + +- origin_post_quantum_encryption.OriginPostQuantumEncryptionUpdateResponseUnion +- origin_post_quantum_encryption.OriginPostQuantumEncryptionGetResponseUnion + Methods: -- client.OriginPostQuantumEncryption.Update(ctx context.Context, params origin_post_quantum_encryption.OriginPostQuantumEncryptionUpdateParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) -- client.OriginPostQuantumEncryption.Get(ctx context.Context, query origin_post_quantum_encryption.OriginPostQuantumEncryptionGetParams) (shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, error) +- client.OriginPostQuantumEncryption.Update(ctx context.Context, params origin_post_quantum_encryption.OriginPostQuantumEncryptionUpdateParams) (origin_post_quantum_encryption.OriginPostQuantumEncryptionUpdateResponseUnion, error) +- client.OriginPostQuantumEncryption.Get(ctx context.Context, query origin_post_quantum_encryption.OriginPostQuantumEncryptionGetParams) (origin_post_quantum_encryption.OriginPostQuantumEncryptionGetResponseUnion, error) # Speed @@ -6476,6 +6684,7 @@ Methods: Params Types: - cloudforce_one.LabelParam +- cloudforce_one.PriorityEditParam Response Types: diff --git a/argo/aliases.go b/argo/aliases.go index 15faa0db479..74d18eacfbf 100644 --- a/argo/aliases.go +++ b/argo/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/argo/smartrouting.go b/argo/smartrouting.go index cfe1a9b3217..35fea9775b0 100644 --- a/argo/smartrouting.go +++ b/argo/smartrouting.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // SmartRoutingService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewSmartRoutingService(opts ...option.RequestOption) (r *SmartRoutingServic } // Updates enablement of Argo Smart Routing. -func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditParams, opts ...option.RequestOption) (res *SmartRoutingEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartRoutingEditResponseEnvelope path := fmt.Sprintf("zones/%s/argo/smart_routing", params.ZoneID) @@ -46,7 +48,7 @@ func (r *SmartRoutingService) Edit(ctx context.Context, params SmartRoutingEditP } // Get Argo Smart Routing setting -func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetParams, opts ...option.RequestOption) (res *SmartRoutingGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartRoutingGetResponseEnvelope path := fmt.Sprintf("zones/%s/argo/smart_routing", query.ZoneID) @@ -58,6 +60,40 @@ func (r *SmartRoutingService) Get(ctx context.Context, query SmartRoutingGetPara return } +// Union satisfied by [argo.SmartRoutingEditResponseUnknown] or +// [shared.UnionString]. +type SmartRoutingEditResponseUnion interface { + ImplementsArgoSmartRoutingEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SmartRoutingEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [argo.SmartRoutingGetResponseUnknown] or +// [shared.UnionString]. +type SmartRoutingGetResponseUnion interface { + ImplementsArgoSmartRoutingGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SmartRoutingGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type SmartRoutingEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -86,9 +122,9 @@ func (r SmartRoutingEditParamsValue) IsKnown() bool { } type SmartRoutingEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SmartRoutingEditResponseUnion `json:"result,required"` // Whether the API call was successful Success SmartRoutingEditResponseEnvelopeSuccess `json:"success,required"` JSON smartRoutingEditResponseEnvelopeJSON `json:"-"` @@ -134,9 +170,9 @@ type SmartRoutingGetParams struct { } type SmartRoutingGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SmartRoutingGetResponseUnion `json:"result,required"` // Whether the API call was successful Success SmartRoutingGetResponseEnvelopeSuccess `json:"success,required"` JSON smartRoutingGetResponseEnvelopeJSON `json:"-"` diff --git a/argo/tieredcaching.go b/argo/tieredcaching.go index 4a6b2991cea..1d146682416 100644 --- a/argo/tieredcaching.go +++ b/argo/tieredcaching.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // TieredCachingService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewTieredCachingService(opts ...option.RequestOption) (r *TieredCachingServ } // Updates enablement of Tiered Caching -func (r *TieredCachingService) Edit(ctx context.Context, params TieredCachingEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *TieredCachingService) Edit(ctx context.Context, params TieredCachingEditParams, opts ...option.RequestOption) (res *TieredCachingEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env TieredCachingEditResponseEnvelope path := fmt.Sprintf("zones/%s/argo/tiered_caching", params.ZoneID) @@ -46,7 +48,7 @@ func (r *TieredCachingService) Edit(ctx context.Context, params TieredCachingEdi } // Get Tiered Caching setting -func (r *TieredCachingService) Get(ctx context.Context, query TieredCachingGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *TieredCachingService) Get(ctx context.Context, query TieredCachingGetParams, opts ...option.RequestOption) (res *TieredCachingGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env TieredCachingGetResponseEnvelope path := fmt.Sprintf("zones/%s/argo/tiered_caching", query.ZoneID) @@ -58,6 +60,40 @@ func (r *TieredCachingService) Get(ctx context.Context, query TieredCachingGetPa return } +// Union satisfied by [argo.TieredCachingEditResponseUnknown] or +// [shared.UnionString]. +type TieredCachingEditResponseUnion interface { + ImplementsArgoTieredCachingEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*TieredCachingEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [argo.TieredCachingGetResponseUnknown] or +// [shared.UnionString]. +type TieredCachingGetResponseUnion interface { + ImplementsArgoTieredCachingGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*TieredCachingGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type TieredCachingEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -86,9 +122,9 @@ func (r TieredCachingEditParamsValue) IsKnown() bool { } type TieredCachingEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TieredCachingEditResponseUnion `json:"result,required"` // Whether the API call was successful Success TieredCachingEditResponseEnvelopeSuccess `json:"success,required"` JSON tieredCachingEditResponseEnvelopeJSON `json:"-"` @@ -134,9 +170,9 @@ type TieredCachingGetParams struct { } type TieredCachingGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TieredCachingGetResponseUnion `json:"result,required"` // Whether the API call was successful Success TieredCachingGetResponseEnvelopeSuccess `json:"success,required"` JSON tieredCachingGetResponseEnvelopeJSON `json:"-"` diff --git a/audit_logs/aliases.go b/audit_logs/aliases.go index d82e549a28c..1d50e2a20db 100644 --- a/audit_logs/aliases.go +++ b/audit_logs/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/billing/aliases.go b/billing/aliases.go index ab75544a108..f733ae2619a 100644 --- a/billing/aliases.go +++ b/billing/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/billing/profile.go b/billing/profile.go index f834e142140..1e8861be59e 100644 --- a/billing/profile.go +++ b/billing/profile.go @@ -6,11 +6,13 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // ProfileService contains methods and other services that help with interacting @@ -31,7 +33,7 @@ func NewProfileService(opts ...option.RequestOption) (r *ProfileService) { } // Gets the current billing profile for the account. -func (r *ProfileService) Get(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *ProfileService) Get(ctx context.Context, accountIdentifier interface{}, opts ...option.RequestOption) (res *ProfileGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env ProfileGetResponseEnvelope path := fmt.Sprintf("accounts/%v/billing/profile", accountIdentifier) @@ -43,10 +45,26 @@ func (r *ProfileService) Get(ctx context.Context, accountIdentifier interface{}, return } +// Union satisfied by [billing.ProfileGetResponseUnknown] or [shared.UnionString]. +type ProfileGetResponseUnion interface { + ImplementsBillingProfileGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ProfileGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type ProfileGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result ProfileGetResponseUnion `json:"result,required"` // Whether the API call was successful Success ProfileGetResponseEnvelopeSuccess `json:"success,required"` JSON profileGetResponseEnvelopeJSON `json:"-"` diff --git a/bot_management/aliases.go b/bot_management/aliases.go index b7a3bfb9a6c..9c648447663 100644 --- a/bot_management/aliases.go +++ b/bot_management/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/bot_management/botmanagement.go b/bot_management/botmanagement.go index 57ac27cd875..4265cb40d20 100644 --- a/bot_management/botmanagement.go +++ b/bot_management/botmanagement.go @@ -47,7 +47,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.getZoneID()) + path := fmt.Sprintf("zones/%s/bot_management", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -103,6 +103,20 @@ func (r BotFightModeConfiguration) implementsBotManagementBotManagementUpdateRes func (r BotFightModeConfiguration) implementsBotManagementBotManagementGetResponse() {} +type BotFightModeConfigurationParam struct { + // 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 BotFightModeConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r BotFightModeConfigurationParam) implementsBotManagementBotManagementUpdateParamsBodyUnion() {} + type SubscriptionConfiguration struct { // Automatically update to the newest bot detection models created by Cloudflare as // they are released. @@ -143,6 +157,25 @@ func (r SubscriptionConfiguration) implementsBotManagementBotManagementUpdateRes func (r SubscriptionConfiguration) implementsBotManagementBotManagementGetResponse() {} +type SubscriptionConfigurationParam struct { + // 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 SubscriptionConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SubscriptionConfigurationParam) implementsBotManagementBotManagementUpdateParamsBodyUnion() {} + type SuperBotFightModeDefinitelyConfiguration struct { // Use lightweight, invisible JavaScript detections to improve Bot Management. // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -222,6 +255,29 @@ func (r SuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots) IsKnown() bool return false } +type SuperBotFightModeDefinitelyConfigurationParam struct { + // 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[SuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated] `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[SuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots] `json:"sbfm_verified_bots"` +} + +func (r SuperBotFightModeDefinitelyConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SuperBotFightModeDefinitelyConfigurationParam) implementsBotManagementBotManagementUpdateParamsBodyUnion() { +} + type SuperBotFightModeLikelyConfiguration struct { // Use lightweight, invisible JavaScript detections to improve Bot Management. // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -320,6 +376,31 @@ func (r SuperBotFightModeLikelyConfigurationSbfmVerifiedBots) IsKnown() bool { return false } +type SuperBotFightModeLikelyConfigurationParam struct { + // 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[SuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + // Super Bot Fight Mode (SBFM) action to take on likely automated requests. + SbfmLikelyAutomated param.Field[SuperBotFightModeLikelyConfigurationSbfmLikelyAutomated] `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[SuperBotFightModeLikelyConfigurationSbfmVerifiedBots] `json:"sbfm_verified_bots"` +} + +func (r SuperBotFightModeLikelyConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SuperBotFightModeLikelyConfigurationParam) implementsBotManagementBotManagementUpdateParamsBodyUnion() { +} + type BotManagementUpdateResponse struct { // Use lightweight, invisible JavaScript detections to improve Bot Management. // [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -612,211 +693,108 @@ func (r BotManagementGetResponseSbfmLikelyAutomated) IsKnown() bool { return false } -// This interface is a union satisfied by one of the following: -// [BotManagementUpdateParamsBotFightModeConfiguration], -// [BotManagementUpdateParamsSuperBotFightModeDefinitelyConfiguration], -// [BotManagementUpdateParamsSuperBotFightModeLikelyConfiguration], -// [BotManagementUpdateParamsSubscriptionConfiguration]. -type BotManagementUpdateParams interface { - ImplementsBotManagementUpdateParams() - - getZoneID() param.Field[string] -} - -type BotManagementUpdateParamsBotFightModeConfiguration struct { +type BotManagementUpdateParams 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 enable Bot Fight Mode. - FightMode param.Field[bool] `json:"fight_mode"` -} - -func (r BotManagementUpdateParamsBotFightModeConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + ZoneID param.Field[string] `path:"zone_id,required"` + Body BotManagementUpdateParamsBodyUnion `json:"body,required"` } -func (r BotManagementUpdateParamsBotFightModeConfiguration) getZoneID() param.Field[string] { - return r.ZoneID +func (r BotManagementUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) } -func (BotManagementUpdateParamsBotFightModeConfiguration) ImplementsBotManagementUpdateParams() { - -} - -type BotManagementUpdateParamsSuperBotFightModeDefinitelyConfiguration struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` +type BotManagementUpdateParamsBody struct { // 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"` // 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[BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` + SbfmDefinitelyAutomated param.Field[BotManagementUpdateParamsBodySbfmDefinitelyAutomated] `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[BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots] `json:"sbfm_verified_bots"` + SbfmVerifiedBots param.Field[BotManagementUpdateParamsBodySbfmVerifiedBots] `json:"sbfm_verified_bots"` + // Super Bot Fight Mode (SBFM) action to take on likely automated requests. + SbfmLikelyAutomated param.Field[BotManagementUpdateParamsBodySbfmLikelyAutomated] `json:"sbfm_likely_automated"` + // 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"` + // 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 BotManagementUpdateParamsSuperBotFightModeDefinitelyConfiguration) MarshalJSON() (data []byte, err error) { +func (r BotManagementUpdateParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r BotManagementUpdateParamsSuperBotFightModeDefinitelyConfiguration) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (BotManagementUpdateParamsSuperBotFightModeDefinitelyConfiguration) ImplementsBotManagementUpdateParams() { +func (r BotManagementUpdateParamsBody) implementsBotManagementBotManagementUpdateParamsBodyUnion() {} +// Satisfied by [bot_management.BotFightModeConfigurationParam], +// [bot_management.SuperBotFightModeDefinitelyConfigurationParam], +// [bot_management.SuperBotFightModeLikelyConfigurationParam], +// [bot_management.SubscriptionConfigurationParam], +// [BotManagementUpdateParamsBody]. +type BotManagementUpdateParamsBodyUnion interface { + implementsBotManagementBotManagementUpdateParamsBodyUnion() } // Super Bot Fight Mode (SBFM) action to take on definitely automated requests. -type BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated string +type BotManagementUpdateParamsBodySbfmDefinitelyAutomated string const ( - BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedAllow BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated = "allow" - BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedBlock BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated = "block" - BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated = "managed_challenge" + BotManagementUpdateParamsBodySbfmDefinitelyAutomatedAllow BotManagementUpdateParamsBodySbfmDefinitelyAutomated = "allow" + BotManagementUpdateParamsBodySbfmDefinitelyAutomatedBlock BotManagementUpdateParamsBodySbfmDefinitelyAutomated = "block" + BotManagementUpdateParamsBodySbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsBodySbfmDefinitelyAutomated = "managed_challenge" ) -func (r BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomated) IsKnown() bool { +func (r BotManagementUpdateParamsBodySbfmDefinitelyAutomated) IsKnown() bool { switch r { - case BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmDefinitelyAutomatedManagedChallenge: + case BotManagementUpdateParamsBodySbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsBodySbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsBodySbfmDefinitelyAutomatedManagedChallenge: return true } return false } // Super Bot Fight Mode (SBFM) action to take on verified bots requests. -type BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots string - -const ( - BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBotsAllow BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots = "allow" - BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBotsBlock BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots = "block" -) - -func (r BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBots) IsKnown() bool { - switch r { - case BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBotsAllow, BotManagementUpdateParamsSuperBotFightModeDefinitelyConfigurationSbfmVerifiedBotsBlock: - return true - } - return false -} - -type BotManagementUpdateParamsSuperBotFightModeLikelyConfiguration 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[BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated] `json:"sbfm_definitely_automated"` - // Super Bot Fight Mode (SBFM) action to take on likely automated requests. - SbfmLikelyAutomated param.Field[BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated] `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[BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBots] `json:"sbfm_verified_bots"` -} - -func (r BotManagementUpdateParamsSuperBotFightModeLikelyConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r BotManagementUpdateParamsSuperBotFightModeLikelyConfiguration) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (BotManagementUpdateParamsSuperBotFightModeLikelyConfiguration) ImplementsBotManagementUpdateParams() { - -} - -// Super Bot Fight Mode (SBFM) action to take on definitely automated requests. -type BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated string +type BotManagementUpdateParamsBodySbfmVerifiedBots string const ( - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedAllow BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated = "allow" - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedBlock BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated = "block" - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedManagedChallenge BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated = "managed_challenge" + BotManagementUpdateParamsBodySbfmVerifiedBotsAllow BotManagementUpdateParamsBodySbfmVerifiedBots = "allow" + BotManagementUpdateParamsBodySbfmVerifiedBotsBlock BotManagementUpdateParamsBodySbfmVerifiedBots = "block" ) -func (r BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomated) IsKnown() bool { +func (r BotManagementUpdateParamsBodySbfmVerifiedBots) IsKnown() bool { switch r { - case BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedAllow, BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedBlock, BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmDefinitelyAutomatedManagedChallenge: + case BotManagementUpdateParamsBodySbfmVerifiedBotsAllow, BotManagementUpdateParamsBodySbfmVerifiedBotsBlock: return true } return false } // Super Bot Fight Mode (SBFM) action to take on likely automated requests. -type BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated string - -const ( - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedAllow BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated = "allow" - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedBlock BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated = "block" - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedManagedChallenge BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated = "managed_challenge" -) - -func (r BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomated) IsKnown() bool { - switch r { - case BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedAllow, BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedBlock, BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmLikelyAutomatedManagedChallenge: - return true - } - return false -} - -// Super Bot Fight Mode (SBFM) action to take on verified bots requests. -type BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBots string +type BotManagementUpdateParamsBodySbfmLikelyAutomated string const ( - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBotsAllow BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBots = "allow" - BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBotsBlock BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBots = "block" + BotManagementUpdateParamsBodySbfmLikelyAutomatedAllow BotManagementUpdateParamsBodySbfmLikelyAutomated = "allow" + BotManagementUpdateParamsBodySbfmLikelyAutomatedBlock BotManagementUpdateParamsBodySbfmLikelyAutomated = "block" + BotManagementUpdateParamsBodySbfmLikelyAutomatedManagedChallenge BotManagementUpdateParamsBodySbfmLikelyAutomated = "managed_challenge" ) -func (r BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBots) IsKnown() bool { +func (r BotManagementUpdateParamsBodySbfmLikelyAutomated) IsKnown() bool { switch r { - case BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBotsAllow, BotManagementUpdateParamsSuperBotFightModeLikelyConfigurationSbfmVerifiedBotsBlock: + case BotManagementUpdateParamsBodySbfmLikelyAutomatedAllow, BotManagementUpdateParamsBodySbfmLikelyAutomatedBlock, BotManagementUpdateParamsBodySbfmLikelyAutomatedManagedChallenge: return true } return false } -type BotManagementUpdateParamsSubscriptionConfiguration 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 BotManagementUpdateParamsSubscriptionConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r BotManagementUpdateParamsSubscriptionConfiguration) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (BotManagementUpdateParamsSubscriptionConfiguration) ImplementsBotManagementUpdateParams() { - -} - type BotManagementUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/bot_management/botmanagement_test.go b/bot_management/botmanagement_test.go index 30ab7e51dbf..c25749fc78b 100644 --- a/bot_management/botmanagement_test.go +++ b/bot_management/botmanagement_test.go @@ -28,10 +28,12 @@ func TestBotManagementUpdateWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.BotManagement.Update(context.TODO(), bot_management.BotManagementUpdateParamsBotFightModeConfiguration{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - EnableJs: cloudflare.F(true), - FightMode: cloudflare.F(true), + _, err := client.BotManagement.Update(context.TODO(), bot_management.BotManagementUpdateParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Body: bot_management.BotFightModeConfigurationParam{ + EnableJs: cloudflare.F(true), + FightMode: cloudflare.F(true), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/brand_protection/aliases.go b/brand_protection/aliases.go index 47b89fc1f3d..3c1190d680c 100644 --- a/brand_protection/aliases.go +++ b/brand_protection/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/cache/aliases.go b/cache/aliases.go index 6b96bab7ccb..43b34ca4313 100644 --- a/cache/aliases.go +++ b/cache/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/cache/cache.go b/cache/cache.go index 2112a8404f6..78bc7dadcd4 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -72,7 +72,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.getZoneID()) + path := fmt.Sprintf("zones/%s/purge_cache", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -103,130 +103,117 @@ func (r cachePurgeResponseJSON) RawJSON() string { return r.raw } -// 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 CachePurgeParams struct { + ZoneID param.Field[string] `path:"zone_id,required"` + Body CachePurgeParamsBodyUnion `json:"body,required"` } -type CachePurgeParamsCachePurgeTags struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Tags param.Field[[]string] `json:"tags"` +func (r CachePurgeParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) } -func (r CachePurgeParamsCachePurgeTags) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +type CachePurgeParamsBody struct { + Tags param.Field[interface{}] `json:"tags,required"` + Hosts param.Field[interface{}] `json:"hosts,required"` + Prefixes param.Field[interface{}] `json:"prefixes,required"` + PurgeEverything param.Field[bool] `json:"purge_everything"` + Files param.Field[interface{}] `json:"files,required"` } -func (r CachePurgeParamsCachePurgeTags) getZoneID() param.Field[string] { - return r.ZoneID +func (r CachePurgeParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (CachePurgeParamsCachePurgeTags) ImplementsCachePurgeParams() { +func (r CachePurgeParamsBody) implementsCacheCachePurgeParamsBodyUnion() {} +// Satisfied by [cache.CachePurgeParamsBodyCachePurgeTags], +// [cache.CachePurgeParamsBodyCachePurgeHosts], +// [cache.CachePurgeParamsBodyCachePurgePrefixes], +// [cache.CachePurgeParamsBodyCachePurgeEverything], +// [cache.CachePurgeParamsBodyCachePurgeFiles], [CachePurgeParamsBody]. +type CachePurgeParamsBodyUnion interface { + implementsCacheCachePurgeParamsBodyUnion() } -type CachePurgeParamsCachePurgeHosts struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Hosts param.Field[[]string] `json:"hosts"` +type CachePurgeParamsBodyCachePurgeTags struct { + Tags param.Field[[]string] `json:"tags"` } -func (r CachePurgeParamsCachePurgeHosts) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsBodyCachePurgeTags) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgeHosts) getZoneID() param.Field[string] { - return r.ZoneID -} +func (r CachePurgeParamsBodyCachePurgeTags) implementsCacheCachePurgeParamsBodyUnion() {} -func (CachePurgeParamsCachePurgeHosts) ImplementsCachePurgeParams() { +type CachePurgeParamsBodyCachePurgeHosts struct { + Hosts param.Field[[]string] `json:"hosts"` +} +func (r CachePurgeParamsBodyCachePurgeHosts) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type CachePurgeParamsCachePurgePrefixes struct { - ZoneID param.Field[string] `path:"zone_id,required"` +func (r CachePurgeParamsBodyCachePurgeHosts) implementsCacheCachePurgeParamsBodyUnion() {} + +type CachePurgeParamsBodyCachePurgePrefixes struct { Prefixes param.Field[[]string] `json:"prefixes"` } -func (r CachePurgeParamsCachePurgePrefixes) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsBodyCachePurgePrefixes) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgePrefixes) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (CachePurgeParamsCachePurgePrefixes) ImplementsCachePurgeParams() { +func (r CachePurgeParamsBodyCachePurgePrefixes) implementsCacheCachePurgeParamsBodyUnion() {} +type CachePurgeParamsBodyCachePurgeEverything struct { + PurgeEverything param.Field[bool] `json:"purge_everything"` } -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) { +func (r CachePurgeParamsBodyCachePurgeEverything) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgeEverything) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (CachePurgeParamsCachePurgeEverything) ImplementsCachePurgeParams() { - -} +func (r CachePurgeParamsBodyCachePurgeEverything) implementsCacheCachePurgeParamsBodyUnion() {} -type CachePurgeParamsCachePurgeFiles struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Files param.Field[[]CachePurgeParamsCachePurgeFilesFileUnion] `json:"files"` +type CachePurgeParamsBodyCachePurgeFiles struct { + Files param.Field[[]CachePurgeParamsBodyCachePurgeFilesFileUnion] `json:"files"` } -func (r CachePurgeParamsCachePurgeFiles) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsBodyCachePurgeFiles) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgeFiles) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (CachePurgeParamsCachePurgeFiles) ImplementsCachePurgeParams() { - -} +func (r CachePurgeParamsBodyCachePurgeFiles) implementsCacheCachePurgeParamsBodyUnion() {} -type CachePurgeParamsCachePurgeFilesFile struct { +type CachePurgeParamsBodyCachePurgeFilesFile struct { Headers param.Field[interface{}] `json:"headers,required"` URL param.Field[string] `json:"url"` } -func (r CachePurgeParamsCachePurgeFilesFile) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsBodyCachePurgeFilesFile) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgeFilesFile) ImplementsCacheCachePurgeParamsCachePurgeFilesFileUnion() { +func (r CachePurgeParamsBodyCachePurgeFilesFile) ImplementsCacheCachePurgeParamsBodyCachePurgeFilesFileUnion() { } // Satisfied by [shared.UnionString], -// [cache.CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders], -// [CachePurgeParamsCachePurgeFilesFile]. -type CachePurgeParamsCachePurgeFilesFileUnion interface { - ImplementsCacheCachePurgeParamsCachePurgeFilesFileUnion() +// [cache.CachePurgeParamsBodyCachePurgeFilesFilesCachePurgeURLAndHeaders], +// [CachePurgeParamsBodyCachePurgeFilesFile]. +type CachePurgeParamsBodyCachePurgeFilesFileUnion interface { + ImplementsCacheCachePurgeParamsBodyCachePurgeFilesFileUnion() } -type CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders struct { +type CachePurgeParamsBodyCachePurgeFilesFilesCachePurgeURLAndHeaders struct { Headers param.Field[interface{}] `json:"headers"` URL param.Field[string] `json:"url"` } -func (r CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders) MarshalJSON() (data []byte, err error) { +func (r CachePurgeParamsBodyCachePurgeFilesFilesCachePurgeURLAndHeaders) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r CachePurgeParamsCachePurgeFilesFilesCachePurgeURLAndHeaders) ImplementsCacheCachePurgeParamsCachePurgeFilesFileUnion() { +func (r CachePurgeParamsBodyCachePurgeFilesFilesCachePurgeURLAndHeaders) ImplementsCacheCachePurgeParamsBodyCachePurgeFilesFileUnion() { } type CachePurgeResponseEnvelope struct { diff --git a/cache/cache_test.go b/cache/cache_test.go index 046335c679b..d452bb279fd 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -28,9 +28,11 @@ func TestCachePurgeWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Cache.Purge(context.TODO(), cache.CachePurgeParamsCachePurgeTags{ + _, err := client.Cache.Purge(context.TODO(), cache.CachePurgeParams{ ZoneID: cloudflare.F("string"), - Tags: cloudflare.F([]string{"some-tag", "another-tag"}), + Body: cache.CachePurgeParamsBodyCachePurgeTags{ + Tags: cloudflare.F([]string{"some-tag", "another-tag"}), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/cache/cachereserve.go b/cache/cachereserve.go index ae85f51a744..030d60b4f52 100644 --- a/cache/cachereserve.go +++ b/cache/cachereserve.go @@ -117,15 +117,15 @@ func (r CacheReserve) IsKnown() bool { } // ID of the zone setting. -type UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d string +type CacheReserveClear string const ( - UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968dCacheReserveClear UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d = "cache_reserve_clear" + CacheReserveClearCacheReserveClear CacheReserveClear = "cache_reserve_clear" ) -func (r UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d) IsKnown() bool { +func (r CacheReserveClear) IsKnown() bool { switch r { - case UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968dCacheReserveClear: + case CacheReserveClearCacheReserveClear: return true } return false @@ -137,7 +137,7 @@ func (r UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d) IsKnown() bool { // that you cannot undo or cancel this operation. type CacheReserveClearResponse struct { // ID of the zone setting. - ID UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d `json:"id,required"` + ID CacheReserveClear `json:"id,required"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` // The time that the latest Cache Reserve Clear operation started. @@ -291,7 +291,7 @@ func (r CacheReserveGetResponseValue) IsKnown() bool { // that you cannot undo or cancel this operation. type CacheReserveStatusResponse struct { // ID of the zone setting. - ID UnnamedSchemaRef2b5e755404a4bfd7892291ce97c4968d `json:"id,required"` + ID CacheReserveClear `json:"id,required"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` // The time that the latest Cache Reserve Clear operation started. @@ -341,8 +341,8 @@ func (r CacheReserveStatusResponseState) IsKnown() bool { type CacheReserveClearParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r CacheReserveClearParams) MarshalJSON() (data []byte, err error) { diff --git a/cache/cachereserve_test.go b/cache/cachereserve_test.go index ef82e840d3f..af51eb1a1a0 100644 --- a/cache/cachereserve_test.go +++ b/cache/cachereserve_test.go @@ -30,7 +30,7 @@ func TestCacheReserveClear(t *testing.T) { ) _, err := client.Cache.CacheReserve.Clear(context.TODO(), cache.CacheReserveClearParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any]("{}"), + Body: "{}", }) if err != nil { var apierr *cloudflare.Error diff --git a/cache/smarttieredcache.go b/cache/smarttieredcache.go index 72222811e37..dbbbec55ad7 100644 --- a/cache/smarttieredcache.go +++ b/cache/smarttieredcache.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // SmartTieredCacheService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewSmartTieredCacheService(opts ...option.RequestOption) (r *SmartTieredCac } // Remvoves enablement of Smart Tiered Cache -func (r *SmartTieredCacheService) Delete(ctx context.Context, params SmartTieredCacheDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SmartTieredCacheService) Delete(ctx context.Context, params SmartTieredCacheDeleteParams, opts ...option.RequestOption) (res *SmartTieredCacheDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartTieredCacheDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", params.ZoneID) @@ -46,7 +48,7 @@ func (r *SmartTieredCacheService) Delete(ctx context.Context, params SmartTiered } // Updates enablement of Tiered Cache -func (r *SmartTieredCacheService) Edit(ctx context.Context, params SmartTieredCacheEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SmartTieredCacheService) Edit(ctx context.Context, params SmartTieredCacheEditParams, opts ...option.RequestOption) (res *SmartTieredCacheEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartTieredCacheEditResponseEnvelope path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", params.ZoneID) @@ -59,7 +61,7 @@ func (r *SmartTieredCacheService) Edit(ctx context.Context, params SmartTieredCa } // Get Smart Tiered Cache setting -func (r *SmartTieredCacheService) Get(ctx context.Context, query SmartTieredCacheGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SmartTieredCacheService) Get(ctx context.Context, query SmartTieredCacheGetParams, opts ...option.RequestOption) (res *SmartTieredCacheGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartTieredCacheGetResponseEnvelope path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", query.ZoneID) @@ -71,10 +73,61 @@ func (r *SmartTieredCacheService) Get(ctx context.Context, query SmartTieredCach return } +// Union satisfied by [cache.SmartTieredCacheDeleteResponseUnknown] or +// [shared.UnionString]. +type SmartTieredCacheDeleteResponseUnion interface { + ImplementsCacheSmartTieredCacheDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SmartTieredCacheDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [cache.SmartTieredCacheEditResponseUnknown] or +// [shared.UnionString]. +type SmartTieredCacheEditResponseUnion interface { + ImplementsCacheSmartTieredCacheEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SmartTieredCacheEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [cache.SmartTieredCacheGetResponseUnknown] or +// [shared.UnionString]. +type SmartTieredCacheGetResponseUnion interface { + ImplementsCacheSmartTieredCacheGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SmartTieredCacheGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type SmartTieredCacheDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r SmartTieredCacheDeleteParams) MarshalJSON() (data []byte, err error) { @@ -82,9 +135,9 @@ func (r SmartTieredCacheDeleteParams) MarshalJSON() (data []byte, err error) { } type SmartTieredCacheDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SmartTieredCacheDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success SmartTieredCacheDeleteResponseEnvelopeSuccess `json:"success,required"` JSON smartTieredCacheDeleteResponseEnvelopeJSON `json:"-"` @@ -152,9 +205,9 @@ func (r SmartTieredCacheEditParamsValue) IsKnown() bool { } type SmartTieredCacheEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SmartTieredCacheEditResponseUnion `json:"result,required"` // Whether the API call was successful Success SmartTieredCacheEditResponseEnvelopeSuccess `json:"success,required"` JSON smartTieredCacheEditResponseEnvelopeJSON `json:"-"` @@ -200,9 +253,9 @@ type SmartTieredCacheGetParams struct { } type SmartTieredCacheGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SmartTieredCacheGetResponseUnion `json:"result,required"` // Whether the API call was successful Success SmartTieredCacheGetResponseEnvelopeSuccess `json:"success,required"` JSON smartTieredCacheGetResponseEnvelopeJSON `json:"-"` diff --git a/cache/smarttieredcache_test.go b/cache/smarttieredcache_test.go index aad9eb0b416..661bf82872f 100644 --- a/cache/smarttieredcache_test.go +++ b/cache/smarttieredcache_test.go @@ -30,7 +30,7 @@ func TestSmartTieredCacheDelete(t *testing.T) { ) _, err := client.Cache.SmartTieredCache.Delete(context.TODO(), cache.SmartTieredCacheDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/cache/variant.go b/cache/variant.go index 9d1d7d58af3..ff9d012756d 100644 --- a/cache/variant.go +++ b/cache/variant.go @@ -37,7 +37,7 @@ func NewVariantService(opts ...option.RequestOption) (r *VariantService) { // 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but // does not serve the variant requested, the response will not be cached. This will // be indicated with BYPASS cache status in the response headers. -func (r *VariantService) Delete(ctx context.Context, params VariantDeleteParams, opts ...option.RequestOption) (res *CacheVariants, err error) { +func (r *VariantService) Delete(ctx context.Context, params VariantDeleteParams, opts ...option.RequestOption) (res *CacheVariant, err error) { opts = append(r.Options[:], opts...) var env VariantDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/cache/variants", params.ZoneID) @@ -88,40 +88,40 @@ func (r *VariantService) Get(ctx context.Context, query VariantGetParams, opts . // 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but // does not serve the variant requested, the response will not be cached. This will // be indicated with BYPASS cache status in the response headers. -type CacheVariants struct { +type CacheVariant struct { // ID of the zone setting. - ID UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 `json:"id,required"` + ID CacheVariantIdentifier `json:"id,required"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` - JSON cacheVariantsJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` + JSON cacheVariantJSON `json:"-"` } -// cacheVariantsJSON contains the JSON metadata for the struct [CacheVariants] -type cacheVariantsJSON struct { +// cacheVariantJSON contains the JSON metadata for the struct [CacheVariant] +type cacheVariantJSON struct { ID apijson.Field ModifiedOn apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CacheVariants) UnmarshalJSON(data []byte) (err error) { +func (r *CacheVariant) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r cacheVariantsJSON) RawJSON() string { +func (r cacheVariantJSON) RawJSON() string { return r.raw } // ID of the zone setting. -type UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 string +type CacheVariantIdentifier string const ( - UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0Variants UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 = "variants" + CacheVariantIdentifierVariants CacheVariantIdentifier = "variants" ) -func (r UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0) IsKnown() bool { +func (r CacheVariantIdentifier) IsKnown() bool { switch r { - case UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0Variants: + case CacheVariantIdentifierVariants: return true } return false @@ -134,7 +134,7 @@ func (r UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0) IsKnown() bool { // be indicated with BYPASS cache status in the response headers. type VariantEditResponse struct { // ID of the zone setting. - ID UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 `json:"id,required"` + ID CacheVariantIdentifier `json:"id,required"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` // Value of the zone setting. @@ -231,7 +231,7 @@ func (r variantEditResponseValueJSON) RawJSON() string { // be indicated with BYPASS cache status in the response headers. type VariantGetResponse struct { // ID of the zone setting. - ID UnnamedSchemaRef669bfbb16c0913af7077c3c194fbfcd0 `json:"id,required"` + ID CacheVariantIdentifier `json:"id,required"` // last time this setting was modified. ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` // Value of the zone setting. @@ -323,8 +323,8 @@ func (r variantGetResponseValueJSON) RawJSON() string { type VariantDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r VariantDeleteParams) MarshalJSON() (data []byte, err error) { @@ -339,7 +339,7 @@ type VariantDeleteResponseEnvelope struct { // 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but // does not serve the variant requested, the response will not be cached. This will // be indicated with BYPASS cache status in the response headers. - Result CacheVariants `json:"result,required"` + Result CacheVariant `json:"result,required"` // Whether the API call was successful Success VariantDeleteResponseEnvelopeSuccess `json:"success,required"` JSON variantDeleteResponseEnvelopeJSON `json:"-"` diff --git a/cache/variant_test.go b/cache/variant_test.go index 20f6536433e..fc9b3f6b763 100644 --- a/cache/variant_test.go +++ b/cache/variant_test.go @@ -30,7 +30,7 @@ func TestVariantDelete(t *testing.T) { ) _, err := client.Cache.Variants.Delete(context.TODO(), cache.VariantDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/calls/aliases.go b/calls/aliases.go index 3fc4f7a2e27..ed73bf39b8e 100644 --- a/calls/aliases.go +++ b/calls/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/certificate_authorities/aliases.go b/certificate_authorities/aliases.go index d6dab97ad41..eb290ffd20b 100644 --- a/certificate_authorities/aliases.go +++ b/certificate_authorities/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/certificate_authorities/hostnameassociation.go b/certificate_authorities/hostnameassociation.go index 8254554100e..9ac2362bd9e 100644 --- a/certificate_authorities/hostnameassociation.go +++ b/certificate_authorities/hostnameassociation.go @@ -64,6 +64,18 @@ type HostnameAssociation = string type HostnameAssociationParam = string +type TLSHostnameAssociationParam struct { + Hostnames param.Field[[]HostnameAssociationParam] `json:"hostnames"` + // The UUID for a certificate that was uploaded to the mTLS Certificate Management + // endpoint. If no mtls_certificate_id is given, the hostnames will be associated + // to your active Cloudflare Managed CA. + MTLSCertificateID param.Field[string] `json:"mtls_certificate_id"` +} + +func (r TLSHostnameAssociationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type HostnameAssociationUpdateResponse struct { Hostnames []HostnameAssociation `json:"hostnames"` JSON hostnameAssociationUpdateResponseJSON `json:"-"` @@ -108,16 +120,12 @@ func (r hostnameAssociationGetResponseJSON) RawJSON() string { type HostnameAssociationUpdateParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Hostnames param.Field[[]HostnameAssociationParam] `json:"hostnames"` - // The UUID for a certificate that was uploaded to the mTLS Certificate Management - // endpoint. If no mtls_certificate_id is given, the hostnames will be associated - // to your active Cloudflare Managed CA. - MTLSCertificateID param.Field[string] `json:"mtls_certificate_id"` + ZoneID param.Field[string] `path:"zone_id,required"` + TLSHostnameAssociation TLSHostnameAssociationParam `json:"tls_hostname_association,required"` } func (r HostnameAssociationUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.TLSHostnameAssociation) } type HostnameAssociationUpdateResponseEnvelope struct { diff --git a/certificate_authorities/hostnameassociation_test.go b/certificate_authorities/hostnameassociation_test.go index bb7d80f3216..fb40cc9e557 100644 --- a/certificate_authorities/hostnameassociation_test.go +++ b/certificate_authorities/hostnameassociation_test.go @@ -29,9 +29,11 @@ func TestHostnameAssociationUpdateWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.CertificateAuthorities.HostnameAssociations.Update(context.TODO(), certificate_authorities.HostnameAssociationUpdateParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Hostnames: cloudflare.F([]certificate_authorities.HostnameAssociationParam{"api.example.com", "api.example.com", "api.example.com"}), - MTLSCertificateID: cloudflare.F("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + TLSHostnameAssociation: certificate_authorities.TLSHostnameAssociationParam{ + Hostnames: cloudflare.F([]certificate_authorities.HostnameAssociationParam{"api.example.com", "api.example.com", "api.example.com"}), + MTLSCertificateID: cloudflare.F("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/challenges/aliases.go b/challenges/aliases.go index 3d4fd1f60ee..136d541781d 100644 --- a/challenges/aliases.go +++ b/challenges/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/client_certificates/aliases.go b/client_certificates/aliases.go index 94e0e24790b..05c4011bd17 100644 --- a/client_certificates/aliases.go +++ b/client_certificates/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/cloudforce_one/aliases.go b/cloudforce_one/aliases.go index b772343aada..6469e44f3d3 100644 --- a/cloudforce_one/aliases.go +++ b/cloudforce_one/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/cloudforce_one/requestpriority.go b/cloudforce_one/requestpriority.go index 51744f0215c..c11633c7654 100644 --- a/cloudforce_one/requestpriority.go +++ b/cloudforce_one/requestpriority.go @@ -162,6 +162,40 @@ func (r PriorityTlp) IsKnown() bool { return false } +type PriorityEditParam struct { + // List of labels + Labels param.Field[[]LabelParam] `json:"labels,required"` + // Priority + Priority param.Field[int64] `json:"priority,required"` + // Requirement + Requirement param.Field[string] `json:"requirement,required"` + // The CISA defined Traffic Light Protocol (TLP) + Tlp param.Field[PriorityEditTlp] `json:"tlp,required"` +} + +func (r PriorityEditParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The CISA defined Traffic Light Protocol (TLP) +type PriorityEditTlp string + +const ( + PriorityEditTlpClear PriorityEditTlp = "clear" + PriorityEditTlpAmber PriorityEditTlp = "amber" + PriorityEditTlpAmberStrict PriorityEditTlp = "amber-strict" + PriorityEditTlpGreen PriorityEditTlp = "green" + PriorityEditTlpRed PriorityEditTlp = "red" +) + +func (r PriorityEditTlp) IsKnown() bool { + switch r { + case PriorityEditTlpClear, PriorityEditTlpAmber, PriorityEditTlpAmberStrict, PriorityEditTlpGreen, PriorityEditTlpRed: + return true + } + return false +} + // Union satisfied by [cloudforce_one.RequestPriorityDeleteResponseUnknown], // [cloudforce_one.RequestPriorityDeleteResponseArray] or [shared.UnionString]. type RequestPriorityDeleteResponseUnion interface { @@ -189,37 +223,11 @@ func (r RequestPriorityDeleteResponseArray) ImplementsCloudforceOneRequestPriori } type RequestPriorityNewParams struct { - // List of labels - Labels param.Field[[]LabelParam] `json:"labels,required"` - // Priority - Priority param.Field[int64] `json:"priority,required"` - // Requirement - Requirement param.Field[string] `json:"requirement,required"` - // The CISA defined Traffic Light Protocol (TLP) - Tlp param.Field[RequestPriorityNewParamsTlp] `json:"tlp,required"` + PriorityEdit PriorityEditParam `json:"priority_edit,required"` } func (r RequestPriorityNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The CISA defined Traffic Light Protocol (TLP) -type RequestPriorityNewParamsTlp string - -const ( - RequestPriorityNewParamsTlpClear RequestPriorityNewParamsTlp = "clear" - RequestPriorityNewParamsTlpAmber RequestPriorityNewParamsTlp = "amber" - RequestPriorityNewParamsTlpAmberStrict RequestPriorityNewParamsTlp = "amber-strict" - RequestPriorityNewParamsTlpGreen RequestPriorityNewParamsTlp = "green" - RequestPriorityNewParamsTlpRed RequestPriorityNewParamsTlp = "red" -) - -func (r RequestPriorityNewParamsTlp) IsKnown() bool { - switch r { - case RequestPriorityNewParamsTlpClear, RequestPriorityNewParamsTlpAmber, RequestPriorityNewParamsTlpAmberStrict, RequestPriorityNewParamsTlpGreen, RequestPriorityNewParamsTlpRed: - return true - } - return false + return apijson.MarshalRoot(r.PriorityEdit) } type RequestPriorityNewResponseEnvelope struct { @@ -266,37 +274,11 @@ func (r RequestPriorityNewResponseEnvelopeSuccess) IsKnown() bool { } type RequestPriorityUpdateParams struct { - // List of labels - Labels param.Field[[]LabelParam] `json:"labels,required"` - // Priority - Priority param.Field[int64] `json:"priority,required"` - // Requirement - Requirement param.Field[string] `json:"requirement,required"` - // The CISA defined Traffic Light Protocol (TLP) - Tlp param.Field[RequestPriorityUpdateParamsTlp] `json:"tlp,required"` + PriorityEdit PriorityEditParam `json:"priority_edit,required"` } func (r RequestPriorityUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The CISA defined Traffic Light Protocol (TLP) -type RequestPriorityUpdateParamsTlp string - -const ( - RequestPriorityUpdateParamsTlpClear RequestPriorityUpdateParamsTlp = "clear" - RequestPriorityUpdateParamsTlpAmber RequestPriorityUpdateParamsTlp = "amber" - RequestPriorityUpdateParamsTlpAmberStrict RequestPriorityUpdateParamsTlp = "amber-strict" - RequestPriorityUpdateParamsTlpGreen RequestPriorityUpdateParamsTlp = "green" - RequestPriorityUpdateParamsTlpRed RequestPriorityUpdateParamsTlp = "red" -) - -func (r RequestPriorityUpdateParamsTlp) IsKnown() bool { - switch r { - case RequestPriorityUpdateParamsTlpClear, RequestPriorityUpdateParamsTlpAmber, RequestPriorityUpdateParamsTlpAmberStrict, RequestPriorityUpdateParamsTlpGreen, RequestPriorityUpdateParamsTlpRed: - return true - } - return false + return apijson.MarshalRoot(r.PriorityEdit) } type RequestPriorityUpdateResponseEnvelope struct { diff --git a/cloudforce_one/requestpriority_test.go b/cloudforce_one/requestpriority_test.go index 0801ed1229a..4888c2d1deb 100644 --- a/cloudforce_one/requestpriority_test.go +++ b/cloudforce_one/requestpriority_test.go @@ -32,10 +32,12 @@ func TestRequestPriorityNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudforce_one.RequestPriorityNewParams{ - Labels: cloudflare.F([]cloudforce_one.LabelParam{"DoS", "CVE"}), - Priority: cloudflare.F(int64(1)), - Requirement: cloudflare.F("DoS attacks carried out by CVEs"), - Tlp: cloudflare.F(cloudforce_one.RequestPriorityNewParamsTlpClear), + PriorityEdit: cloudforce_one.PriorityEditParam{ + Labels: cloudflare.F([]cloudforce_one.LabelParam{"DoS", "CVE"}), + Priority: cloudflare.F(int64(1)), + Requirement: cloudflare.F("DoS attacks carried out by CVEs"), + Tlp: cloudflare.F(cloudforce_one.PriorityEditTlpClear), + }, }, ) if err != nil { @@ -66,10 +68,12 @@ func TestRequestPriorityUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", cloudforce_one.RequestPriorityUpdateParams{ - Labels: cloudflare.F([]cloudforce_one.LabelParam{"DoS", "CVE"}), - Priority: cloudflare.F(int64(1)), - Requirement: cloudflare.F("DoS attacks carried out by CVEs"), - Tlp: cloudflare.F(cloudforce_one.RequestPriorityUpdateParamsTlpClear), + PriorityEdit: cloudforce_one.PriorityEditParam{ + Labels: cloudflare.F([]cloudforce_one.LabelParam{"DoS", "CVE"}), + Priority: cloudflare.F(int64(1)), + Requirement: cloudflare.F("DoS attacks carried out by CVEs"), + Tlp: cloudflare.F(cloudforce_one.PriorityEditTlpClear), + }, }, ) if err != nil { diff --git a/custom_certificates/aliases.go b/custom_certificates/aliases.go index b805a1cf2a3..42dab9fcbdd 100644 --- a/custom_certificates/aliases.go +++ b/custom_certificates/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/custom_certificates/customcertificate.go b/custom_certificates/customcertificate.go index 2ea03b2dc07..5f1cd33ce6b 100644 --- a/custom_certificates/customcertificate.go +++ b/custom_certificates/customcertificate.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/custom_hostnames" @@ -18,6 +19,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/keyless_certificates" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // CustomCertificateService contains methods and other services that help with @@ -41,7 +43,7 @@ func NewCustomCertificateService(opts ...option.RequestOption) (r *CustomCertifi } // Upload a new SSL certificate for a zone. -func (r *CustomCertificateService) New(ctx context.Context, params CustomCertificateNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *CustomCertificateService) New(ctx context.Context, params CustomCertificateNewParams, opts ...option.RequestOption) (res *CustomCertificateNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env CustomCertificateNewResponseEnvelope path := fmt.Sprintf("zones/%s/custom_certificates", params.ZoneID) @@ -96,7 +98,7 @@ func (r *CustomCertificateService) Delete(ctx context.Context, customCertificate // Upload a new private key and/or PEM/CRT for the SSL certificate. Note: PATCHing // a configuration for sni_custom certificates will result in a new resource id // being returned, and the previous one being deleted. -func (r *CustomCertificateService) Edit(ctx context.Context, customCertificateID string, params CustomCertificateEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *CustomCertificateService) Edit(ctx context.Context, customCertificateID string, params CustomCertificateEditParams, opts ...option.RequestOption) (res *CustomCertificateEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env CustomCertificateEditResponseEnvelope path := fmt.Sprintf("zones/%s/custom_certificates/%s", params.ZoneID, customCertificateID) @@ -109,7 +111,7 @@ func (r *CustomCertificateService) Edit(ctx context.Context, customCertificateID } // SSL Configuration Details -func (r *CustomCertificateService) Get(ctx context.Context, customCertificateID string, query CustomCertificateGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *CustomCertificateService) Get(ctx context.Context, customCertificateID string, query CustomCertificateGetParams, opts ...option.RequestOption) (res *CustomCertificateGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env CustomCertificateGetResponseEnvelope path := fmt.Sprintf("zones/%s/custom_certificates/%s", query.ZoneID, customCertificateID) @@ -128,7 +130,7 @@ type CustomCertificate struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 `json:"bundle_method,required"` + BundleMethod custom_hostnames.BundleMethod `json:"bundle_method,required"` // When the certificate from the authority expires. ExpiresOn time.Time `json:"expires_on,required" format:"date-time"` Hosts []string `json:"hosts,required"` @@ -277,6 +279,23 @@ func (r GeoRestrictionsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Union satisfied by [custom_certificates.CustomCertificateNewResponseUnknown] or +// [shared.UnionString]. +type CustomCertificateNewResponseUnion interface { + ImplementsCustomCertificatesCustomCertificateNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*CustomCertificateNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type CustomCertificateDeleteResponse struct { // Identifier ID string `json:"id"` @@ -299,6 +318,40 @@ func (r customCertificateDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [custom_certificates.CustomCertificateEditResponseUnknown] or +// [shared.UnionString]. +type CustomCertificateEditResponseUnion interface { + ImplementsCustomCertificatesCustomCertificateEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*CustomCertificateEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [custom_certificates.CustomCertificateGetResponseUnknown] or +// [shared.UnionString]. +type CustomCertificateGetResponseUnion interface { + ImplementsCustomCertificatesCustomCertificateGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*CustomCertificateGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type CustomCertificateNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -310,7 +363,7 @@ type CustomCertificateNewParams struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[custom_hostnames.BundleMethod] `json:"bundle_method"` // Specify the region where your private key can be held locally for optimal TLS // performance. HTTPS connections to any excluded data center will still be fully // encrypted, but will incur some latency while Keyless SSL is used to complete the @@ -356,9 +409,9 @@ func (r CustomCertificateNewParamsType) IsKnown() bool { } type CustomCertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomCertificateNewResponseUnion `json:"result,required"` // Whether the API call was successful Success CustomCertificateNewResponseEnvelopeSuccess `json:"success,required"` JSON customCertificateNewResponseEnvelopeJSON `json:"-"` @@ -457,8 +510,8 @@ func (r CustomCertificateListParamsStatus) IsKnown() bool { type CustomCertificateDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r CustomCertificateDeleteParams) MarshalJSON() (data []byte, err error) { @@ -515,7 +568,7 @@ type CustomCertificateEditParams struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[custom_hostnames.BundleMethod] `json:"bundle_method"` // The zone's SSL certificate or certificate and the intermediate(s). Certificate param.Field[string] `json:"certificate"` // Specify the region where your private key can be held locally for optimal TLS @@ -545,9 +598,9 @@ func (r CustomCertificateEditParams) MarshalJSON() (data []byte, err error) { } type CustomCertificateEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomCertificateEditResponseUnion `json:"result,required"` // Whether the API call was successful Success CustomCertificateEditResponseEnvelopeSuccess `json:"success,required"` JSON customCertificateEditResponseEnvelopeJSON `json:"-"` @@ -593,9 +646,9 @@ type CustomCertificateGetParams struct { } type CustomCertificateGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomCertificateGetResponseUnion `json:"result,required"` // Whether the API call was successful Success CustomCertificateGetResponseEnvelopeSuccess `json:"success,required"` JSON customCertificateGetResponseEnvelopeJSON `json:"-"` diff --git a/custom_certificates/customcertificate_test.go b/custom_certificates/customcertificate_test.go index 9f3790e4673..ba46385c715 100644 --- a/custom_certificates/customcertificate_test.go +++ b/custom_certificates/customcertificate_test.go @@ -33,7 +33,7 @@ func TestCustomCertificateNewWithOptionalParams(t *testing.T) { ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), PrivateKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), GeoRestrictions: cloudflare.F(custom_certificates.GeoRestrictionsParam{ Label: cloudflare.F(custom_certificates.GeoRestrictionsLabelUs), }), @@ -98,7 +98,7 @@ func TestCustomCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", custom_certificates.CustomCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -129,7 +129,7 @@ func TestCustomCertificateEditWithOptionalParams(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", custom_certificates.CustomCertificateEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), GeoRestrictions: cloudflare.F(custom_certificates.GeoRestrictionsParam{ Label: cloudflare.F(custom_certificates.GeoRestrictionsLabelUs), diff --git a/custom_hostnames/aliases.go b/custom_hostnames/aliases.go index 0f31a655170..661b3bd51f7 100644 --- a/custom_hostnames/aliases.go +++ b/custom_hostnames/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/custom_hostnames/customhostname.go b/custom_hostnames/customhostname.go index 40e9f2af331..fe8506a80a0 100644 --- a/custom_hostnames/customhostname.go +++ b/custom_hostnames/customhostname.go @@ -45,7 +45,7 @@ func NewCustomHostnameService(opts ...option.RequestOption) (r *CustomHostnameSe // plus hostmaster, postmaster, webmaster, admin, administrator. If http is used // and the domain is not already pointing to the Managed CNAME host, the PATCH // method must be used once it is (to complete validation). -func (r *CustomHostnameService) New(ctx context.Context, params CustomHostnameNewParams, opts ...option.RequestOption) (res *CustomHostname, err error) { +func (r *CustomHostnameService) New(ctx context.Context, params CustomHostnameNewParams, opts ...option.RequestOption) (res *CustomHostnameNewResponse, err error) { opts = append(r.Options[:], opts...) var env CustomHostnameNewResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames", params.ZoneID) @@ -58,7 +58,7 @@ func (r *CustomHostnameService) New(ctx context.Context, params CustomHostnameNe } // List, search, sort, and filter all of your custom hostnames. -func (r *CustomHostnameService) List(ctx context.Context, params CustomHostnameListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[CustomHostname], err error) { +func (r *CustomHostnameService) List(ctx context.Context, params CustomHostnameListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[CustomHostnameListResponse], err error) { var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -76,7 +76,7 @@ func (r *CustomHostnameService) List(ctx context.Context, params CustomHostnameL } // List, search, sort, and filter all of your custom hostnames. -func (r *CustomHostnameService) ListAutoPaging(ctx context.Context, params CustomHostnameListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[CustomHostname] { +func (r *CustomHostnameService) ListAutoPaging(ctx context.Context, params CustomHostnameListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[CustomHostnameListResponse] { return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) } @@ -92,7 +92,7 @@ func (r *CustomHostnameService) Delete(ctx context.Context, customHostnameID str // matches existing config, used to indicate that hostname should pass domain // control validation (DCV). Can also be used to change validation type, e.g., from // 'http' to 'email'. -func (r *CustomHostnameService) Edit(ctx context.Context, customHostnameID string, params CustomHostnameEditParams, opts ...option.RequestOption) (res *CustomHostname, err error) { +func (r *CustomHostnameService) Edit(ctx context.Context, customHostnameID string, params CustomHostnameEditParams, opts ...option.RequestOption) (res *CustomHostnameEditResponse, err error) { opts = append(r.Options[:], opts...) var env CustomHostnameEditResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames/%s", params.ZoneID, customHostnameID) @@ -105,7 +105,7 @@ func (r *CustomHostnameService) Edit(ctx context.Context, customHostnameID strin } // Custom Hostname Details -func (r *CustomHostnameService) Get(ctx context.Context, customHostnameID string, query CustomHostnameGetParams, opts ...option.RequestOption) (res *CustomHostname, err error) { +func (r *CustomHostnameService) Get(ctx context.Context, customHostnameID string, query CustomHostnameGetParams, opts ...option.RequestOption) (res *CustomHostnameGetResponse, err error) { opts = append(r.Options[:], opts...) var env CustomHostnameGetResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames/%s", query.ZoneID, customHostnameID) @@ -117,169 +117,768 @@ func (r *CustomHostnameService) Get(ctx context.Context, customHostnameID string return } -type CustomHostname struct { +// A ubiquitous bundle has the highest probability of being verified everywhere, +// even by clients using outdated or unusual trust stores. An optimal bundle uses +// the shortest chain and newest intermediates. And the force bundle verifies the +// chain, but does not otherwise modify it. +type BundleMethod string + +const ( + BundleMethodUbiquitous BundleMethod = "ubiquitous" + BundleMethodOptimal BundleMethod = "optimal" + BundleMethodForce BundleMethod = "force" +) + +func (r BundleMethod) IsKnown() bool { + switch r { + case BundleMethodUbiquitous, BundleMethodOptimal, BundleMethodForce: + return true + } + return false +} + +// Domain control validation (DCV) method used for this hostname. +type DCVMethod string + +const ( + DCVMethodHTTP DCVMethod = "http" + DCVMethodTXT DCVMethod = "txt" + DCVMethodEmail DCVMethod = "email" +) + +func (r DCVMethod) IsKnown() bool { + switch r { + case DCVMethodHTTP, DCVMethodTXT, DCVMethodEmail: + return true + } + return false +} + +// Level of validation to be used for this hostname. Domain validation (dv) must be +// used. +type DomainValidationType string + +const ( + DomainValidationTypeDv DomainValidationType = "dv" +) + +func (r DomainValidationType) IsKnown() bool { + switch r { + case DomainValidationTypeDv: + return true + } + return false +} + +type CustomHostnameNewResponse struct { // Identifier + ID string `json:"id,required"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname,required"` + // SSL properties for the custom hostname. + SSL CustomHostnameNewResponseSSL `json:"ssl,required"` + JSON customHostnameNewResponseJSON `json:"-"` +} + +// customHostnameNewResponseJSON contains the JSON metadata for the struct +// [CustomHostnameNewResponse] +type customHostnameNewResponseJSON struct { + ID apijson.Field + Hostname apijson.Field + SSL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameNewResponseJSON) RawJSON() string { + return r.raw +} + +// SSL properties for the custom hostname. +type CustomHostnameNewResponseSSL struct { + // Custom hostname SSL identifier tag. ID string `json:"id"` - // This is the time the hostname was created. - CreatedAt time.Time `json:"created_at" format:"date-time"` - // These are per-hostname (customer) settings. - CustomMetadata CustomHostnameCustomMetadata `json:"custom_metadata"` - // a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME - // record. - CustomOriginServer string `json:"custom_origin_server"` - // A hostname that will be sent to your custom origin server as SNI for TLS - // handshake. This can be a valid subdomain of the zone or custom origin server - // name or the string ':request_host_header:' which will cause the host header in - // the request to be used as SNI. Not configurable with default/fallback origin - // server. - CustomOriginSni string `json:"custom_origin_sni"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod BundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority CustomHostnameNewResponseSSLCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method DCVMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings CustomHostnameNewResponseSSLSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status CustomHostnameNewResponseSSLStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type DomainValidationType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []CustomHostnameNewResponseSSLValidationError `json:"validation_errors"` + ValidationRecords []CustomHostnameNewResponseSSLValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON customHostnameNewResponseSSLJSON `json:"-"` +} + +// customHostnameNewResponseSSLJSON contains the JSON metadata for the struct +// [CustomHostnameNewResponseSSL] +type customHostnameNewResponseSSLJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameNewResponseSSL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameNewResponseSSLJSON) RawJSON() string { + return r.raw +} + +// The Certificate Authority that will issue the certificate +type CustomHostnameNewResponseSSLCertificateAuthority string + +const ( + CustomHostnameNewResponseSSLCertificateAuthorityDigicert CustomHostnameNewResponseSSLCertificateAuthority = "digicert" + CustomHostnameNewResponseSSLCertificateAuthorityGoogle CustomHostnameNewResponseSSLCertificateAuthority = "google" + CustomHostnameNewResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameNewResponseSSLCertificateAuthority = "lets_encrypt" +) + +func (r CustomHostnameNewResponseSSLCertificateAuthority) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLCertificateAuthorityDigicert, CustomHostnameNewResponseSSLCertificateAuthorityGoogle, CustomHostnameNewResponseSSLCertificateAuthorityLetsEncrypt: + return true + } + return false +} + +// SSL specific settings. +type CustomHostnameNewResponseSSLSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints CustomHostnameNewResponseSSLSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + HTTP2 CustomHostnameNewResponseSSLSettingsHTTP2 `json:"http2"` + // The minimum TLS version supported. + MinTLSVersion CustomHostnameNewResponseSSLSettingsMinTLSVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + TLS1_3 CustomHostnameNewResponseSSLSettingsTLS1_3 `json:"tls_1_3"` + JSON customHostnameNewResponseSSLSettingsJSON `json:"-"` +} + +// customHostnameNewResponseSSLSettingsJSON contains the JSON metadata for the +// struct [CustomHostnameNewResponseSSLSettings] +type customHostnameNewResponseSSLSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + HTTP2 apijson.Field + MinTLSVersion apijson.Field + TLS1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameNewResponseSSLSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameNewResponseSSLSettingsJSON) RawJSON() string { + return r.raw +} + +// Whether or not Early Hints is enabled. +type CustomHostnameNewResponseSSLSettingsEarlyHints string + +const ( + CustomHostnameNewResponseSSLSettingsEarlyHintsOn CustomHostnameNewResponseSSLSettingsEarlyHints = "on" + CustomHostnameNewResponseSSLSettingsEarlyHintsOff CustomHostnameNewResponseSSLSettingsEarlyHints = "off" +) + +func (r CustomHostnameNewResponseSSLSettingsEarlyHints) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLSettingsEarlyHintsOn, CustomHostnameNewResponseSSLSettingsEarlyHintsOff: + return true + } + return false +} + +// Whether or not HTTP2 is enabled. +type CustomHostnameNewResponseSSLSettingsHTTP2 string + +const ( + CustomHostnameNewResponseSSLSettingsHTTP2On CustomHostnameNewResponseSSLSettingsHTTP2 = "on" + CustomHostnameNewResponseSSLSettingsHTTP2Off CustomHostnameNewResponseSSLSettingsHTTP2 = "off" +) + +func (r CustomHostnameNewResponseSSLSettingsHTTP2) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLSettingsHTTP2On, CustomHostnameNewResponseSSLSettingsHTTP2Off: + return true + } + return false +} + +// The minimum TLS version supported. +type CustomHostnameNewResponseSSLSettingsMinTLSVersion string + +const ( + CustomHostnameNewResponseSSLSettingsMinTLSVersion1_0 CustomHostnameNewResponseSSLSettingsMinTLSVersion = "1.0" + CustomHostnameNewResponseSSLSettingsMinTLSVersion1_1 CustomHostnameNewResponseSSLSettingsMinTLSVersion = "1.1" + CustomHostnameNewResponseSSLSettingsMinTLSVersion1_2 CustomHostnameNewResponseSSLSettingsMinTLSVersion = "1.2" + CustomHostnameNewResponseSSLSettingsMinTLSVersion1_3 CustomHostnameNewResponseSSLSettingsMinTLSVersion = "1.3" +) + +func (r CustomHostnameNewResponseSSLSettingsMinTLSVersion) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLSettingsMinTLSVersion1_0, CustomHostnameNewResponseSSLSettingsMinTLSVersion1_1, CustomHostnameNewResponseSSLSettingsMinTLSVersion1_2, CustomHostnameNewResponseSSLSettingsMinTLSVersion1_3: + return true + } + return false +} + +// Whether or not TLS 1.3 is enabled. +type CustomHostnameNewResponseSSLSettingsTLS1_3 string + +const ( + CustomHostnameNewResponseSSLSettingsTLS1_3On CustomHostnameNewResponseSSLSettingsTLS1_3 = "on" + CustomHostnameNewResponseSSLSettingsTLS1_3Off CustomHostnameNewResponseSSLSettingsTLS1_3 = "off" +) + +func (r CustomHostnameNewResponseSSLSettingsTLS1_3) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLSettingsTLS1_3On, CustomHostnameNewResponseSSLSettingsTLS1_3Off: + return true + } + return false +} + +// Status of the hostname's SSL certificates. +type CustomHostnameNewResponseSSLStatus string + +const ( + CustomHostnameNewResponseSSLStatusInitializing CustomHostnameNewResponseSSLStatus = "initializing" + CustomHostnameNewResponseSSLStatusPendingValidation CustomHostnameNewResponseSSLStatus = "pending_validation" + CustomHostnameNewResponseSSLStatusDeleted CustomHostnameNewResponseSSLStatus = "deleted" + CustomHostnameNewResponseSSLStatusPendingIssuance CustomHostnameNewResponseSSLStatus = "pending_issuance" + CustomHostnameNewResponseSSLStatusPendingDeployment CustomHostnameNewResponseSSLStatus = "pending_deployment" + CustomHostnameNewResponseSSLStatusPendingDeletion CustomHostnameNewResponseSSLStatus = "pending_deletion" + CustomHostnameNewResponseSSLStatusPendingExpiration CustomHostnameNewResponseSSLStatus = "pending_expiration" + CustomHostnameNewResponseSSLStatusExpired CustomHostnameNewResponseSSLStatus = "expired" + CustomHostnameNewResponseSSLStatusActive CustomHostnameNewResponseSSLStatus = "active" + CustomHostnameNewResponseSSLStatusInitializingTimedOut CustomHostnameNewResponseSSLStatus = "initializing_timed_out" + CustomHostnameNewResponseSSLStatusValidationTimedOut CustomHostnameNewResponseSSLStatus = "validation_timed_out" + CustomHostnameNewResponseSSLStatusIssuanceTimedOut CustomHostnameNewResponseSSLStatus = "issuance_timed_out" + CustomHostnameNewResponseSSLStatusDeploymentTimedOut CustomHostnameNewResponseSSLStatus = "deployment_timed_out" + CustomHostnameNewResponseSSLStatusDeletionTimedOut CustomHostnameNewResponseSSLStatus = "deletion_timed_out" + CustomHostnameNewResponseSSLStatusPendingCleanup CustomHostnameNewResponseSSLStatus = "pending_cleanup" + CustomHostnameNewResponseSSLStatusStagingDeployment CustomHostnameNewResponseSSLStatus = "staging_deployment" + CustomHostnameNewResponseSSLStatusStagingActive CustomHostnameNewResponseSSLStatus = "staging_active" + CustomHostnameNewResponseSSLStatusDeactivating CustomHostnameNewResponseSSLStatus = "deactivating" + CustomHostnameNewResponseSSLStatusInactive CustomHostnameNewResponseSSLStatus = "inactive" + CustomHostnameNewResponseSSLStatusBackupIssued CustomHostnameNewResponseSSLStatus = "backup_issued" + CustomHostnameNewResponseSSLStatusHoldingDeployment CustomHostnameNewResponseSSLStatus = "holding_deployment" +) + +func (r CustomHostnameNewResponseSSLStatus) IsKnown() bool { + switch r { + case CustomHostnameNewResponseSSLStatusInitializing, CustomHostnameNewResponseSSLStatusPendingValidation, CustomHostnameNewResponseSSLStatusDeleted, CustomHostnameNewResponseSSLStatusPendingIssuance, CustomHostnameNewResponseSSLStatusPendingDeployment, CustomHostnameNewResponseSSLStatusPendingDeletion, CustomHostnameNewResponseSSLStatusPendingExpiration, CustomHostnameNewResponseSSLStatusExpired, CustomHostnameNewResponseSSLStatusActive, CustomHostnameNewResponseSSLStatusInitializingTimedOut, CustomHostnameNewResponseSSLStatusValidationTimedOut, CustomHostnameNewResponseSSLStatusIssuanceTimedOut, CustomHostnameNewResponseSSLStatusDeploymentTimedOut, CustomHostnameNewResponseSSLStatusDeletionTimedOut, CustomHostnameNewResponseSSLStatusPendingCleanup, CustomHostnameNewResponseSSLStatusStagingDeployment, CustomHostnameNewResponseSSLStatusStagingActive, CustomHostnameNewResponseSSLStatusDeactivating, CustomHostnameNewResponseSSLStatusInactive, CustomHostnameNewResponseSSLStatusBackupIssued, CustomHostnameNewResponseSSLStatusHoldingDeployment: + return true + } + return false +} + +type CustomHostnameNewResponseSSLValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON customHostnameNewResponseSSLValidationErrorJSON `json:"-"` +} + +// customHostnameNewResponseSSLValidationErrorJSON contains the JSON metadata for +// the struct [CustomHostnameNewResponseSSLValidationError] +type customHostnameNewResponseSSLValidationErrorJSON struct { + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameNewResponseSSLValidationError) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameNewResponseSSLValidationErrorJSON) RawJSON() string { + return r.raw +} + +// Certificate's required validation record. +type CustomHostnameNewResponseSSLValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TXTName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TXTValue string `json:"txt_value"` + JSON customHostnameNewResponseSSLValidationRecordJSON `json:"-"` +} + +// customHostnameNewResponseSSLValidationRecordJSON contains the JSON metadata for +// the struct [CustomHostnameNewResponseSSLValidationRecord] +type customHostnameNewResponseSSLValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TXTName apijson.Field + TXTValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameNewResponseSSLValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameNewResponseSSLValidationRecordJSON) RawJSON() string { + return r.raw +} + +type CustomHostnameListResponse struct { + // Identifier + ID string `json:"id,required"` // The custom hostname that will point to your hostname via CNAME. - Hostname string `json:"hostname"` - // This is a record which can be placed to activate a hostname. - OwnershipVerification CustomHostnameOwnershipVerification `json:"ownership_verification"` - // This presents the token to be served by the given http url to activate a - // hostname. - OwnershipVerificationHTTP CustomHostnameOwnershipVerificationHTTP `json:"ownership_verification_http"` + Hostname string `json:"hostname,required"` // SSL properties for the custom hostname. - SSL CustomHostnameSSL `json:"ssl"` - // Status of the hostname's activation. - Status CustomHostnameStatus `json:"status"` - // These are errors that were encountered while trying to activate a hostname. - VerificationErrors []interface{} `json:"verification_errors"` - JSON customHostnameJSON `json:"-"` -} - -// customHostnameJSON contains the JSON metadata for the struct [CustomHostname] -type customHostnameJSON struct { - ID apijson.Field - CreatedAt apijson.Field - CustomMetadata apijson.Field - CustomOriginServer apijson.Field - CustomOriginSni apijson.Field - Hostname apijson.Field - OwnershipVerification apijson.Field - OwnershipVerificationHTTP apijson.Field - SSL apijson.Field - Status apijson.Field - VerificationErrors apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *CustomHostname) UnmarshalJSON(data []byte) (err error) { + SSL CustomHostnameListResponseSSL `json:"ssl,required"` + JSON customHostnameListResponseJSON `json:"-"` +} + +// customHostnameListResponseJSON contains the JSON metadata for the struct +// [CustomHostnameListResponse] +type customHostnameListResponseJSON struct { + ID apijson.Field + Hostname apijson.Field + SSL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameJSON) RawJSON() string { - return r.raw +func (r customHostnameListResponseJSON) RawJSON() string { + return r.raw +} + +// SSL properties for the custom hostname. +type CustomHostnameListResponseSSL struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod BundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority CustomHostnameListResponseSSLCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method DCVMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings CustomHostnameListResponseSSLSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status CustomHostnameListResponseSSLStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type DomainValidationType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []CustomHostnameListResponseSSLValidationError `json:"validation_errors"` + ValidationRecords []CustomHostnameListResponseSSLValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON customHostnameListResponseSSLJSON `json:"-"` +} + +// customHostnameListResponseSSLJSON contains the JSON metadata for the struct +// [CustomHostnameListResponseSSL] +type customHostnameListResponseSSLJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameListResponseSSL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameListResponseSSLJSON) RawJSON() string { + return r.raw +} + +// The Certificate Authority that will issue the certificate +type CustomHostnameListResponseSSLCertificateAuthority string + +const ( + CustomHostnameListResponseSSLCertificateAuthorityDigicert CustomHostnameListResponseSSLCertificateAuthority = "digicert" + CustomHostnameListResponseSSLCertificateAuthorityGoogle CustomHostnameListResponseSSLCertificateAuthority = "google" + CustomHostnameListResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameListResponseSSLCertificateAuthority = "lets_encrypt" +) + +func (r CustomHostnameListResponseSSLCertificateAuthority) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLCertificateAuthorityDigicert, CustomHostnameListResponseSSLCertificateAuthorityGoogle, CustomHostnameListResponseSSLCertificateAuthorityLetsEncrypt: + return true + } + return false +} + +// SSL specific settings. +type CustomHostnameListResponseSSLSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints CustomHostnameListResponseSSLSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + HTTP2 CustomHostnameListResponseSSLSettingsHTTP2 `json:"http2"` + // The minimum TLS version supported. + MinTLSVersion CustomHostnameListResponseSSLSettingsMinTLSVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + TLS1_3 CustomHostnameListResponseSSLSettingsTLS1_3 `json:"tls_1_3"` + JSON customHostnameListResponseSSLSettingsJSON `json:"-"` +} + +// customHostnameListResponseSSLSettingsJSON contains the JSON metadata for the +// struct [CustomHostnameListResponseSSLSettings] +type customHostnameListResponseSSLSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + HTTP2 apijson.Field + MinTLSVersion apijson.Field + TLS1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameListResponseSSLSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameListResponseSSLSettingsJSON) RawJSON() string { + return r.raw +} + +// Whether or not Early Hints is enabled. +type CustomHostnameListResponseSSLSettingsEarlyHints string + +const ( + CustomHostnameListResponseSSLSettingsEarlyHintsOn CustomHostnameListResponseSSLSettingsEarlyHints = "on" + CustomHostnameListResponseSSLSettingsEarlyHintsOff CustomHostnameListResponseSSLSettingsEarlyHints = "off" +) + +func (r CustomHostnameListResponseSSLSettingsEarlyHints) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLSettingsEarlyHintsOn, CustomHostnameListResponseSSLSettingsEarlyHintsOff: + return true + } + return false +} + +// Whether or not HTTP2 is enabled. +type CustomHostnameListResponseSSLSettingsHTTP2 string + +const ( + CustomHostnameListResponseSSLSettingsHTTP2On CustomHostnameListResponseSSLSettingsHTTP2 = "on" + CustomHostnameListResponseSSLSettingsHTTP2Off CustomHostnameListResponseSSLSettingsHTTP2 = "off" +) + +func (r CustomHostnameListResponseSSLSettingsHTTP2) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLSettingsHTTP2On, CustomHostnameListResponseSSLSettingsHTTP2Off: + return true + } + return false +} + +// The minimum TLS version supported. +type CustomHostnameListResponseSSLSettingsMinTLSVersion string + +const ( + CustomHostnameListResponseSSLSettingsMinTLSVersion1_0 CustomHostnameListResponseSSLSettingsMinTLSVersion = "1.0" + CustomHostnameListResponseSSLSettingsMinTLSVersion1_1 CustomHostnameListResponseSSLSettingsMinTLSVersion = "1.1" + CustomHostnameListResponseSSLSettingsMinTLSVersion1_2 CustomHostnameListResponseSSLSettingsMinTLSVersion = "1.2" + CustomHostnameListResponseSSLSettingsMinTLSVersion1_3 CustomHostnameListResponseSSLSettingsMinTLSVersion = "1.3" +) + +func (r CustomHostnameListResponseSSLSettingsMinTLSVersion) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLSettingsMinTLSVersion1_0, CustomHostnameListResponseSSLSettingsMinTLSVersion1_1, CustomHostnameListResponseSSLSettingsMinTLSVersion1_2, CustomHostnameListResponseSSLSettingsMinTLSVersion1_3: + return true + } + return false +} + +// Whether or not TLS 1.3 is enabled. +type CustomHostnameListResponseSSLSettingsTLS1_3 string + +const ( + CustomHostnameListResponseSSLSettingsTLS1_3On CustomHostnameListResponseSSLSettingsTLS1_3 = "on" + CustomHostnameListResponseSSLSettingsTLS1_3Off CustomHostnameListResponseSSLSettingsTLS1_3 = "off" +) + +func (r CustomHostnameListResponseSSLSettingsTLS1_3) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLSettingsTLS1_3On, CustomHostnameListResponseSSLSettingsTLS1_3Off: + return true + } + return false +} + +// Status of the hostname's SSL certificates. +type CustomHostnameListResponseSSLStatus string + +const ( + CustomHostnameListResponseSSLStatusInitializing CustomHostnameListResponseSSLStatus = "initializing" + CustomHostnameListResponseSSLStatusPendingValidation CustomHostnameListResponseSSLStatus = "pending_validation" + CustomHostnameListResponseSSLStatusDeleted CustomHostnameListResponseSSLStatus = "deleted" + CustomHostnameListResponseSSLStatusPendingIssuance CustomHostnameListResponseSSLStatus = "pending_issuance" + CustomHostnameListResponseSSLStatusPendingDeployment CustomHostnameListResponseSSLStatus = "pending_deployment" + CustomHostnameListResponseSSLStatusPendingDeletion CustomHostnameListResponseSSLStatus = "pending_deletion" + CustomHostnameListResponseSSLStatusPendingExpiration CustomHostnameListResponseSSLStatus = "pending_expiration" + CustomHostnameListResponseSSLStatusExpired CustomHostnameListResponseSSLStatus = "expired" + CustomHostnameListResponseSSLStatusActive CustomHostnameListResponseSSLStatus = "active" + CustomHostnameListResponseSSLStatusInitializingTimedOut CustomHostnameListResponseSSLStatus = "initializing_timed_out" + CustomHostnameListResponseSSLStatusValidationTimedOut CustomHostnameListResponseSSLStatus = "validation_timed_out" + CustomHostnameListResponseSSLStatusIssuanceTimedOut CustomHostnameListResponseSSLStatus = "issuance_timed_out" + CustomHostnameListResponseSSLStatusDeploymentTimedOut CustomHostnameListResponseSSLStatus = "deployment_timed_out" + CustomHostnameListResponseSSLStatusDeletionTimedOut CustomHostnameListResponseSSLStatus = "deletion_timed_out" + CustomHostnameListResponseSSLStatusPendingCleanup CustomHostnameListResponseSSLStatus = "pending_cleanup" + CustomHostnameListResponseSSLStatusStagingDeployment CustomHostnameListResponseSSLStatus = "staging_deployment" + CustomHostnameListResponseSSLStatusStagingActive CustomHostnameListResponseSSLStatus = "staging_active" + CustomHostnameListResponseSSLStatusDeactivating CustomHostnameListResponseSSLStatus = "deactivating" + CustomHostnameListResponseSSLStatusInactive CustomHostnameListResponseSSLStatus = "inactive" + CustomHostnameListResponseSSLStatusBackupIssued CustomHostnameListResponseSSLStatus = "backup_issued" + CustomHostnameListResponseSSLStatusHoldingDeployment CustomHostnameListResponseSSLStatus = "holding_deployment" +) + +func (r CustomHostnameListResponseSSLStatus) IsKnown() bool { + switch r { + case CustomHostnameListResponseSSLStatusInitializing, CustomHostnameListResponseSSLStatusPendingValidation, CustomHostnameListResponseSSLStatusDeleted, CustomHostnameListResponseSSLStatusPendingIssuance, CustomHostnameListResponseSSLStatusPendingDeployment, CustomHostnameListResponseSSLStatusPendingDeletion, CustomHostnameListResponseSSLStatusPendingExpiration, CustomHostnameListResponseSSLStatusExpired, CustomHostnameListResponseSSLStatusActive, CustomHostnameListResponseSSLStatusInitializingTimedOut, CustomHostnameListResponseSSLStatusValidationTimedOut, CustomHostnameListResponseSSLStatusIssuanceTimedOut, CustomHostnameListResponseSSLStatusDeploymentTimedOut, CustomHostnameListResponseSSLStatusDeletionTimedOut, CustomHostnameListResponseSSLStatusPendingCleanup, CustomHostnameListResponseSSLStatusStagingDeployment, CustomHostnameListResponseSSLStatusStagingActive, CustomHostnameListResponseSSLStatusDeactivating, CustomHostnameListResponseSSLStatusInactive, CustomHostnameListResponseSSLStatusBackupIssued, CustomHostnameListResponseSSLStatusHoldingDeployment: + return true + } + return false } -// These are per-hostname (customer) settings. -type CustomHostnameCustomMetadata struct { - // Unique metadata for this hostname. - Key string `json:"key"` - JSON customHostnameCustomMetadataJSON `json:"-"` +type CustomHostnameListResponseSSLValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON customHostnameListResponseSSLValidationErrorJSON `json:"-"` } -// customHostnameCustomMetadataJSON contains the JSON metadata for the struct -// [CustomHostnameCustomMetadata] -type customHostnameCustomMetadataJSON struct { - Key apijson.Field +// customHostnameListResponseSSLValidationErrorJSON contains the JSON metadata for +// the struct [CustomHostnameListResponseSSLValidationError] +type customHostnameListResponseSSLValidationErrorJSON struct { + Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CustomHostnameCustomMetadata) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameListResponseSSLValidationError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameCustomMetadataJSON) RawJSON() string { +func (r customHostnameListResponseSSLValidationErrorJSON) RawJSON() string { return r.raw } -// This is a record which can be placed to activate a hostname. -type CustomHostnameOwnershipVerification struct { - // DNS Name for record. - Name string `json:"name"` - // DNS Record type. - Type CustomHostnameOwnershipVerificationType `json:"type"` - // Content for the record. - Value string `json:"value"` - JSON customHostnameOwnershipVerificationJSON `json:"-"` +// Certificate's required validation record. +type CustomHostnameListResponseSSLValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TXTName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TXTValue string `json:"txt_value"` + JSON customHostnameListResponseSSLValidationRecordJSON `json:"-"` } -// customHostnameOwnershipVerificationJSON contains the JSON metadata for the -// struct [CustomHostnameOwnershipVerification] -type customHostnameOwnershipVerificationJSON struct { - Name apijson.Field - Type apijson.Field - Value apijson.Field +// customHostnameListResponseSSLValidationRecordJSON contains the JSON metadata for +// the struct [CustomHostnameListResponseSSLValidationRecord] +type customHostnameListResponseSSLValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TXTName apijson.Field + TXTValue apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CustomHostnameOwnershipVerification) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameListResponseSSLValidationRecord) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameOwnershipVerificationJSON) RawJSON() string { +func (r customHostnameListResponseSSLValidationRecordJSON) RawJSON() string { return r.raw } -// DNS Record type. -type CustomHostnameOwnershipVerificationType string +type CustomHostnameDeleteResponse struct { + // Identifier + ID string `json:"id"` + JSON customHostnameDeleteResponseJSON `json:"-"` +} -const ( - CustomHostnameOwnershipVerificationTypeTXT CustomHostnameOwnershipVerificationType = "txt" -) +// customHostnameDeleteResponseJSON contains the JSON metadata for the struct +// [CustomHostnameDeleteResponse] +type customHostnameDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r CustomHostnameOwnershipVerificationType) IsKnown() bool { - switch r { - case CustomHostnameOwnershipVerificationTypeTXT: - return true - } - return false +func (r *CustomHostnameDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -// This presents the token to be served by the given http url to activate a -// hostname. -type CustomHostnameOwnershipVerificationHTTP struct { - // Token to be served. - HTTPBody string `json:"http_body"` - // The HTTP URL that will be checked during custom hostname verification and where - // the customer should host the token. - HTTPURL string `json:"http_url"` - JSON customHostnameOwnershipVerificationHTTPJSON `json:"-"` +func (r customHostnameDeleteResponseJSON) RawJSON() string { + return r.raw } -// customHostnameOwnershipVerificationHTTPJSON contains the JSON metadata for the -// struct [CustomHostnameOwnershipVerificationHTTP] -type customHostnameOwnershipVerificationHTTPJSON struct { - HTTPBody apijson.Field - HTTPURL apijson.Field +type CustomHostnameEditResponse struct { + // Identifier + ID string `json:"id,required"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname,required"` + // SSL properties for the custom hostname. + SSL CustomHostnameEditResponseSSL `json:"ssl,required"` + JSON customHostnameEditResponseJSON `json:"-"` +} + +// customHostnameEditResponseJSON contains the JSON metadata for the struct +// [CustomHostnameEditResponse] +type customHostnameEditResponseJSON struct { + ID apijson.Field + Hostname apijson.Field + SSL apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CustomHostnameOwnershipVerificationHTTP) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameOwnershipVerificationHTTPJSON) RawJSON() string { +func (r customHostnameEditResponseJSON) RawJSON() string { return r.raw } // SSL properties for the custom hostname. -type CustomHostnameSSL struct { +type CustomHostnameEditResponseSSL struct { // Custom hostname SSL identifier tag. ID string `json:"id"` // A ubiquitous bundle has the highest probability of being verified everywhere, // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 `json:"bundle_method"` + BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority CustomHostnameSSLCertificateAuthority `json:"certificate_authority"` + CertificateAuthority CustomHostnameEditResponseSSLCertificateAuthority `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -293,32 +892,32 @@ type CustomHostnameSSL struct { // The issuer on a custom uploaded certificate. Issuer string `json:"issuer"` // Domain control validation (DCV) method used for this hostname. - Method UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 `json:"method"` + Method DCVMethod `json:"method"` // The serial number on a custom uploaded certificate. SerialNumber string `json:"serial_number"` // SSL specific settings. - Settings CustomHostnameSSLSettings `json:"settings"` + Settings CustomHostnameEditResponseSSLSettings `json:"settings"` // The signature on a custom uploaded certificate. Signature string `json:"signature"` // Status of the hostname's SSL certificates. - Status CustomHostnameSSLStatus `json:"status"` + Status CustomHostnameEditResponseSSLStatus `json:"status"` // Level of validation to be used for this hostname. Domain validation (dv) must be // used. - Type UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 `json:"type"` + Type DomainValidationType `json:"type"` // The time the custom certificate was uploaded. UploadedOn time.Time `json:"uploaded_on" format:"date-time"` // Domain validation errors that have been received by the certificate authority // (CA). - ValidationErrors []CustomHostnameSSLValidationError `json:"validation_errors"` - ValidationRecords []CustomHostnameSSLValidationRecord `json:"validation_records"` + ValidationErrors []CustomHostnameEditResponseSSLValidationError `json:"validation_errors"` + ValidationRecords []CustomHostnameEditResponseSSLValidationRecord `json:"validation_records"` // Indicates whether the certificate covers a wildcard. - Wildcard bool `json:"wildcard"` - JSON customHostnameSSLJSON `json:"-"` + Wildcard bool `json:"wildcard"` + JSON customHostnameEditResponseSSLJSON `json:"-"` } -// customHostnameSSLJSON contains the JSON metadata for the struct -// [CustomHostnameSSL] -type customHostnameSSLJSON struct { +// customHostnameEditResponseSSLJSON contains the JSON metadata for the struct +// [CustomHostnameEditResponseSSL] +type customHostnameEditResponseSSLJSON struct { ID apijson.Field BundleMethod apijson.Field CertificateAuthority apijson.Field @@ -342,50 +941,50 @@ type customHostnameSSLJSON struct { ExtraFields map[string]apijson.Field } -func (r *CustomHostnameSSL) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameEditResponseSSL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameSSLJSON) RawJSON() string { +func (r customHostnameEditResponseSSLJSON) RawJSON() string { return r.raw } // The Certificate Authority that will issue the certificate -type CustomHostnameSSLCertificateAuthority string +type CustomHostnameEditResponseSSLCertificateAuthority string const ( - CustomHostnameSSLCertificateAuthorityDigicert CustomHostnameSSLCertificateAuthority = "digicert" - CustomHostnameSSLCertificateAuthorityGoogle CustomHostnameSSLCertificateAuthority = "google" - CustomHostnameSSLCertificateAuthorityLetsEncrypt CustomHostnameSSLCertificateAuthority = "lets_encrypt" + CustomHostnameEditResponseSSLCertificateAuthorityDigicert CustomHostnameEditResponseSSLCertificateAuthority = "digicert" + CustomHostnameEditResponseSSLCertificateAuthorityGoogle CustomHostnameEditResponseSSLCertificateAuthority = "google" + CustomHostnameEditResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameEditResponseSSLCertificateAuthority = "lets_encrypt" ) -func (r CustomHostnameSSLCertificateAuthority) IsKnown() bool { +func (r CustomHostnameEditResponseSSLCertificateAuthority) IsKnown() bool { switch r { - case CustomHostnameSSLCertificateAuthorityDigicert, CustomHostnameSSLCertificateAuthorityGoogle, CustomHostnameSSLCertificateAuthorityLetsEncrypt: + case CustomHostnameEditResponseSSLCertificateAuthorityDigicert, CustomHostnameEditResponseSSLCertificateAuthorityGoogle, CustomHostnameEditResponseSSLCertificateAuthorityLetsEncrypt: return true } return false } // SSL specific settings. -type CustomHostnameSSLSettings struct { +type CustomHostnameEditResponseSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the // BoringSSL format. Ciphers []string `json:"ciphers"` // Whether or not Early Hints is enabled. - EarlyHints CustomHostnameSSLSettingsEarlyHints `json:"early_hints"` + EarlyHints CustomHostnameEditResponseSSLSettingsEarlyHints `json:"early_hints"` // Whether or not HTTP2 is enabled. - HTTP2 CustomHostnameSSLSettingsHTTP2 `json:"http2"` + HTTP2 CustomHostnameEditResponseSSLSettingsHTTP2 `json:"http2"` // The minimum TLS version supported. - MinTLSVersion CustomHostnameSSLSettingsMinTLSVersion `json:"min_tls_version"` + MinTLSVersion CustomHostnameEditResponseSSLSettingsMinTLSVersion `json:"min_tls_version"` // Whether or not TLS 1.3 is enabled. - TLS1_3 CustomHostnameSSLSettingsTLS1_3 `json:"tls_1_3"` - JSON customHostnameSSLSettingsJSON `json:"-"` + TLS1_3 CustomHostnameEditResponseSSLSettingsTLS1_3 `json:"tls_1_3"` + JSON customHostnameEditResponseSSLSettingsJSON `json:"-"` } -// customHostnameSSLSettingsJSON contains the JSON metadata for the struct -// [CustomHostnameSSLSettings] -type customHostnameSSLSettingsJSON struct { +// customHostnameEditResponseSSLSettingsJSON contains the JSON metadata for the +// struct [CustomHostnameEditResponseSSLSettings] +type customHostnameEditResponseSSLSettingsJSON struct { Ciphers apijson.Field EarlyHints apijson.Field HTTP2 apijson.Field @@ -395,139 +994,139 @@ type customHostnameSSLSettingsJSON struct { ExtraFields map[string]apijson.Field } -func (r *CustomHostnameSSLSettings) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameEditResponseSSLSettings) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameSSLSettingsJSON) RawJSON() string { +func (r customHostnameEditResponseSSLSettingsJSON) RawJSON() string { return r.raw } // Whether or not Early Hints is enabled. -type CustomHostnameSSLSettingsEarlyHints string +type CustomHostnameEditResponseSSLSettingsEarlyHints string const ( - CustomHostnameSSLSettingsEarlyHintsOn CustomHostnameSSLSettingsEarlyHints = "on" - CustomHostnameSSLSettingsEarlyHintsOff CustomHostnameSSLSettingsEarlyHints = "off" + CustomHostnameEditResponseSSLSettingsEarlyHintsOn CustomHostnameEditResponseSSLSettingsEarlyHints = "on" + CustomHostnameEditResponseSSLSettingsEarlyHintsOff CustomHostnameEditResponseSSLSettingsEarlyHints = "off" ) -func (r CustomHostnameSSLSettingsEarlyHints) IsKnown() bool { +func (r CustomHostnameEditResponseSSLSettingsEarlyHints) IsKnown() bool { switch r { - case CustomHostnameSSLSettingsEarlyHintsOn, CustomHostnameSSLSettingsEarlyHintsOff: + case CustomHostnameEditResponseSSLSettingsEarlyHintsOn, CustomHostnameEditResponseSSLSettingsEarlyHintsOff: return true } return false } // Whether or not HTTP2 is enabled. -type CustomHostnameSSLSettingsHTTP2 string +type CustomHostnameEditResponseSSLSettingsHTTP2 string const ( - CustomHostnameSSLSettingsHTTP2On CustomHostnameSSLSettingsHTTP2 = "on" - CustomHostnameSSLSettingsHTTP2Off CustomHostnameSSLSettingsHTTP2 = "off" + CustomHostnameEditResponseSSLSettingsHTTP2On CustomHostnameEditResponseSSLSettingsHTTP2 = "on" + CustomHostnameEditResponseSSLSettingsHTTP2Off CustomHostnameEditResponseSSLSettingsHTTP2 = "off" ) -func (r CustomHostnameSSLSettingsHTTP2) IsKnown() bool { +func (r CustomHostnameEditResponseSSLSettingsHTTP2) IsKnown() bool { switch r { - case CustomHostnameSSLSettingsHTTP2On, CustomHostnameSSLSettingsHTTP2Off: + case CustomHostnameEditResponseSSLSettingsHTTP2On, CustomHostnameEditResponseSSLSettingsHTTP2Off: return true } return false } // The minimum TLS version supported. -type CustomHostnameSSLSettingsMinTLSVersion string +type CustomHostnameEditResponseSSLSettingsMinTLSVersion string const ( - CustomHostnameSSLSettingsMinTLSVersion1_0 CustomHostnameSSLSettingsMinTLSVersion = "1.0" - CustomHostnameSSLSettingsMinTLSVersion1_1 CustomHostnameSSLSettingsMinTLSVersion = "1.1" - CustomHostnameSSLSettingsMinTLSVersion1_2 CustomHostnameSSLSettingsMinTLSVersion = "1.2" - CustomHostnameSSLSettingsMinTLSVersion1_3 CustomHostnameSSLSettingsMinTLSVersion = "1.3" + CustomHostnameEditResponseSSLSettingsMinTLSVersion1_0 CustomHostnameEditResponseSSLSettingsMinTLSVersion = "1.0" + CustomHostnameEditResponseSSLSettingsMinTLSVersion1_1 CustomHostnameEditResponseSSLSettingsMinTLSVersion = "1.1" + CustomHostnameEditResponseSSLSettingsMinTLSVersion1_2 CustomHostnameEditResponseSSLSettingsMinTLSVersion = "1.2" + CustomHostnameEditResponseSSLSettingsMinTLSVersion1_3 CustomHostnameEditResponseSSLSettingsMinTLSVersion = "1.3" ) -func (r CustomHostnameSSLSettingsMinTLSVersion) IsKnown() bool { +func (r CustomHostnameEditResponseSSLSettingsMinTLSVersion) IsKnown() bool { switch r { - case CustomHostnameSSLSettingsMinTLSVersion1_0, CustomHostnameSSLSettingsMinTLSVersion1_1, CustomHostnameSSLSettingsMinTLSVersion1_2, CustomHostnameSSLSettingsMinTLSVersion1_3: + case CustomHostnameEditResponseSSLSettingsMinTLSVersion1_0, CustomHostnameEditResponseSSLSettingsMinTLSVersion1_1, CustomHostnameEditResponseSSLSettingsMinTLSVersion1_2, CustomHostnameEditResponseSSLSettingsMinTLSVersion1_3: return true } return false } // Whether or not TLS 1.3 is enabled. -type CustomHostnameSSLSettingsTLS1_3 string +type CustomHostnameEditResponseSSLSettingsTLS1_3 string const ( - CustomHostnameSSLSettingsTLS1_3On CustomHostnameSSLSettingsTLS1_3 = "on" - CustomHostnameSSLSettingsTLS1_3Off CustomHostnameSSLSettingsTLS1_3 = "off" + CustomHostnameEditResponseSSLSettingsTLS1_3On CustomHostnameEditResponseSSLSettingsTLS1_3 = "on" + CustomHostnameEditResponseSSLSettingsTLS1_3Off CustomHostnameEditResponseSSLSettingsTLS1_3 = "off" ) -func (r CustomHostnameSSLSettingsTLS1_3) IsKnown() bool { +func (r CustomHostnameEditResponseSSLSettingsTLS1_3) IsKnown() bool { switch r { - case CustomHostnameSSLSettingsTLS1_3On, CustomHostnameSSLSettingsTLS1_3Off: + case CustomHostnameEditResponseSSLSettingsTLS1_3On, CustomHostnameEditResponseSSLSettingsTLS1_3Off: return true } return false } // Status of the hostname's SSL certificates. -type CustomHostnameSSLStatus string +type CustomHostnameEditResponseSSLStatus string const ( - CustomHostnameSSLStatusInitializing CustomHostnameSSLStatus = "initializing" - CustomHostnameSSLStatusPendingValidation CustomHostnameSSLStatus = "pending_validation" - CustomHostnameSSLStatusDeleted CustomHostnameSSLStatus = "deleted" - CustomHostnameSSLStatusPendingIssuance CustomHostnameSSLStatus = "pending_issuance" - CustomHostnameSSLStatusPendingDeployment CustomHostnameSSLStatus = "pending_deployment" - CustomHostnameSSLStatusPendingDeletion CustomHostnameSSLStatus = "pending_deletion" - CustomHostnameSSLStatusPendingExpiration CustomHostnameSSLStatus = "pending_expiration" - CustomHostnameSSLStatusExpired CustomHostnameSSLStatus = "expired" - CustomHostnameSSLStatusActive CustomHostnameSSLStatus = "active" - CustomHostnameSSLStatusInitializingTimedOut CustomHostnameSSLStatus = "initializing_timed_out" - CustomHostnameSSLStatusValidationTimedOut CustomHostnameSSLStatus = "validation_timed_out" - CustomHostnameSSLStatusIssuanceTimedOut CustomHostnameSSLStatus = "issuance_timed_out" - CustomHostnameSSLStatusDeploymentTimedOut CustomHostnameSSLStatus = "deployment_timed_out" - CustomHostnameSSLStatusDeletionTimedOut CustomHostnameSSLStatus = "deletion_timed_out" - CustomHostnameSSLStatusPendingCleanup CustomHostnameSSLStatus = "pending_cleanup" - CustomHostnameSSLStatusStagingDeployment CustomHostnameSSLStatus = "staging_deployment" - CustomHostnameSSLStatusStagingActive CustomHostnameSSLStatus = "staging_active" - CustomHostnameSSLStatusDeactivating CustomHostnameSSLStatus = "deactivating" - CustomHostnameSSLStatusInactive CustomHostnameSSLStatus = "inactive" - CustomHostnameSSLStatusBackupIssued CustomHostnameSSLStatus = "backup_issued" - CustomHostnameSSLStatusHoldingDeployment CustomHostnameSSLStatus = "holding_deployment" + CustomHostnameEditResponseSSLStatusInitializing CustomHostnameEditResponseSSLStatus = "initializing" + CustomHostnameEditResponseSSLStatusPendingValidation CustomHostnameEditResponseSSLStatus = "pending_validation" + CustomHostnameEditResponseSSLStatusDeleted CustomHostnameEditResponseSSLStatus = "deleted" + CustomHostnameEditResponseSSLStatusPendingIssuance CustomHostnameEditResponseSSLStatus = "pending_issuance" + CustomHostnameEditResponseSSLStatusPendingDeployment CustomHostnameEditResponseSSLStatus = "pending_deployment" + CustomHostnameEditResponseSSLStatusPendingDeletion CustomHostnameEditResponseSSLStatus = "pending_deletion" + CustomHostnameEditResponseSSLStatusPendingExpiration CustomHostnameEditResponseSSLStatus = "pending_expiration" + CustomHostnameEditResponseSSLStatusExpired CustomHostnameEditResponseSSLStatus = "expired" + CustomHostnameEditResponseSSLStatusActive CustomHostnameEditResponseSSLStatus = "active" + CustomHostnameEditResponseSSLStatusInitializingTimedOut CustomHostnameEditResponseSSLStatus = "initializing_timed_out" + CustomHostnameEditResponseSSLStatusValidationTimedOut CustomHostnameEditResponseSSLStatus = "validation_timed_out" + CustomHostnameEditResponseSSLStatusIssuanceTimedOut CustomHostnameEditResponseSSLStatus = "issuance_timed_out" + CustomHostnameEditResponseSSLStatusDeploymentTimedOut CustomHostnameEditResponseSSLStatus = "deployment_timed_out" + CustomHostnameEditResponseSSLStatusDeletionTimedOut CustomHostnameEditResponseSSLStatus = "deletion_timed_out" + CustomHostnameEditResponseSSLStatusPendingCleanup CustomHostnameEditResponseSSLStatus = "pending_cleanup" + CustomHostnameEditResponseSSLStatusStagingDeployment CustomHostnameEditResponseSSLStatus = "staging_deployment" + CustomHostnameEditResponseSSLStatusStagingActive CustomHostnameEditResponseSSLStatus = "staging_active" + CustomHostnameEditResponseSSLStatusDeactivating CustomHostnameEditResponseSSLStatus = "deactivating" + CustomHostnameEditResponseSSLStatusInactive CustomHostnameEditResponseSSLStatus = "inactive" + CustomHostnameEditResponseSSLStatusBackupIssued CustomHostnameEditResponseSSLStatus = "backup_issued" + CustomHostnameEditResponseSSLStatusHoldingDeployment CustomHostnameEditResponseSSLStatus = "holding_deployment" ) -func (r CustomHostnameSSLStatus) IsKnown() bool { +func (r CustomHostnameEditResponseSSLStatus) IsKnown() bool { switch r { - case CustomHostnameSSLStatusInitializing, CustomHostnameSSLStatusPendingValidation, CustomHostnameSSLStatusDeleted, CustomHostnameSSLStatusPendingIssuance, CustomHostnameSSLStatusPendingDeployment, CustomHostnameSSLStatusPendingDeletion, CustomHostnameSSLStatusPendingExpiration, CustomHostnameSSLStatusExpired, CustomHostnameSSLStatusActive, CustomHostnameSSLStatusInitializingTimedOut, CustomHostnameSSLStatusValidationTimedOut, CustomHostnameSSLStatusIssuanceTimedOut, CustomHostnameSSLStatusDeploymentTimedOut, CustomHostnameSSLStatusDeletionTimedOut, CustomHostnameSSLStatusPendingCleanup, CustomHostnameSSLStatusStagingDeployment, CustomHostnameSSLStatusStagingActive, CustomHostnameSSLStatusDeactivating, CustomHostnameSSLStatusInactive, CustomHostnameSSLStatusBackupIssued, CustomHostnameSSLStatusHoldingDeployment: + case CustomHostnameEditResponseSSLStatusInitializing, CustomHostnameEditResponseSSLStatusPendingValidation, CustomHostnameEditResponseSSLStatusDeleted, CustomHostnameEditResponseSSLStatusPendingIssuance, CustomHostnameEditResponseSSLStatusPendingDeployment, CustomHostnameEditResponseSSLStatusPendingDeletion, CustomHostnameEditResponseSSLStatusPendingExpiration, CustomHostnameEditResponseSSLStatusExpired, CustomHostnameEditResponseSSLStatusActive, CustomHostnameEditResponseSSLStatusInitializingTimedOut, CustomHostnameEditResponseSSLStatusValidationTimedOut, CustomHostnameEditResponseSSLStatusIssuanceTimedOut, CustomHostnameEditResponseSSLStatusDeploymentTimedOut, CustomHostnameEditResponseSSLStatusDeletionTimedOut, CustomHostnameEditResponseSSLStatusPendingCleanup, CustomHostnameEditResponseSSLStatusStagingDeployment, CustomHostnameEditResponseSSLStatusStagingActive, CustomHostnameEditResponseSSLStatusDeactivating, CustomHostnameEditResponseSSLStatusInactive, CustomHostnameEditResponseSSLStatusBackupIssued, CustomHostnameEditResponseSSLStatusHoldingDeployment: return true } return false } -type CustomHostnameSSLValidationError struct { +type CustomHostnameEditResponseSSLValidationError struct { // A domain validation error. - Message string `json:"message"` - JSON customHostnameSSLValidationErrorJSON `json:"-"` + Message string `json:"message"` + JSON customHostnameEditResponseSSLValidationErrorJSON `json:"-"` } -// customHostnameSSLValidationErrorJSON contains the JSON metadata for the struct -// [CustomHostnameSSLValidationError] -type customHostnameSSLValidationErrorJSON struct { +// customHostnameEditResponseSSLValidationErrorJSON contains the JSON metadata for +// the struct [CustomHostnameEditResponseSSLValidationError] +type customHostnameEditResponseSSLValidationErrorJSON struct { Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CustomHostnameSSLValidationError) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameEditResponseSSLValidationError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameSSLValidationErrorJSON) RawJSON() string { +func (r customHostnameEditResponseSSLValidationErrorJSON) RawJSON() string { return r.raw } // Certificate's required validation record. -type CustomHostnameSSLValidationRecord struct { +type CustomHostnameEditResponseSSLValidationRecord struct { // The set of email addresses that the certificate authority (CA) will use to // complete domain validation. Emails []interface{} `json:"emails"` @@ -541,13 +1140,13 @@ type CustomHostnameSSLValidationRecord struct { TXTName string `json:"txt_name"` // The TXT record that the certificate authority (CA) will check during domain // validation. - TXTValue string `json:"txt_value"` - JSON customHostnameSSLValidationRecordJSON `json:"-"` + TXTValue string `json:"txt_value"` + JSON customHostnameEditResponseSSLValidationRecordJSON `json:"-"` } -// customHostnameSSLValidationRecordJSON contains the JSON metadata for the struct -// [CustomHostnameSSLValidationRecord] -type customHostnameSSLValidationRecordJSON struct { +// customHostnameEditResponseSSLValidationRecordJSON contains the JSON metadata for +// the struct [CustomHostnameEditResponseSSLValidationRecord] +type customHostnameEditResponseSSLValidationRecordJSON struct { Emails apijson.Field HTTPBody apijson.Field HTTPURL apijson.Field @@ -557,116 +1156,335 @@ type customHostnameSSLValidationRecordJSON struct { ExtraFields map[string]apijson.Field } -func (r *CustomHostnameSSLValidationRecord) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameEditResponseSSLValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameEditResponseSSLValidationRecordJSON) RawJSON() string { + return r.raw +} + +type CustomHostnameGetResponse struct { + // Identifier + ID string `json:"id,required"` + // The custom hostname that will point to your hostname via CNAME. + Hostname string `json:"hostname,required"` + // SSL properties for the custom hostname. + SSL CustomHostnameGetResponseSSL `json:"ssl,required"` + JSON customHostnameGetResponseJSON `json:"-"` +} + +// customHostnameGetResponseJSON contains the JSON metadata for the struct +// [CustomHostnameGetResponse] +type customHostnameGetResponseJSON struct { + ID apijson.Field + Hostname apijson.Field + SSL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameGetResponseJSON) RawJSON() string { + return r.raw +} + +// SSL properties for the custom hostname. +type CustomHostnameGetResponseSSL struct { + // Custom hostname SSL identifier tag. + ID string `json:"id"` + // A ubiquitous bundle has the highest probability of being verified everywhere, + // even by clients using outdated or unusual trust stores. An optimal bundle uses + // the shortest chain and newest intermediates. And the force bundle verifies the + // chain, but does not otherwise modify it. + BundleMethod BundleMethod `json:"bundle_method"` + // The Certificate Authority that will issue the certificate + CertificateAuthority CustomHostnameGetResponseSSLCertificateAuthority `json:"certificate_authority"` + // If a custom uploaded certificate is used. + CustomCertificate string `json:"custom_certificate"` + // The identifier for the Custom CSR that was used. + CustomCsrID string `json:"custom_csr_id"` + // The key for a custom uploaded certificate. + CustomKey string `json:"custom_key"` + // The time the custom certificate expires on. + ExpiresOn time.Time `json:"expires_on" format:"date-time"` + // A list of Hostnames on a custom uploaded certificate. + Hosts []interface{} `json:"hosts"` + // The issuer on a custom uploaded certificate. + Issuer string `json:"issuer"` + // Domain control validation (DCV) method used for this hostname. + Method DCVMethod `json:"method"` + // The serial number on a custom uploaded certificate. + SerialNumber string `json:"serial_number"` + // SSL specific settings. + Settings CustomHostnameGetResponseSSLSettings `json:"settings"` + // The signature on a custom uploaded certificate. + Signature string `json:"signature"` + // Status of the hostname's SSL certificates. + Status CustomHostnameGetResponseSSLStatus `json:"status"` + // Level of validation to be used for this hostname. Domain validation (dv) must be + // used. + Type DomainValidationType `json:"type"` + // The time the custom certificate was uploaded. + UploadedOn time.Time `json:"uploaded_on" format:"date-time"` + // Domain validation errors that have been received by the certificate authority + // (CA). + ValidationErrors []CustomHostnameGetResponseSSLValidationError `json:"validation_errors"` + ValidationRecords []CustomHostnameGetResponseSSLValidationRecord `json:"validation_records"` + // Indicates whether the certificate covers a wildcard. + Wildcard bool `json:"wildcard"` + JSON customHostnameGetResponseSSLJSON `json:"-"` +} + +// customHostnameGetResponseSSLJSON contains the JSON metadata for the struct +// [CustomHostnameGetResponseSSL] +type customHostnameGetResponseSSLJSON struct { + ID apijson.Field + BundleMethod apijson.Field + CertificateAuthority apijson.Field + CustomCertificate apijson.Field + CustomCsrID apijson.Field + CustomKey apijson.Field + ExpiresOn apijson.Field + Hosts apijson.Field + Issuer apijson.Field + Method apijson.Field + SerialNumber apijson.Field + Settings apijson.Field + Signature apijson.Field + Status apijson.Field + Type apijson.Field + UploadedOn apijson.Field + ValidationErrors apijson.Field + ValidationRecords apijson.Field + Wildcard apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameGetResponseSSL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameSSLValidationRecordJSON) RawJSON() string { +func (r customHostnameGetResponseSSLJSON) RawJSON() string { return r.raw } -// Status of the hostname's activation. -type CustomHostnameStatus string +// The Certificate Authority that will issue the certificate +type CustomHostnameGetResponseSSLCertificateAuthority string const ( - CustomHostnameStatusActive CustomHostnameStatus = "active" - CustomHostnameStatusPending CustomHostnameStatus = "pending" - CustomHostnameStatusActiveRedeploying CustomHostnameStatus = "active_redeploying" - CustomHostnameStatusMoved CustomHostnameStatus = "moved" - CustomHostnameStatusPendingDeletion CustomHostnameStatus = "pending_deletion" - CustomHostnameStatusDeleted CustomHostnameStatus = "deleted" - CustomHostnameStatusPendingBlocked CustomHostnameStatus = "pending_blocked" - CustomHostnameStatusPendingMigration CustomHostnameStatus = "pending_migration" - CustomHostnameStatusPendingProvisioned CustomHostnameStatus = "pending_provisioned" - CustomHostnameStatusTestPending CustomHostnameStatus = "test_pending" - CustomHostnameStatusTestActive CustomHostnameStatus = "test_active" - CustomHostnameStatusTestActiveApex CustomHostnameStatus = "test_active_apex" - CustomHostnameStatusTestBlocked CustomHostnameStatus = "test_blocked" - CustomHostnameStatusTestFailed CustomHostnameStatus = "test_failed" - CustomHostnameStatusProvisioned CustomHostnameStatus = "provisioned" - CustomHostnameStatusBlocked CustomHostnameStatus = "blocked" + CustomHostnameGetResponseSSLCertificateAuthorityDigicert CustomHostnameGetResponseSSLCertificateAuthority = "digicert" + CustomHostnameGetResponseSSLCertificateAuthorityGoogle CustomHostnameGetResponseSSLCertificateAuthority = "google" + CustomHostnameGetResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameGetResponseSSLCertificateAuthority = "lets_encrypt" ) -func (r CustomHostnameStatus) IsKnown() bool { +func (r CustomHostnameGetResponseSSLCertificateAuthority) IsKnown() bool { switch r { - case CustomHostnameStatusActive, CustomHostnameStatusPending, CustomHostnameStatusActiveRedeploying, CustomHostnameStatusMoved, CustomHostnameStatusPendingDeletion, CustomHostnameStatusDeleted, CustomHostnameStatusPendingBlocked, CustomHostnameStatusPendingMigration, CustomHostnameStatusPendingProvisioned, CustomHostnameStatusTestPending, CustomHostnameStatusTestActive, CustomHostnameStatusTestActiveApex, CustomHostnameStatusTestBlocked, CustomHostnameStatusTestFailed, CustomHostnameStatusProvisioned, CustomHostnameStatusBlocked: + case CustomHostnameGetResponseSSLCertificateAuthorityDigicert, CustomHostnameGetResponseSSLCertificateAuthorityGoogle, CustomHostnameGetResponseSSLCertificateAuthorityLetsEncrypt: return true } return false } -// A ubiquitous bundle has the highest probability of being verified everywhere, -// even by clients using outdated or unusual trust stores. An optimal bundle uses -// the shortest chain and newest intermediates. And the force bundle verifies the -// chain, but does not otherwise modify it. -type UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 string +// SSL specific settings. +type CustomHostnameGetResponseSSLSettings struct { + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Ciphers []string `json:"ciphers"` + // Whether or not Early Hints is enabled. + EarlyHints CustomHostnameGetResponseSSLSettingsEarlyHints `json:"early_hints"` + // Whether or not HTTP2 is enabled. + HTTP2 CustomHostnameGetResponseSSLSettingsHTTP2 `json:"http2"` + // The minimum TLS version supported. + MinTLSVersion CustomHostnameGetResponseSSLSettingsMinTLSVersion `json:"min_tls_version"` + // Whether or not TLS 1.3 is enabled. + TLS1_3 CustomHostnameGetResponseSSLSettingsTLS1_3 `json:"tls_1_3"` + JSON customHostnameGetResponseSSLSettingsJSON `json:"-"` +} + +// customHostnameGetResponseSSLSettingsJSON contains the JSON metadata for the +// struct [CustomHostnameGetResponseSSLSettings] +type customHostnameGetResponseSSLSettingsJSON struct { + Ciphers apijson.Field + EarlyHints apijson.Field + HTTP2 apijson.Field + MinTLSVersion apijson.Field + TLS1_3 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameGetResponseSSLSettings) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameGetResponseSSLSettingsJSON) RawJSON() string { + return r.raw +} + +// Whether or not Early Hints is enabled. +type CustomHostnameGetResponseSSLSettingsEarlyHints string const ( - UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 = "ubiquitous" - UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Optimal UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 = "optimal" - UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Force UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1 = "force" + CustomHostnameGetResponseSSLSettingsEarlyHintsOn CustomHostnameGetResponseSSLSettingsEarlyHints = "on" + CustomHostnameGetResponseSSLSettingsEarlyHintsOff CustomHostnameGetResponseSSLSettingsEarlyHints = "off" ) -func (r UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1) IsKnown() bool { +func (r CustomHostnameGetResponseSSLSettingsEarlyHints) IsKnown() bool { switch r { - case UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous, UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Optimal, UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Force: + case CustomHostnameGetResponseSSLSettingsEarlyHintsOn, CustomHostnameGetResponseSSLSettingsEarlyHintsOff: return true } return false } -// Domain control validation (DCV) method used for this hostname. -type UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 string +// Whether or not HTTP2 is enabled. +type CustomHostnameGetResponseSSLSettingsHTTP2 string const ( - UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510HTTP UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 = "http" - UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510TXT UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 = "txt" - UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510Email UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510 = "email" + CustomHostnameGetResponseSSLSettingsHTTP2On CustomHostnameGetResponseSSLSettingsHTTP2 = "on" + CustomHostnameGetResponseSSLSettingsHTTP2Off CustomHostnameGetResponseSSLSettingsHTTP2 = "off" ) -func (r UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510) IsKnown() bool { +func (r CustomHostnameGetResponseSSLSettingsHTTP2) IsKnown() bool { switch r { - case UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510HTTP, UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510TXT, UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510Email: + case CustomHostnameGetResponseSSLSettingsHTTP2On, CustomHostnameGetResponseSSLSettingsHTTP2Off: return true } return false } -// Level of validation to be used for this hostname. Domain validation (dv) must be -// used. -type UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 string +// The minimum TLS version supported. +type CustomHostnameGetResponseSSLSettingsMinTLSVersion string const ( - UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1Dv UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1 = "dv" + CustomHostnameGetResponseSSLSettingsMinTLSVersion1_0 CustomHostnameGetResponseSSLSettingsMinTLSVersion = "1.0" + CustomHostnameGetResponseSSLSettingsMinTLSVersion1_1 CustomHostnameGetResponseSSLSettingsMinTLSVersion = "1.1" + CustomHostnameGetResponseSSLSettingsMinTLSVersion1_2 CustomHostnameGetResponseSSLSettingsMinTLSVersion = "1.2" + CustomHostnameGetResponseSSLSettingsMinTLSVersion1_3 CustomHostnameGetResponseSSLSettingsMinTLSVersion = "1.3" ) -func (r UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1) IsKnown() bool { +func (r CustomHostnameGetResponseSSLSettingsMinTLSVersion) IsKnown() bool { switch r { - case UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1Dv: + case CustomHostnameGetResponseSSLSettingsMinTLSVersion1_0, CustomHostnameGetResponseSSLSettingsMinTLSVersion1_1, CustomHostnameGetResponseSSLSettingsMinTLSVersion1_2, CustomHostnameGetResponseSSLSettingsMinTLSVersion1_3: return true } return false } -type CustomHostnameDeleteResponse struct { - // Identifier - ID string `json:"id"` - JSON customHostnameDeleteResponseJSON `json:"-"` +// Whether or not TLS 1.3 is enabled. +type CustomHostnameGetResponseSSLSettingsTLS1_3 string + +const ( + CustomHostnameGetResponseSSLSettingsTLS1_3On CustomHostnameGetResponseSSLSettingsTLS1_3 = "on" + CustomHostnameGetResponseSSLSettingsTLS1_3Off CustomHostnameGetResponseSSLSettingsTLS1_3 = "off" +) + +func (r CustomHostnameGetResponseSSLSettingsTLS1_3) IsKnown() bool { + switch r { + case CustomHostnameGetResponseSSLSettingsTLS1_3On, CustomHostnameGetResponseSSLSettingsTLS1_3Off: + return true + } + return false } -// customHostnameDeleteResponseJSON contains the JSON metadata for the struct -// [CustomHostnameDeleteResponse] -type customHostnameDeleteResponseJSON struct { - ID apijson.Field +// Status of the hostname's SSL certificates. +type CustomHostnameGetResponseSSLStatus string + +const ( + CustomHostnameGetResponseSSLStatusInitializing CustomHostnameGetResponseSSLStatus = "initializing" + CustomHostnameGetResponseSSLStatusPendingValidation CustomHostnameGetResponseSSLStatus = "pending_validation" + CustomHostnameGetResponseSSLStatusDeleted CustomHostnameGetResponseSSLStatus = "deleted" + CustomHostnameGetResponseSSLStatusPendingIssuance CustomHostnameGetResponseSSLStatus = "pending_issuance" + CustomHostnameGetResponseSSLStatusPendingDeployment CustomHostnameGetResponseSSLStatus = "pending_deployment" + CustomHostnameGetResponseSSLStatusPendingDeletion CustomHostnameGetResponseSSLStatus = "pending_deletion" + CustomHostnameGetResponseSSLStatusPendingExpiration CustomHostnameGetResponseSSLStatus = "pending_expiration" + CustomHostnameGetResponseSSLStatusExpired CustomHostnameGetResponseSSLStatus = "expired" + CustomHostnameGetResponseSSLStatusActive CustomHostnameGetResponseSSLStatus = "active" + CustomHostnameGetResponseSSLStatusInitializingTimedOut CustomHostnameGetResponseSSLStatus = "initializing_timed_out" + CustomHostnameGetResponseSSLStatusValidationTimedOut CustomHostnameGetResponseSSLStatus = "validation_timed_out" + CustomHostnameGetResponseSSLStatusIssuanceTimedOut CustomHostnameGetResponseSSLStatus = "issuance_timed_out" + CustomHostnameGetResponseSSLStatusDeploymentTimedOut CustomHostnameGetResponseSSLStatus = "deployment_timed_out" + CustomHostnameGetResponseSSLStatusDeletionTimedOut CustomHostnameGetResponseSSLStatus = "deletion_timed_out" + CustomHostnameGetResponseSSLStatusPendingCleanup CustomHostnameGetResponseSSLStatus = "pending_cleanup" + CustomHostnameGetResponseSSLStatusStagingDeployment CustomHostnameGetResponseSSLStatus = "staging_deployment" + CustomHostnameGetResponseSSLStatusStagingActive CustomHostnameGetResponseSSLStatus = "staging_active" + CustomHostnameGetResponseSSLStatusDeactivating CustomHostnameGetResponseSSLStatus = "deactivating" + CustomHostnameGetResponseSSLStatusInactive CustomHostnameGetResponseSSLStatus = "inactive" + CustomHostnameGetResponseSSLStatusBackupIssued CustomHostnameGetResponseSSLStatus = "backup_issued" + CustomHostnameGetResponseSSLStatusHoldingDeployment CustomHostnameGetResponseSSLStatus = "holding_deployment" +) + +func (r CustomHostnameGetResponseSSLStatus) IsKnown() bool { + switch r { + case CustomHostnameGetResponseSSLStatusInitializing, CustomHostnameGetResponseSSLStatusPendingValidation, CustomHostnameGetResponseSSLStatusDeleted, CustomHostnameGetResponseSSLStatusPendingIssuance, CustomHostnameGetResponseSSLStatusPendingDeployment, CustomHostnameGetResponseSSLStatusPendingDeletion, CustomHostnameGetResponseSSLStatusPendingExpiration, CustomHostnameGetResponseSSLStatusExpired, CustomHostnameGetResponseSSLStatusActive, CustomHostnameGetResponseSSLStatusInitializingTimedOut, CustomHostnameGetResponseSSLStatusValidationTimedOut, CustomHostnameGetResponseSSLStatusIssuanceTimedOut, CustomHostnameGetResponseSSLStatusDeploymentTimedOut, CustomHostnameGetResponseSSLStatusDeletionTimedOut, CustomHostnameGetResponseSSLStatusPendingCleanup, CustomHostnameGetResponseSSLStatusStagingDeployment, CustomHostnameGetResponseSSLStatusStagingActive, CustomHostnameGetResponseSSLStatusDeactivating, CustomHostnameGetResponseSSLStatusInactive, CustomHostnameGetResponseSSLStatusBackupIssued, CustomHostnameGetResponseSSLStatusHoldingDeployment: + return true + } + return false +} + +type CustomHostnameGetResponseSSLValidationError struct { + // A domain validation error. + Message string `json:"message"` + JSON customHostnameGetResponseSSLValidationErrorJSON `json:"-"` +} + +// customHostnameGetResponseSSLValidationErrorJSON contains the JSON metadata for +// the struct [CustomHostnameGetResponseSSLValidationError] +type customHostnameGetResponseSSLValidationErrorJSON struct { + Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *CustomHostnameDeleteResponse) UnmarshalJSON(data []byte) (err error) { +func (r *CustomHostnameGetResponseSSLValidationError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r customHostnameDeleteResponseJSON) RawJSON() string { +func (r customHostnameGetResponseSSLValidationErrorJSON) RawJSON() string { + return r.raw +} + +// Certificate's required validation record. +type CustomHostnameGetResponseSSLValidationRecord struct { + // The set of email addresses that the certificate authority (CA) will use to + // complete domain validation. + Emails []interface{} `json:"emails"` + // The content that the certificate authority (CA) will expect to find at the + // http_url during the domain validation. + HTTPBody string `json:"http_body"` + // The url that will be checked during domain validation. + HTTPURL string `json:"http_url"` + // The hostname that the certificate authority (CA) will check for a TXT record + // during domain validation . + TXTName string `json:"txt_name"` + // The TXT record that the certificate authority (CA) will check during domain + // validation. + TXTValue string `json:"txt_value"` + JSON customHostnameGetResponseSSLValidationRecordJSON `json:"-"` +} + +// customHostnameGetResponseSSLValidationRecordJSON contains the JSON metadata for +// the struct [CustomHostnameGetResponseSSLValidationRecord] +type customHostnameGetResponseSSLValidationRecordJSON struct { + Emails apijson.Field + HTTPBody apijson.Field + HTTPURL apijson.Field + TXTName apijson.Field + TXTValue apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CustomHostnameGetResponseSSLValidationRecord) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r customHostnameGetResponseSSLValidationRecordJSON) RawJSON() string { return r.raw } @@ -691,7 +1509,7 @@ type CustomHostnameNewParamsSSL struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate CertificateAuthority param.Field[CustomHostnameNewParamsSSLCertificateAuthority] `json:"certificate_authority"` // If a custom uploaded certificate is used. @@ -699,12 +1517,12 @@ type CustomHostnameNewParamsSSL struct { // The key for a custom uploaded certificate. CustomKey param.Field[string] `json:"custom_key"` // Domain control validation (DCV) method used for this hostname. - Method param.Field[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] `json:"method"` + Method param.Field[DCVMethod] `json:"method"` // SSL specific settings. Settings param.Field[CustomHostnameNewParamsSSLSettings] `json:"settings"` // Level of validation to be used for this hostname. Domain validation (dv) must be // used. - Type param.Field[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] `json:"type"` + Type param.Field[DomainValidationType] `json:"type"` // Indicates whether the certificate covers a wildcard. Wildcard param.Field[bool] `json:"wildcard"` } @@ -826,9 +1644,9 @@ func (r CustomHostnameNewParamsCustomMetadata) MarshalJSON() (data []byte, err e } type CustomHostnameNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostname `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomHostnameNewResponse `json:"result,required"` // Whether the API call was successful Success CustomHostnameNewResponseEnvelopeSuccess `json:"success,required"` JSON customHostnameNewResponseEnvelopeJSON `json:"-"` @@ -949,8 +1767,8 @@ func (r CustomHostnameListParamsSSL) IsKnown() bool { type CustomHostnameDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r CustomHostnameDeleteParams) MarshalJSON() (data []byte, err error) { @@ -995,7 +1813,7 @@ type CustomHostnameEditParamsSSL struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate CertificateAuthority param.Field[CustomHostnameEditParamsSSLCertificateAuthority] `json:"certificate_authority"` // If a custom uploaded certificate is used. @@ -1003,12 +1821,12 @@ type CustomHostnameEditParamsSSL struct { // The key for a custom uploaded certificate. CustomKey param.Field[string] `json:"custom_key"` // Domain control validation (DCV) method used for this hostname. - Method param.Field[UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510] `json:"method"` + Method param.Field[DCVMethod] `json:"method"` // SSL specific settings. Settings param.Field[CustomHostnameEditParamsSSLSettings] `json:"settings"` // Level of validation to be used for this hostname. Domain validation (dv) must be // used. - Type param.Field[UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1] `json:"type"` + Type param.Field[DomainValidationType] `json:"type"` // Indicates whether the certificate covers a wildcard. Wildcard param.Field[bool] `json:"wildcard"` } @@ -1120,9 +1938,9 @@ func (r CustomHostnameEditParamsSSLSettingsTLS1_3) IsKnown() bool { } type CustomHostnameEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostname `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomHostnameEditResponse `json:"result,required"` // Whether the API call was successful Success CustomHostnameEditResponseEnvelopeSuccess `json:"success,required"` JSON customHostnameEditResponseEnvelopeJSON `json:"-"` @@ -1168,9 +1986,9 @@ type CustomHostnameGetParams struct { } type CustomHostnameGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostname `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CustomHostnameGetResponse `json:"result,required"` // Whether the API call was successful Success CustomHostnameGetResponseEnvelopeSuccess `json:"success,required"` JSON customHostnameGetResponseEnvelopeJSON `json:"-"` diff --git a/custom_hostnames/customhostname_test.go b/custom_hostnames/customhostname_test.go index dc47f62e48c..6ae3aeefb07 100644 --- a/custom_hostnames/customhostname_test.go +++ b/custom_hostnames/customhostname_test.go @@ -32,11 +32,11 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) { ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Hostname: cloudflare.F("app.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSL{ - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), CertificateAuthority: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLCertificateAuthorityGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), - Method: cloudflare.F(custom_hostnames.UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510HTTP), + Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), Settings: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLSettings{ Ciphers: cloudflare.F([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"}), EarlyHints: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLSettingsEarlyHintsOn), @@ -44,7 +44,7 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) { MinTLSVersion: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLSettingsMinTLSVersion1_2), TLS1_3: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLSettingsTLS1_3On), }), - Type: cloudflare.F(custom_hostnames.UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1Dv), + Type: cloudflare.F(custom_hostnames.DomainValidationTypeDv), Wildcard: cloudflare.F(false), }), CustomMetadata: cloudflare.F(custom_hostnames.CustomHostnameNewParamsCustomMetadata{ @@ -112,7 +112,7 @@ func TestCustomHostnameDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", custom_hostnames.CustomHostnameDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -149,11 +149,11 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) { CustomOriginServer: cloudflare.F("origin2.example.com"), CustomOriginSni: cloudflare.F("sni.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSL{ - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), CertificateAuthority: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLCertificateAuthorityGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), - Method: cloudflare.F(custom_hostnames.UnnamedSchemaRef78adb375f06c6d462dd92b99e2ecf510HTTP), + Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), Settings: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLSettings{ Ciphers: cloudflare.F([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"}), EarlyHints: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLSettingsEarlyHintsOn), @@ -161,7 +161,7 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) { MinTLSVersion: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLSettingsMinTLSVersion1_2), TLS1_3: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLSettingsTLS1_3On), }), - Type: cloudflare.F(custom_hostnames.UnnamedSchemaRef9a9935a9a770967bb604ae41a81e42e1Dv), + Type: cloudflare.F(custom_hostnames.DomainValidationTypeDv), Wildcard: cloudflare.F(false), }), }, diff --git a/custom_hostnames/fallbackorigin.go b/custom_hostnames/fallbackorigin.go index 32f37d0fd93..d63acaa3359 100644 --- a/custom_hostnames/fallbackorigin.go +++ b/custom_hostnames/fallbackorigin.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // FallbackOriginService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewFallbackOriginService(opts ...option.RequestOption) (r *FallbackOriginSe } // Update Fallback Origin for Custom Hostnames -func (r *FallbackOriginService) Update(ctx context.Context, params FallbackOriginUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *FallbackOriginService) Update(ctx context.Context, params FallbackOriginUpdateParams, opts ...option.RequestOption) (res *FallbackOriginUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env FallbackOriginUpdateResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", params.ZoneID) @@ -46,7 +48,7 @@ func (r *FallbackOriginService) Update(ctx context.Context, params FallbackOrigi } // Delete Fallback Origin for Custom Hostnames -func (r *FallbackOriginService) Delete(ctx context.Context, params FallbackOriginDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *FallbackOriginService) Delete(ctx context.Context, params FallbackOriginDeleteParams, opts ...option.RequestOption) (res *FallbackOriginDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env FallbackOriginDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", params.ZoneID) @@ -59,7 +61,7 @@ func (r *FallbackOriginService) Delete(ctx context.Context, params FallbackOrigi } // Get Fallback Origin for Custom Hostnames -func (r *FallbackOriginService) Get(ctx context.Context, query FallbackOriginGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *FallbackOriginService) Get(ctx context.Context, query FallbackOriginGetParams, opts ...option.RequestOption) (res *FallbackOriginGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env FallbackOriginGetResponseEnvelope path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", query.ZoneID) @@ -71,6 +73,57 @@ func (r *FallbackOriginService) Get(ctx context.Context, query FallbackOriginGet return } +// Union satisfied by [custom_hostnames.FallbackOriginUpdateResponseUnknown] or +// [shared.UnionString]. +type FallbackOriginUpdateResponseUnion interface { + ImplementsCustomHostnamesFallbackOriginUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*FallbackOriginUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [custom_hostnames.FallbackOriginDeleteResponseUnknown] or +// [shared.UnionString]. +type FallbackOriginDeleteResponseUnion interface { + ImplementsCustomHostnamesFallbackOriginDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*FallbackOriginDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [custom_hostnames.FallbackOriginGetResponseUnknown] or +// [shared.UnionString]. +type FallbackOriginGetResponseUnion interface { + ImplementsCustomHostnamesFallbackOriginGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*FallbackOriginGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type FallbackOriginUpdateParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -83,9 +136,9 @@ func (r FallbackOriginUpdateParams) MarshalJSON() (data []byte, err error) { } type FallbackOriginUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result FallbackOriginUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success FallbackOriginUpdateResponseEnvelopeSuccess `json:"success,required"` JSON fallbackOriginUpdateResponseEnvelopeJSON `json:"-"` @@ -127,8 +180,8 @@ func (r FallbackOriginUpdateResponseEnvelopeSuccess) IsKnown() bool { type FallbackOriginDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r FallbackOriginDeleteParams) MarshalJSON() (data []byte, err error) { @@ -136,9 +189,9 @@ func (r FallbackOriginDeleteParams) MarshalJSON() (data []byte, err error) { } type FallbackOriginDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result FallbackOriginDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success FallbackOriginDeleteResponseEnvelopeSuccess `json:"success,required"` JSON fallbackOriginDeleteResponseEnvelopeJSON `json:"-"` @@ -184,9 +237,9 @@ type FallbackOriginGetParams struct { } type FallbackOriginGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result FallbackOriginGetResponseUnion `json:"result,required"` // Whether the API call was successful Success FallbackOriginGetResponseEnvelopeSuccess `json:"success,required"` JSON fallbackOriginGetResponseEnvelopeJSON `json:"-"` diff --git a/custom_hostnames/fallbackorigin_test.go b/custom_hostnames/fallbackorigin_test.go index 55770d39e80..988da10cf65 100644 --- a/custom_hostnames/fallbackorigin_test.go +++ b/custom_hostnames/fallbackorigin_test.go @@ -57,7 +57,7 @@ func TestFallbackOriginDelete(t *testing.T) { ) _, err := client.CustomHostnames.FallbackOrigin.Delete(context.TODO(), custom_hostnames.FallbackOriginDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/custom_nameservers/aliases.go b/custom_nameservers/aliases.go index 3e43b63c08c..5298fd7c3f6 100644 --- a/custom_nameservers/aliases.go +++ b/custom_nameservers/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/custom_nameservers/customnameserver.go b/custom_nameservers/customnameserver.go index 3574e445b56..67dfa7ba459 100644 --- a/custom_nameservers/customnameserver.go +++ b/custom_nameservers/customnameserver.go @@ -278,8 +278,8 @@ func (r CustomNameserverNewResponseEnvelopeSuccess) IsKnown() bool { type CustomNameserverDeleteParams struct { // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r CustomNameserverDeleteParams) MarshalJSON() (data []byte, err error) { @@ -526,8 +526,8 @@ func (r customNameserverGetResponseEnvelopeResultInfoJSON) RawJSON() string { type CustomNameserverVerifyParams struct { // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r CustomNameserverVerifyParams) MarshalJSON() (data []byte, err error) { diff --git a/custom_nameservers/customnameserver_test.go b/custom_nameservers/customnameserver_test.go index 531d66a0446..7d9df3e08e4 100644 --- a/custom_nameservers/customnameserver_test.go +++ b/custom_nameservers/customnameserver_test.go @@ -61,7 +61,7 @@ func TestCustomNameserverDelete(t *testing.T) { "ns1.example.com", custom_nameservers.CustomNameserverDeleteParams{ AccountID: cloudflare.F("372e67954025e0ba6aaa6d586b9e0b59"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -141,7 +141,7 @@ func TestCustomNameserverVerify(t *testing.T) { ) _, err := client.CustomNameservers.Verify(context.TODO(), custom_nameservers.CustomNameserverVerifyParams{ AccountID: cloudflare.F("372e67954025e0ba6aaa6d586b9e0b59"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/d1/aliases.go b/d1/aliases.go index 887089d6a5d..45038bba0b9 100644 --- a/d1/aliases.go +++ b/d1/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/d1/database.go b/d1/database.go index 2ef9c3ed0c8..a37699d1b82 100644 --- a/d1/database.go +++ b/d1/database.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // DatabaseService contains methods and other services that help with interacting @@ -71,7 +73,7 @@ func (r *DatabaseService) ListAutoPaging(ctx context.Context, params DatabaseLis } // Deletes the specified D1 database. -func (r *DatabaseService) Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DatabaseService) Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *DatabaseDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DatabaseDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/d1/database/%s", accountIdentifier, databaseIdentifier) @@ -221,6 +223,22 @@ func (r databaseListResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [d1.DatabaseDeleteResponseUnknown] or [shared.UnionString]. +type DatabaseDeleteResponseUnion interface { + ImplementsD1DatabaseDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DatabaseDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DatabaseNewParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` @@ -294,9 +312,9 @@ func (r DatabaseListParams) URLQuery() (v url.Values) { } type DatabaseDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DatabaseDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success DatabaseDeleteResponseEnvelopeSuccess `json:"success,required"` JSON databaseDeleteResponseEnvelopeJSON `json:"-"` diff --git a/dcv_delegation/aliases.go b/dcv_delegation/aliases.go index 3f72477f232..d7383e0fbee 100644 --- a/dcv_delegation/aliases.go +++ b/dcv_delegation/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/diagnostics/aliases.go b/diagnostics/aliases.go index 01d1d31156a..3c84237af7f 100644 --- a/diagnostics/aliases.go +++ b/diagnostics/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/dns/aliases.go b/dns/aliases.go index 293acf462ba..7c7a3f5ab83 100644 --- a/dns/aliases.go +++ b/dns/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/dns/analyticsreport.go b/dns/analyticsreport.go index 4ca591bdaa3..88f842719c3 100644 --- a/dns/analyticsreport.go +++ b/dns/analyticsreport.go @@ -56,7 +56,7 @@ func (r *AnalyticsReportService) Get(ctx context.Context, params AnalyticsReport type Report struct { // Array with one row per combination of dimension values. - Data []UnnamedSchemaRef6595695ff25b0614667b25f66b7bbaba `json:"data,required"` + Data []ReportData `json:"data,required"` // Number of seconds between current time and last processed event, in another // words how many seconds of data could be missing. DataLag float64 `json:"data_lag,required"` @@ -96,6 +96,31 @@ func (r reportJSON) RawJSON() string { return r.raw } +type ReportData struct { + // Array of dimension values, representing the combination of dimension values + // corresponding to this row. + Dimensions []string `json:"dimensions,required"` + // Array with one item per requested metric. Each item is a single value. + Metrics []float64 `json:"metrics,required"` + JSON reportDataJSON `json:"-"` +} + +// reportDataJSON contains the JSON metadata for the struct [ReportData] +type reportDataJSON struct { + Dimensions apijson.Field + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ReportData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r reportDataJSON) RawJSON() string { + return r.raw +} + type ReportQuery struct { // Array of dimension names. Dimensions []string `json:"dimensions,required"` diff --git a/dns/analyticsreportbytime.go b/dns/analyticsreportbytime.go index 32d6292677c..159f2ee7023 100644 --- a/dns/analyticsreportbytime.go +++ b/dns/analyticsreportbytime.go @@ -63,8 +63,8 @@ type ByTime struct { Max interface{} `json:"max,required"` // Minimum results for each metric (object mapping metric names to values). // Currently always an empty object. - Min interface{} `json:"min,required"` - Query UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2 `json:"query,required"` + Min interface{} `json:"min,required"` + Query DNSAnalyticsQuery `json:"query,required"` // Total number of rows in the result. Rows float64 `json:"rows,required"` // Array of time intervals in the response data. Each interval is represented as an @@ -104,8 +104,8 @@ type ByTimeData struct { Dimensions []string `json:"dimensions,required"` // Array with one item per requested metric. Each item is an array of values, // broken down by time interval. - Metrics []UnnamedSchemaRef65be9614de145bf4a58d0fddf46df7ca `json:"metrics,required"` - JSON byTimeDataJSON `json:"-"` + Metrics []DNSAnalyticsNominalMetric `json:"metrics,required"` + JSON byTimeDataJSON `json:"-"` } // byTimeDataJSON contains the JSON metadata for the struct [ByTimeData] diff --git a/dns/dns.go b/dns/dns.go index c6401ef7e07..1237b3e020a 100644 --- a/dns/dns.go +++ b/dns/dns.go @@ -32,35 +32,9 @@ func NewDNSService(opts ...option.RequestOption) (r *DNSService) { return } -type UnnamedSchemaRef6595695ff25b0614667b25f66b7bbaba struct { - // Array of dimension values, representing the combination of dimension values - // corresponding to this row. - Dimensions []string `json:"dimensions,required"` - // Array with one item per requested metric. Each item is a single value. - Metrics []float64 `json:"metrics,required"` - JSON unnamedSchemaRef6595695ff25b0614667b25f66b7bbabaJSON `json:"-"` -} - -// unnamedSchemaRef6595695ff25b0614667b25f66b7bbabaJSON contains the JSON metadata -// for the struct [UnnamedSchemaRef6595695ff25b0614667b25f66b7bbaba] -type unnamedSchemaRef6595695ff25b0614667b25f66b7bbabaJSON struct { - Dimensions apijson.Field - Metrics apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UnnamedSchemaRef6595695ff25b0614667b25f66b7bbaba) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r unnamedSchemaRef6595695ff25b0614667b25f66b7bbabaJSON) RawJSON() string { - return r.raw -} - -type UnnamedSchemaRef65be9614de145bf4a58d0fddf46df7ca []interface{} +type DNSAnalyticsNominalMetric []interface{} -type UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2 struct { +type DNSAnalyticsQuery struct { // Array of dimension names. Dimensions []string `json:"dimensions,required"` // Limit number of returned metrics. @@ -70,20 +44,20 @@ type UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2 struct { // Start date and time of requesting data period in ISO 8601 format. Since time.Time `json:"since,required" format:"date-time"` // Unit of time to group data by. - TimeDelta UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta `json:"time_delta,required"` + TimeDelta DNSAnalyticsQueryTimeDelta `json:"time_delta,required"` // End date and time of requesting data period in ISO 8601 format. Until time.Time `json:"until,required" format:"date-time"` // Segmentation filter in 'attribute operator value' format. Filters string `json:"filters"` // Array of dimensions to sort by, where each dimension may be prefixed by - // (descending) or + (ascending). - Sort []string `json:"sort"` - JSON unnamedSchemaRef85b45d163202bbab7456da6b346d9fe2JSON `json:"-"` + Sort []string `json:"sort"` + JSON dnsAnalyticsQueryJSON `json:"-"` } -// unnamedSchemaRef85b45d163202bbab7456da6b346d9fe2JSON contains the JSON metadata -// for the struct [UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2] -type unnamedSchemaRef85b45d163202bbab7456da6b346d9fe2JSON struct { +// dnsAnalyticsQueryJSON contains the JSON metadata for the struct +// [DNSAnalyticsQuery] +type dnsAnalyticsQueryJSON struct { Dimensions apijson.Field Limit apijson.Field Metrics apijson.Field @@ -96,33 +70,33 @@ type unnamedSchemaRef85b45d163202bbab7456da6b346d9fe2JSON struct { ExtraFields map[string]apijson.Field } -func (r *UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsQuery) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r unnamedSchemaRef85b45d163202bbab7456da6b346d9fe2JSON) RawJSON() string { +func (r dnsAnalyticsQueryJSON) RawJSON() string { return r.raw } // Unit of time to group data by. -type UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta string +type DNSAnalyticsQueryTimeDelta string const ( - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaAll UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "all" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaAuto UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "auto" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaYear UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "year" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaQuarter UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "quarter" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaMonth UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "month" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaWeek UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "week" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaDay UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "day" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaHour UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "hour" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaDekaminute UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "dekaminute" - UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaMinute UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta = "minute" + DNSAnalyticsQueryTimeDeltaAll DNSAnalyticsQueryTimeDelta = "all" + DNSAnalyticsQueryTimeDeltaAuto DNSAnalyticsQueryTimeDelta = "auto" + DNSAnalyticsQueryTimeDeltaYear DNSAnalyticsQueryTimeDelta = "year" + DNSAnalyticsQueryTimeDeltaQuarter DNSAnalyticsQueryTimeDelta = "quarter" + DNSAnalyticsQueryTimeDeltaMonth DNSAnalyticsQueryTimeDelta = "month" + DNSAnalyticsQueryTimeDeltaWeek DNSAnalyticsQueryTimeDelta = "week" + DNSAnalyticsQueryTimeDeltaDay DNSAnalyticsQueryTimeDelta = "day" + DNSAnalyticsQueryTimeDeltaHour DNSAnalyticsQueryTimeDelta = "hour" + DNSAnalyticsQueryTimeDeltaDekaminute DNSAnalyticsQueryTimeDelta = "dekaminute" + DNSAnalyticsQueryTimeDeltaMinute DNSAnalyticsQueryTimeDelta = "minute" ) -func (r UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDelta) IsKnown() bool { +func (r DNSAnalyticsQueryTimeDelta) IsKnown() bool { switch r { - case UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaAll, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaAuto, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaYear, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaQuarter, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaMonth, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaWeek, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaDay, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaHour, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaDekaminute, UnnamedSchemaRef85b45d163202bbab7456da6b346d9fe2TimeDeltaMinute: + case DNSAnalyticsQueryTimeDeltaAll, DNSAnalyticsQueryTimeDeltaAuto, DNSAnalyticsQueryTimeDeltaYear, DNSAnalyticsQueryTimeDeltaQuarter, DNSAnalyticsQueryTimeDeltaMonth, DNSAnalyticsQueryTimeDeltaWeek, DNSAnalyticsQueryTimeDeltaDay, DNSAnalyticsQueryTimeDeltaHour, DNSAnalyticsQueryTimeDeltaDekaminute, DNSAnalyticsQueryTimeDeltaMinute: return true } return false diff --git a/dns/firewall.go b/dns/firewall.go index a305b739471..cab5e9339c6 100644 --- a/dns/firewall.go +++ b/dns/firewall.go @@ -211,6 +211,35 @@ func (r firewallJSON) RawJSON() string { return r.raw } +type FirewallParam struct { + // Deprecate the response to ANY requests. + DeprecateAnyRequests param.Field[bool] `json:"deprecate_any_requests,required"` + DNSFirewallIPs param.Field[[]FirewallIPsUnionParam] `json:"dns_firewall_ips,required" format:"ipv4"` + // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. + EcsFallback param.Field[bool] `json:"ecs_fallback,required"` + // Maximum DNS Cache TTL. + MaximumCacheTTL param.Field[float64] `json:"maximum_cache_ttl,required"` + // Minimum DNS Cache TTL. + MinimumCacheTTL param.Field[float64] `json:"minimum_cache_ttl,required"` + // DNS Firewall Cluster Name. + Name param.Field[string] `json:"name,required"` + UpstreamIPs param.Field[[]UpstreamIPsUnionParam] `json:"upstream_ips,required" format:"ipv4"` + // Attack mitigation settings. + AttackMitigation param.Field[AttackMitigationParam] `json:"attack_mitigation"` + // Negative DNS Cache TTL. + NegativeCacheTTL param.Field[float64] `json:"negative_cache_ttl"` + // Ratelimit in queries per second per datacenter (applies to DNS queries sent to + // the upstream nameservers configured on the cluster). + Ratelimit param.Field[float64] `json:"ratelimit"` + // Number of retries for fetching DNS responses from upstream nameservers (not + // counting the initial attempt). + Retries param.Field[float64] `json:"retries"` +} + +func (r FirewallParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // Cloudflare-assigned DNS IPv4 Address. // // Union satisfied by [shared.UnionString] or [shared.UnionString]. @@ -383,8 +412,8 @@ func (r FirewallListParams) URLQuery() (v url.Values) { type FirewallDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r FirewallDeleteParams) MarshalJSON() (data []byte, err error) { @@ -437,32 +466,11 @@ func (r FirewallDeleteResponseEnvelopeSuccess) IsKnown() bool { type FirewallEditParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - // Deprecate the response to ANY requests. - DeprecateAnyRequests param.Field[bool] `json:"deprecate_any_requests,required"` - DNSFirewallIPs param.Field[[]FirewallIPsUnionParam] `json:"dns_firewall_ips,required" format:"ipv4"` - // Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. - EcsFallback param.Field[bool] `json:"ecs_fallback,required"` - // Maximum DNS Cache TTL. - MaximumCacheTTL param.Field[float64] `json:"maximum_cache_ttl,required"` - // Minimum DNS Cache TTL. - MinimumCacheTTL param.Field[float64] `json:"minimum_cache_ttl,required"` - // DNS Firewall Cluster Name. - Name param.Field[string] `json:"name,required"` - UpstreamIPs param.Field[[]UpstreamIPsUnionParam] `json:"upstream_ips,required" format:"ipv4"` - // Attack mitigation settings. - AttackMitigation param.Field[AttackMitigationParam] `json:"attack_mitigation"` - // Negative DNS Cache TTL. - NegativeCacheTTL param.Field[float64] `json:"negative_cache_ttl"` - // Ratelimit in queries per second per datacenter (applies to DNS queries sent to - // the upstream nameservers configured on the cluster). - Ratelimit param.Field[float64] `json:"ratelimit"` - // Number of retries for fetching DNS responses from upstream nameservers (not - // counting the initial attempt). - Retries param.Field[float64] `json:"retries"` + Firewall FirewallParam `json:"firewall,required"` } func (r FirewallEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.Firewall) } type FirewallEditResponseEnvelope struct { diff --git a/dns/firewall_test.go b/dns/firewall_test.go index 6b77616d2d7..624ae1b64ec 100644 --- a/dns/firewall_test.go +++ b/dns/firewall_test.go @@ -101,7 +101,7 @@ func TestFirewallDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", dns.FirewallDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -131,21 +131,23 @@ func TestFirewallEditWithOptionalParams(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns.FirewallEditParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - DeprecateAnyRequests: cloudflare.F(true), - DNSFirewallIPs: cloudflare.F([]dns.FirewallIPsUnionParam{shared.UnionString("203.0.113.1"), shared.UnionString("203.0.113.254"), shared.UnionString("2001:DB8:AB::CF"), shared.UnionString("2001:DB8:CD::CF")}), - EcsFallback: cloudflare.F(false), - MaximumCacheTTL: cloudflare.F(900.000000), - MinimumCacheTTL: cloudflare.F(60.000000), - Name: cloudflare.F("My Awesome DNS Firewall cluster"), - UpstreamIPs: cloudflare.F([]dns.UpstreamIPsUnionParam{shared.UnionString("192.0.2.1"), shared.UnionString("198.51.100.1"), shared.UnionString("2001:DB8:100::CF")}), - AttackMitigation: cloudflare.F(dns.AttackMitigationParam{ - Enabled: cloudflare.F(true), - OnlyWhenUpstreamUnhealthy: cloudflare.F(false), - }), - NegativeCacheTTL: cloudflare.F(900.000000), - Ratelimit: cloudflare.F(600.000000), - Retries: cloudflare.F(2.000000), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Firewall: dns.FirewallParam{ + AttackMitigation: cloudflare.F(dns.AttackMitigationParam{ + Enabled: cloudflare.F(true), + OnlyWhenUpstreamUnhealthy: cloudflare.F(false), + }), + DeprecateAnyRequests: cloudflare.F(true), + DNSFirewallIPs: cloudflare.F([]dns.FirewallIPsUnionParam{shared.UnionString("203.0.113.1"), shared.UnionString("203.0.113.254"), shared.UnionString("2001:DB8:AB::CF"), shared.UnionString("2001:DB8:CD::CF")}), + EcsFallback: cloudflare.F(false), + MaximumCacheTTL: cloudflare.F(900.000000), + MinimumCacheTTL: cloudflare.F(60.000000), + Name: cloudflare.F("My Awesome DNS Firewall cluster"), + NegativeCacheTTL: cloudflare.F(900.000000), + Ratelimit: cloudflare.F(600.000000), + Retries: cloudflare.F(2.000000), + UpstreamIPs: cloudflare.F([]dns.UpstreamIPsUnionParam{shared.UnionString("192.0.2.1"), shared.UnionString("198.51.100.1"), shared.UnionString("2001:DB8:100::CF")}), + }, }, ) if err != nil { diff --git a/dns/record.go b/dns/record.go index 924fb0a5dc5..d8cd58ba01b 100644 --- a/dns/record.go +++ b/dns/record.go @@ -48,7 +48,7 @@ func NewRecordService(opts ...option.RequestOption) (r *RecordService) { func (r *RecordService) New(ctx context.Context, params RecordNewParams, opts ...option.RequestOption) (res *Record, err error) { opts = append(r.Options[:], opts...) var env RecordNewResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records", params.getZoneID()) + path := fmt.Sprintf("zones/%s/dns_records", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -66,7 +66,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 *Record, err error) { opts = append(r.Options[:], opts...) var env RecordUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records/%s", params.getZoneID(), dnsRecordID) + path := fmt.Sprintf("zones/%s/dns_records/%s", params.ZoneID, dnsRecordID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -120,7 +120,7 @@ func (r *RecordService) Delete(ctx context.Context, dnsRecordID string, params R func (r *RecordService) Edit(ctx context.Context, dnsRecordID string, params RecordEditParams, opts ...option.RequestOption) (res *Record, err error) { opts = append(r.Options[:], opts...) var env RecordEditResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records/%s", params.getZoneID(), dnsRecordID) + path := fmt.Sprintf("zones/%s/dns_records/%s", params.ZoneID, dnsRecordID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return @@ -209,7 +209,7 @@ type ARecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -276,6 +276,33 @@ func (r ARecordType) IsKnown() bool { return false } +type ARecordParam struct { + // 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[ARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r ARecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ARecordParam) implementsDNSRecordUnionParam() {} + type AAAARecord struct { // A valid IPv6 address. Content string `json:"content,required" format:"ipv6"` @@ -294,7 +321,7 @@ type AAAARecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -361,6 +388,33 @@ func (r AAAARecordType) IsKnown() bool { return false } +type AAAARecordParam struct { + // 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[AAAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r AAAARecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AAAARecordParam) implementsDNSRecordUnionParam() {} + type CAARecord struct { // Components of a CAA record. Data CAARecordData `json:"data,required"` @@ -381,7 +435,7 @@ type CAARecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -473,6 +527,44 @@ func (r CAARecordType) IsKnown() bool { return false } +type CAARecordParam struct { + // Components of a CAA record. + Data param.Field[CAARecordDataParam] `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[CAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r CAARecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CAARecordParam) implementsDNSRecordUnionParam() {} + +// Components of a CAA record. +type CAARecordDataParam 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 CAARecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type CERTRecord struct { // Components of a CERT record. Data CERTRecordData `json:"data,required"` @@ -493,7 +585,7 @@ type CERTRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -588,6 +680,46 @@ func (r CERTRecordType) IsKnown() bool { return false } +type CERTRecordParam struct { + // Components of a CERT record. + Data param.Field[CERTRecordDataParam] `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[CERTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r CERTRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CERTRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a CERT record. +type CERTRecordDataParam 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 CERTRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type CNAMERecord struct { // A valid hostname. Must not match the record's name. Content interface{} `json:"content,required"` @@ -606,7 +738,7 @@ type CNAMERecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -673,6 +805,33 @@ func (r CNAMERecordType) IsKnown() bool { return false } +type CNAMERecordParam struct { + // 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[CNAMERecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r CNAMERecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r CNAMERecordParam) implementsDNSRecordUnionParam() {} + type DNSKEYRecord struct { // Components of a DNSKEY record. Data DNSKEYRecordData `json:"data,required"` @@ -693,7 +852,7 @@ type DNSKEYRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -789,6 +948,46 @@ func (r DNSKEYRecordType) IsKnown() bool { return false } +type DNSKEYRecordParam struct { + // Components of a DNSKEY record. + Data param.Field[DNSKEYRecordDataParam] `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[DNSKEYRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r DNSKEYRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r DNSKEYRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a DNSKEY record. +type DNSKEYRecordDataParam 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 DNSKEYRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type DSRecord struct { // Components of a DS record. Data DSRecordData `json:"data,required"` @@ -809,7 +1008,7 @@ type DSRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -904,6 +1103,46 @@ func (r DSRecordType) IsKnown() bool { return false } +type DSRecordParam struct { + // Components of a DS record. + Data param.Field[DSRecordDataParam] `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[DSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r DSRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r DSRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a DS record. +type DSRecordDataParam 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 DSRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type HTTPSRecord struct { // Components of a HTTPS record. Data HTTPSRecordData `json:"data,required"` @@ -924,7 +1163,7 @@ type HTTPSRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1016,6 +1255,44 @@ func (r HTTPSRecordType) IsKnown() bool { return false } +type HTTPSRecordParam struct { + // Components of a HTTPS record. + Data param.Field[HTTPSRecordDataParam] `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[HTTPSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r HTTPSRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r HTTPSRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a HTTPS record. +type HTTPSRecordDataParam struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r HTTPSRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type LOCRecord struct { // Components of a LOC record. Data LOCRecordData `json:"data,required"` @@ -1036,7 +1313,7 @@ type LOCRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1187,32 +1464,88 @@ func (r LOCRecordType) IsKnown() bool { return false } -type MXRecord struct { - // A valid mail server hostname. - Content string `json:"content,required" format:"hostname"` +type LOCRecordParam struct { + // Components of a LOC record. + Data param.Field[LOCRecordDataParam] `json:"data,required"` // DNS record name (or @ for the zone apex) in Punycode. - Name string `json:"name,required"` - // Required for MX, SRV and URI records; unused by other record types. Records with - // lower priorities are preferred. - Priority float64 `json:"priority,required"` + Name param.Field[string] `json:"name,required"` // Record type. - Type MXRecordType `json:"type,required"` - // Identifier - ID string `json:"id"` + Type param.Field[LOCRecordType] `json:"type,required"` // Comments or notes about the DNS record. This field has no effect on DNS // responses. - Comment string `json:"comment"` - // When the record was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // Whether this record can be modified/deleted (true means it's managed by - // Cloudflare). - Locked bool `json:"locked"` - // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` - // When the record was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // Whether the record can be proxied by Cloudflare or not. - Proxiable bool `json:"proxiable"` + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r LOCRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r LOCRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a LOC record. +type LOCRecordDataParam 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[LOCRecordDataLatDirection] `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[LOCRecordDataLongDirection] `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 LOCRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MXRecord struct { + // A valid mail server hostname. + Content string `json:"content,required" format:"hostname"` + // DNS record name (or @ for the zone apex) in Punycode. + Name string `json:"name,required"` + // Required for MX, SRV and URI records; unused by other record types. Records with + // lower priorities are preferred. + Priority float64 `json:"priority,required"` + // Record type. + Type MXRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // Whether this record can be modified/deleted (true means it's managed by + // Cloudflare). + Locked bool `json:"locked"` + // Extra Cloudflare-specific information about the record. + Meta RecordMetadata `json:"meta"` + // When the record was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Whether the record can be proxied by Cloudflare or not. + Proxiable bool `json:"proxiable"` // Custom tags for the DNS record. This field has no effect on DNS responses. Tags []RecordTags `json:"tags"` // Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. @@ -1272,6 +1605,33 @@ func (r MXRecordType) IsKnown() bool { return false } +type MXRecordParam struct { + // 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[MXRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r MXRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r MXRecordParam) implementsDNSRecordUnionParam() {} + type NAPTRRecord struct { // Components of a NAPTR record. Data NAPTRRecordData `json:"data,required"` @@ -1292,7 +1652,7 @@ type NAPTRRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1393,6 +1753,50 @@ func (r NAPTRRecordType) IsKnown() bool { return false } +type NAPTRRecordParam struct { + // Components of a NAPTR record. + Data param.Field[NAPTRRecordDataParam] `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[NAPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r NAPTRRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r NAPTRRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a NAPTR record. +type NAPTRRecordDataParam 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 NAPTRRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type NSRecord struct { // A valid name server host name. Content string `json:"content,required"` @@ -1411,7 +1815,7 @@ type NSRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1474,6 +1878,30 @@ func (r NSRecordType) IsKnown() bool { return false } +type NSRecordParam struct { + // A valid name server host name. + 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[NSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r NSRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r NSRecordParam) implementsDNSRecordUnionParam() {} + type PTRRecord struct { // Domain name pointing to the address. Content string `json:"content,required"` @@ -1492,7 +1920,7 @@ type PTRRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1555,6 +1983,30 @@ func (r PTRRecordType) IsKnown() bool { return false } +type PTRRecordParam struct { + // 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[PTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r PTRRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r PTRRecordParam) implementsDNSRecordUnionParam() {} + type Record struct { Content interface{} `json:"content,required"` // DNS record name (or @ for the zone apex) in Punycode. @@ -1575,7 +2027,7 @@ type Record struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1787,6 +2239,113 @@ func (r RecordType) IsKnown() bool { return false } +type RecordParam struct { + Content param.Field[interface{}] `json:"content,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` + // Whether the record is receiving the performance and security benefits of + // Cloudflare. + Proxied param.Field[bool] `json:"proxied"` + // Record type. + Type param.Field[RecordType] `json:"type,required"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment param.Field[string] `json:"comment"` + Tags param.Field[interface{}] `json:"tags,required"` + // 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[TTLUnionParam] `json:"ttl"` + Data param.Field[interface{}] `json:"data,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"` +} + +func (r RecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r RecordParam) implementsDNSRecordUnionParam() {} + +// Satisfied by [dns.ARecordParam], [dns.AAAARecordParam], [dns.CAARecordParam], +// [dns.CERTRecordParam], [dns.CNAMERecordParam], [dns.DNSKEYRecordParam], +// [dns.DSRecordParam], [dns.HTTPSRecordParam], [dns.LOCRecordParam], +// [dns.MXRecordParam], [dns.NAPTRRecordParam], [dns.NSRecordParam], +// [dns.PTRRecordParam], [dns.SMIMEARecordParam], [dns.SRVRecordParam], +// [dns.SSHFPRecordParam], [dns.SVCBRecordParam], [dns.TLSARecordParam], +// [dns.TXTRecordParam], [dns.URIRecordParam], [RecordParam]. +type RecordUnionParam interface { + implementsDNSRecordUnionParam() +} + +// Extra Cloudflare-specific information about the record. +type RecordMetadata struct { + // Will exist if Cloudflare automatically added this DNS record during initial + // setup. + AutoAdded bool `json:"auto_added"` + // Where the record originated from. + Source string `json:"source"` + JSON recordMetadataJSON `json:"-"` +} + +// recordMetadataJSON contains the JSON metadata for the struct [RecordMetadata] +type recordMetadataJSON struct { + AutoAdded apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordMetadataJSON) RawJSON() string { + return r.raw +} + +// Extra Cloudflare-specific information about the record. +type RecordMetadataParam 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 RecordMetadataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RecordProcessTiming struct { + // When the file parsing ended. + EndTime time.Time `json:"end_time" format:"date-time"` + // Processing time of the file in seconds. + ProcessTime float64 `json:"process_time"` + // When the file parsing started. + StartTime time.Time `json:"start_time" format:"date-time"` + JSON recordProcessTimingJSON `json:"-"` +} + +// recordProcessTimingJSON contains the JSON metadata for the struct +// [RecordProcessTiming] +type recordProcessTimingJSON struct { + EndTime apijson.Field + ProcessTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordProcessTiming) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r recordProcessTimingJSON) RawJSON() string { + return r.raw +} + type RecordTags = string type RecordTagsParam = string @@ -1811,7 +2370,7 @@ type SMIMEARecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -1907,30 +2466,70 @@ func (r SMIMEARecordType) IsKnown() bool { return false } -type SRVRecord struct { - // Components of a SRV record. - Data SRVRecordData `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 string `json:"name,required"` +type SMIMEARecordParam struct { + // Components of a SMIMEA record. + Data param.Field[SMIMEARecordDataParam] `json:"data,required"` + // DNS record name (or @ for the zone apex) in Punycode. + Name param.Field[string] `json:"name,required"` // Record type. - Type SRVRecordType `json:"type,required"` - // Identifier - ID string `json:"id"` + Type param.Field[SMIMEARecordType] `json:"type,required"` // Comments or notes about the DNS record. This field has no effect on DNS // responses. - Comment string `json:"comment"` - // Priority, weight, port, and SRV target. See 'data' for setting the individual - // component values. - Content string `json:"content"` - // When the record was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` + Comment param.Field[string] `json:"comment"` + // Custom tags for the DNS record. This field has no effect on DNS responses. + Tags param.Field[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r SMIMEARecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SMIMEARecordParam) implementsDNSRecordUnionParam() {} + +// Components of a SMIMEA record. +type SMIMEARecordDataParam 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 SMIMEARecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type SRVRecord struct { + // Components of a SRV record. + Data SRVRecordData `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 string `json:"name,required"` + // Record type. + Type SRVRecordType `json:"type,required"` + // Identifier + ID string `json:"id"` + // Comments or notes about the DNS record. This field has no effect on DNS + // responses. + Comment string `json:"comment"` + // Priority, weight, port, and SRV target. See 'data' for setting the individual + // component values. + Content string `json:"content"` + // When the record was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` // Whether this record can be modified/deleted (true means it's managed by // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2041,6 +2640,61 @@ func (r SRVRecordType) IsKnown() bool { return false } +type SRVRecordParam struct { + // Components of a SRV record. + Data param.Field[SRVRecordDataParam] `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[SRVRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r SRVRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SRVRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a SRV record. +type SRVRecordDataParam 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 SRVRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type SSHFPRecord struct { // Components of a SSHFP record. Data SSHFPRecordData `json:"data,required"` @@ -2061,7 +2715,7 @@ type SSHFPRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2153,6 +2807,44 @@ func (r SSHFPRecordType) IsKnown() bool { return false } +type SSHFPRecordParam struct { + // Components of a SSHFP record. + Data param.Field[SSHFPRecordDataParam] `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[SSHFPRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r SSHFPRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SSHFPRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a SSHFP record. +type SSHFPRecordDataParam struct { + // algorithm. + Algorithm param.Field[float64] `json:"algorithm"` + // fingerprint. + Fingerprint param.Field[string] `json:"fingerprint"` + // type. + Type param.Field[float64] `json:"type"` +} + +func (r SSHFPRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type SVCBRecord struct { // Components of a SVCB record. Data SVCBRecordData `json:"data,required"` @@ -2173,7 +2865,7 @@ type SVCBRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2265,6 +2957,44 @@ func (r SVCBRecordType) IsKnown() bool { return false } +type SVCBRecordParam struct { + // Components of a SVCB record. + Data param.Field[SVCBRecordDataParam] `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[SVCBRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r SVCBRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r SVCBRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a SVCB record. +type SVCBRecordDataParam struct { + // priority. + Priority param.Field[float64] `json:"priority"` + // target. + Target param.Field[string] `json:"target"` + // value. + Value param.Field[string] `json:"value"` +} + +func (r SVCBRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type TLSARecord struct { // Components of a TLSA record. Data TLSARecordData `json:"data,required"` @@ -2285,7 +3015,7 @@ type TLSARecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2380,6 +3110,46 @@ func (r TLSARecordType) IsKnown() bool { return false } +type TLSARecordParam struct { + // Components of a TLSA record. + Data param.Field[TLSARecordDataParam] `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[TLSARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r TLSARecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r TLSARecordParam) implementsDNSRecordUnionParam() {} + +// Components of a TLSA record. +type TLSARecordDataParam 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 TLSARecordDataParam) 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. @@ -2445,7 +3215,7 @@ type TXTRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2508,60 +3278,29 @@ func (r TXTRecordType) IsKnown() bool { return false } -// Extra Cloudflare-specific information about the record. -type UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb struct { - // Will exist if Cloudflare automatically added this DNS record during initial - // setup. - AutoAdded bool `json:"auto_added"` - // Where the record originated from. - Source string `json:"source"` - JSON unnamedSchemaRef1391721bdb8938d5420a8bc738a44debJSON `json:"-"` -} - -// unnamedSchemaRef1391721bdb8938d5420a8bc738a44debJSON contains the JSON metadata -// for the struct [UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb] -type unnamedSchemaRef1391721bdb8938d5420a8bc738a44debJSON struct { - AutoAdded apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r unnamedSchemaRef1391721bdb8938d5420a8bc738a44debJSON) RawJSON() string { - return r.raw -} - -type UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd struct { - // When the file parsing ended. - EndTime time.Time `json:"end_time" format:"date-time"` - // Processing time of the file in seconds. - ProcessTime float64 `json:"process_time"` - // When the file parsing started. - StartTime time.Time `json:"start_time" format:"date-time"` - JSON unnamedSchemaRef2f895e023ae55b55d2f5925449b819cdJSON `json:"-"` -} - -// unnamedSchemaRef2f895e023ae55b55d2f5925449b819cdJSON contains the JSON metadata -// for the struct [UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd] -type unnamedSchemaRef2f895e023ae55b55d2f5925449b819cdJSON struct { - EndTime apijson.Field - ProcessTime apijson.Field - StartTime apijson.Field - raw string - ExtraFields map[string]apijson.Field +type TXTRecordParam struct { + // 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[TXTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` } -func (r *UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r TXTRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r unnamedSchemaRef2f895e023ae55b55d2f5925449b819cdJSON) RawJSON() string { - return r.raw -} +func (r TXTRecordParam) implementsDNSRecordUnionParam() {} type URIRecord struct { // Components of a URI record. @@ -2586,7 +3325,7 @@ type URIRecord struct { // Cloudflare). Locked bool `json:"locked"` // Extra Cloudflare-specific information about the record. - Meta UnnamedSchemaRef1391721bdb8938d5420a8bc738a44deb `json:"meta"` + Meta RecordMetadata `json:"meta"` // When the record was last modified. ModifiedOn time.Time `json:"modified_on" format:"date-time"` // Whether the record can be proxied by Cloudflare or not. @@ -2676,24 +3415,63 @@ func (r URIRecordType) IsKnown() bool { return false } -type RecordDeleteResponse struct { - // Identifier - ID string `json:"id"` - JSON recordDeleteResponseJSON `json:"-"` -} - -// recordDeleteResponseJSON contains the JSON metadata for the struct -// [RecordDeleteResponse] -type recordDeleteResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RecordDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - +type URIRecordParam struct { + // Components of a URI record. + Data param.Field[URIRecordDataParam] `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[URIRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +} + +func (r URIRecordParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r URIRecordParam) implementsDNSRecordUnionParam() {} + +// Components of a URI record. +type URIRecordDataParam struct { + // The record content. + Content param.Field[string] `json:"content"` + // The record weight. + Weight param.Field[float64] `json:"weight"` +} + +func (r URIRecordDataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RecordDeleteResponse struct { + // Identifier + ID string `json:"id"` + JSON recordDeleteResponseJSON `json:"-"` +} + +// recordDeleteResponseJSON contains the JSON metadata for the struct +// [RecordDeleteResponse] +type recordDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RecordDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + func (r recordDeleteResponseJSON) RawJSON() string { return r.raw } @@ -2748,4038 +3526,363 @@ func (r recordScanResponseJSON) RawJSON() string { return r.raw } -// This interface is a union satisfied by one of the following: -// [RecordNewParamsARecord], [RecordNewParamsAAAARecord], -// [RecordNewParamsCAARecord], [RecordNewParamsCERTRecord], -// [RecordNewParamsCNAMERecord], [RecordNewParamsDNSKEYRecord], -// [RecordNewParamsDSRecord], [RecordNewParamsHTTPSRecord], -// [RecordNewParamsLOCRecord], [RecordNewParamsMXRecord], -// [RecordNewParamsNAPTRRecord], [RecordNewParamsNSRecord], -// [RecordNewParamsPTRRecord], [RecordNewParamsSMIMEARecord], -// [RecordNewParamsSRVRecord], [RecordNewParamsSSHFPRecord], -// [RecordNewParamsSVCBRecord], [RecordNewParamsTLSARecord], -// [RecordNewParamsTXTRecord], [RecordNewParamsURIRecord]. -type RecordNewParams interface { - ImplementsRecordNewParams() - - getZoneID() param.Field[string] -} - -type RecordNewParamsARecord struct { +type RecordNewParams 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[RecordNewParamsARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsARecord) ImplementsRecordNewParams() { - + Record RecordUnionParam `json:"record,required"` } -// Record type. -type RecordNewParamsARecordType string - -const ( - RecordNewParamsARecordTypeA RecordNewParamsARecordType = "A" -) - -func (r RecordNewParamsARecordType) IsKnown() bool { - switch r { - case RecordNewParamsARecordTypeA: - return true - } - return false +func (r RecordNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Record) } -type RecordNewParamsAAAARecord 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[RecordNewParamsAAAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +type RecordNewResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result Record `json:"result,required"` + // Whether the API call was successful + Success RecordNewResponseEnvelopeSuccess `json:"success,required"` + JSON recordNewResponseEnvelopeJSON `json:"-"` } -func (r RecordNewParamsAAAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// 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 RecordNewParamsAAAARecord) getZoneID() param.Field[string] { - return r.ZoneID +func (r *RecordNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (RecordNewParamsAAAARecord) ImplementsRecordNewParams() { - +func (r recordNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// Record type. -type RecordNewParamsAAAARecordType string +// Whether the API call was successful +type RecordNewResponseEnvelopeSuccess bool const ( - RecordNewParamsAAAARecordTypeAAAA RecordNewParamsAAAARecordType = "AAAA" + RecordNewResponseEnvelopeSuccessTrue RecordNewResponseEnvelopeSuccess = true ) -func (r RecordNewParamsAAAARecordType) IsKnown() bool { +func (r RecordNewResponseEnvelopeSuccess) IsKnown() bool { switch r { - case RecordNewParamsAAAARecordTypeAAAA: + case RecordNewResponseEnvelopeSuccessTrue: return true } return false } -type RecordNewParamsCAARecord struct { +type RecordUpdateParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CAA record. - Data param.Field[RecordNewParamsCAARecordData] `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[RecordNewParamsCAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` + Record RecordUnionParam `json:"record,required"` } -func (r RecordNewParamsCAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r RecordUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Record) } -func (r RecordNewParamsCAARecord) getZoneID() param.Field[string] { - return r.ZoneID +type RecordUpdateResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result Record `json:"result,required"` + // Whether the API call was successful + Success RecordUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON recordUpdateResponseEnvelopeJSON `json:"-"` } -func (RecordNewParamsCAARecord) ImplementsRecordNewParams() { - +// 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 } -// Components of a CAA record. -type RecordNewParamsCAARecordData 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 *RecordUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RecordNewParamsCAARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r recordUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// Record type. -type RecordNewParamsCAARecordType string +// Whether the API call was successful +type RecordUpdateResponseEnvelopeSuccess bool const ( - RecordNewParamsCAARecordTypeCAA RecordNewParamsCAARecordType = "CAA" + RecordUpdateResponseEnvelopeSuccessTrue RecordUpdateResponseEnvelopeSuccess = true ) -func (r RecordNewParamsCAARecordType) IsKnown() bool { +func (r RecordUpdateResponseEnvelopeSuccess) IsKnown() bool { switch r { - case RecordNewParamsCAARecordTypeCAA: + case RecordUpdateResponseEnvelopeSuccessTrue: return true } return false } -type RecordNewParamsCERTRecord struct { +type RecordListParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CERT record. - Data param.Field[RecordNewParamsCERTRecordData] `json:"data,required"` + 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] `json:"name,required"` + 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[RecordNewParamsCERTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsCERTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsCERTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsCERTRecord) ImplementsRecordNewParams() { - -} - -// Components of a CERT record. -type RecordNewParamsCERTRecordData 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"` + Type param.Field[RecordListParamsType] `query:"type"` } -func (r RecordNewParamsCERTRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// URLQuery serializes [RecordListParams]'s query parameters as `url.Values`. +func (r RecordListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) } -// Record type. -type RecordNewParamsCERTRecordType string - -const ( - RecordNewParamsCERTRecordTypeCERT RecordNewParamsCERTRecordType = "CERT" -) - -func (r RecordNewParamsCERTRecordType) IsKnown() bool { - switch r { - case RecordNewParamsCERTRecordTypeCERT: - return true - } - return false -} - -type RecordNewParamsCNAMERecord 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[RecordNewParamsCNAMERecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsCNAMERecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsCNAMERecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsCNAMERecord) ImplementsRecordNewParams() { - -} - -// Record type. -type RecordNewParamsCNAMERecordType string - -const ( - RecordNewParamsCNAMERecordTypeCNAME RecordNewParamsCNAMERecordType = "CNAME" -) - -func (r RecordNewParamsCNAMERecordType) IsKnown() bool { - switch r { - case RecordNewParamsCNAMERecordTypeCNAME: - return true - } - return false -} - -type RecordNewParamsDNSKEYRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DNSKEY record. - Data param.Field[RecordNewParamsDNSKEYRecordData] `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[RecordNewParamsDNSKEYRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsDNSKEYRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsDNSKEYRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsDNSKEYRecord) ImplementsRecordNewParams() { - -} - -// Components of a DNSKEY record. -type RecordNewParamsDNSKEYRecordData 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 RecordNewParamsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsDNSKEYRecordType string - -const ( - RecordNewParamsDNSKEYRecordTypeDNSKEY RecordNewParamsDNSKEYRecordType = "DNSKEY" -) - -func (r RecordNewParamsDNSKEYRecordType) IsKnown() bool { - switch r { - case RecordNewParamsDNSKEYRecordTypeDNSKEY: - return true - } - return false -} - -type RecordNewParamsDSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DS record. - Data param.Field[RecordNewParamsDSRecordData] `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[RecordNewParamsDSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsDSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsDSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsDSRecord) ImplementsRecordNewParams() { - -} - -// Components of a DS record. -type RecordNewParamsDSRecordData 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 RecordNewParamsDSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsDSRecordType string - -const ( - RecordNewParamsDSRecordTypeDS RecordNewParamsDSRecordType = "DS" -) - -func (r RecordNewParamsDSRecordType) IsKnown() bool { - switch r { - case RecordNewParamsDSRecordTypeDS: - return true - } - return false -} - -type RecordNewParamsHTTPSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a HTTPS record. - Data param.Field[RecordNewParamsHTTPSRecordData] `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[RecordNewParamsHTTPSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsHTTPSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsHTTPSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsHTTPSRecord) ImplementsRecordNewParams() { - -} - -// Components of a HTTPS record. -type RecordNewParamsHTTPSRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordNewParamsHTTPSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsHTTPSRecordType string - -const ( - RecordNewParamsHTTPSRecordTypeHTTPS RecordNewParamsHTTPSRecordType = "HTTPS" -) - -func (r RecordNewParamsHTTPSRecordType) IsKnown() bool { - switch r { - case RecordNewParamsHTTPSRecordTypeHTTPS: - return true - } - return false -} - -type RecordNewParamsLOCRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a LOC record. - Data param.Field[RecordNewParamsLOCRecordData] `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[RecordNewParamsLOCRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsLOCRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsLOCRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsLOCRecord) ImplementsRecordNewParams() { - -} - -// Components of a LOC record. -type RecordNewParamsLOCRecordData 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[RecordNewParamsLOCRecordDataLatDirection] `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[RecordNewParamsLOCRecordDataLongDirection] `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 RecordNewParamsLOCRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Latitude direction. -type RecordNewParamsLOCRecordDataLatDirection string - -const ( - RecordNewParamsLOCRecordDataLatDirectionN RecordNewParamsLOCRecordDataLatDirection = "N" - RecordNewParamsLOCRecordDataLatDirectionS RecordNewParamsLOCRecordDataLatDirection = "S" -) - -func (r RecordNewParamsLOCRecordDataLatDirection) IsKnown() bool { - switch r { - case RecordNewParamsLOCRecordDataLatDirectionN, RecordNewParamsLOCRecordDataLatDirectionS: - return true - } - return false -} - -// Longitude direction. -type RecordNewParamsLOCRecordDataLongDirection string - -const ( - RecordNewParamsLOCRecordDataLongDirectionE RecordNewParamsLOCRecordDataLongDirection = "E" - RecordNewParamsLOCRecordDataLongDirectionW RecordNewParamsLOCRecordDataLongDirection = "W" -) - -func (r RecordNewParamsLOCRecordDataLongDirection) IsKnown() bool { - switch r { - case RecordNewParamsLOCRecordDataLongDirectionE, RecordNewParamsLOCRecordDataLongDirectionW: - return true - } - return false -} - -// Record type. -type RecordNewParamsLOCRecordType string - -const ( - RecordNewParamsLOCRecordTypeLOC RecordNewParamsLOCRecordType = "LOC" -) - -func (r RecordNewParamsLOCRecordType) IsKnown() bool { - switch r { - case RecordNewParamsLOCRecordTypeLOC: - return true - } - return false -} - -type RecordNewParamsMXRecord 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[RecordNewParamsMXRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsMXRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsMXRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsMXRecord) ImplementsRecordNewParams() { - -} - -// Record type. -type RecordNewParamsMXRecordType string - -const ( - RecordNewParamsMXRecordTypeMX RecordNewParamsMXRecordType = "MX" -) - -func (r RecordNewParamsMXRecordType) IsKnown() bool { - switch r { - case RecordNewParamsMXRecordTypeMX: - return true - } - return false -} - -type RecordNewParamsNAPTRRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a NAPTR record. - Data param.Field[RecordNewParamsNAPTRRecordData] `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[RecordNewParamsNAPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsNAPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsNAPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsNAPTRRecord) ImplementsRecordNewParams() { - -} - -// Components of a NAPTR record. -type RecordNewParamsNAPTRRecordData 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 RecordNewParamsNAPTRRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsNAPTRRecordType string - -const ( - RecordNewParamsNAPTRRecordTypeNAPTR RecordNewParamsNAPTRRecordType = "NAPTR" -) - -func (r RecordNewParamsNAPTRRecordType) IsKnown() bool { - switch r { - case RecordNewParamsNAPTRRecordTypeNAPTR: - return true - } - return false -} - -type RecordNewParamsNSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A valid name server host name. - 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[RecordNewParamsNSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsNSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsNSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsNSRecord) ImplementsRecordNewParams() { - -} - -// Record type. -type RecordNewParamsNSRecordType string - -const ( - RecordNewParamsNSRecordTypeNS RecordNewParamsNSRecordType = "NS" -) - -func (r RecordNewParamsNSRecordType) IsKnown() bool { - switch r { - case RecordNewParamsNSRecordTypeNS: - return true - } - return false -} - -type RecordNewParamsPTRRecord 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[RecordNewParamsPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsPTRRecord) ImplementsRecordNewParams() { - -} - -// Record type. -type RecordNewParamsPTRRecordType string - -const ( - RecordNewParamsPTRRecordTypePTR RecordNewParamsPTRRecordType = "PTR" -) - -func (r RecordNewParamsPTRRecordType) IsKnown() bool { - switch r { - case RecordNewParamsPTRRecordTypePTR: - return true - } - return false -} - -type RecordNewParamsSMIMEARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SMIMEA record. - Data param.Field[RecordNewParamsSMIMEARecordData] `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[RecordNewParamsSMIMEARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsSMIMEARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsSMIMEARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsSMIMEARecord) ImplementsRecordNewParams() { - -} - -// Components of a SMIMEA record. -type RecordNewParamsSMIMEARecordData 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 RecordNewParamsSMIMEARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsSMIMEARecordType string - -const ( - RecordNewParamsSMIMEARecordTypeSMIMEA RecordNewParamsSMIMEARecordType = "SMIMEA" -) - -func (r RecordNewParamsSMIMEARecordType) IsKnown() bool { - switch r { - case RecordNewParamsSMIMEARecordTypeSMIMEA: - return true - } - return false -} - -type RecordNewParamsSRVRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SRV record. - Data param.Field[RecordNewParamsSRVRecordData] `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[RecordNewParamsSRVRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsSRVRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsSRVRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsSRVRecord) ImplementsRecordNewParams() { - -} - -// Components of a SRV record. -type RecordNewParamsSRVRecordData 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 RecordNewParamsSRVRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsSRVRecordType string - -const ( - RecordNewParamsSRVRecordTypeSRV RecordNewParamsSRVRecordType = "SRV" -) - -func (r RecordNewParamsSRVRecordType) IsKnown() bool { - switch r { - case RecordNewParamsSRVRecordTypeSRV: - return true - } - return false -} - -type RecordNewParamsSSHFPRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SSHFP record. - Data param.Field[RecordNewParamsSSHFPRecordData] `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[RecordNewParamsSSHFPRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsSSHFPRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsSSHFPRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsSSHFPRecord) ImplementsRecordNewParams() { - -} - -// Components of a SSHFP record. -type RecordNewParamsSSHFPRecordData struct { - // algorithm. - Algorithm param.Field[float64] `json:"algorithm"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // type. - Type param.Field[float64] `json:"type"` -} - -func (r RecordNewParamsSSHFPRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsSSHFPRecordType string - -const ( - RecordNewParamsSSHFPRecordTypeSSHFP RecordNewParamsSSHFPRecordType = "SSHFP" -) - -func (r RecordNewParamsSSHFPRecordType) IsKnown() bool { - switch r { - case RecordNewParamsSSHFPRecordTypeSSHFP: - return true - } - return false -} - -type RecordNewParamsSVCBRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SVCB record. - Data param.Field[RecordNewParamsSVCBRecordData] `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[RecordNewParamsSVCBRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsSVCBRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsSVCBRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsSVCBRecord) ImplementsRecordNewParams() { - -} - -// Components of a SVCB record. -type RecordNewParamsSVCBRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordNewParamsSVCBRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsSVCBRecordType string - -const ( - RecordNewParamsSVCBRecordTypeSVCB RecordNewParamsSVCBRecordType = "SVCB" -) - -func (r RecordNewParamsSVCBRecordType) IsKnown() bool { - switch r { - case RecordNewParamsSVCBRecordTypeSVCB: - return true - } - return false -} - -type RecordNewParamsTLSARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a TLSA record. - Data param.Field[RecordNewParamsTLSARecordData] `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[RecordNewParamsTLSARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsTLSARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsTLSARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsTLSARecord) ImplementsRecordNewParams() { - -} - -// Components of a TLSA record. -type RecordNewParamsTLSARecordData 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 RecordNewParamsTLSARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsTLSARecordType string - -const ( - RecordNewParamsTLSARecordTypeTLSA RecordNewParamsTLSARecordType = "TLSA" -) - -func (r RecordNewParamsTLSARecordType) IsKnown() bool { - switch r { - case RecordNewParamsTLSARecordTypeTLSA: - return true - } - return false -} - -type RecordNewParamsTXTRecord 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[RecordNewParamsTXTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsTXTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsTXTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsTXTRecord) ImplementsRecordNewParams() { - -} - -// Record type. -type RecordNewParamsTXTRecordType string - -const ( - RecordNewParamsTXTRecordTypeTXT RecordNewParamsTXTRecordType = "TXT" -) - -func (r RecordNewParamsTXTRecordType) IsKnown() bool { - switch r { - case RecordNewParamsTXTRecordTypeTXT: - return true - } - return false -} - -type RecordNewParamsURIRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a URI record. - Data param.Field[RecordNewParamsURIRecordData] `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[RecordNewParamsURIRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordNewParamsURIRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordNewParamsURIRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordNewParamsURIRecord) ImplementsRecordNewParams() { - -} - -// Components of a URI record. -type RecordNewParamsURIRecordData struct { - // The record content. - Content param.Field[string] `json:"content"` - // The record weight. - Weight param.Field[float64] `json:"weight"` -} - -func (r RecordNewParamsURIRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordNewParamsURIRecordType string - -const ( - RecordNewParamsURIRecordTypeURI RecordNewParamsURIRecordType = "URI" -) - -func (r RecordNewParamsURIRecordType) IsKnown() bool { - switch r { - case RecordNewParamsURIRecordTypeURI: - return true - } - return false -} - -type RecordNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result Record `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 -} - -// 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: -// [RecordUpdateParamsARecord], [RecordUpdateParamsAAAARecord], -// [RecordUpdateParamsCAARecord], [RecordUpdateParamsCERTRecord], -// [RecordUpdateParamsCNAMERecord], [RecordUpdateParamsDNSKEYRecord], -// [RecordUpdateParamsDSRecord], [RecordUpdateParamsHTTPSRecord], -// [RecordUpdateParamsLOCRecord], [RecordUpdateParamsMXRecord], -// [RecordUpdateParamsNAPTRRecord], [RecordUpdateParamsNSRecord], -// [RecordUpdateParamsPTRRecord], [RecordUpdateParamsSMIMEARecord], -// [RecordUpdateParamsSRVRecord], [RecordUpdateParamsSSHFPRecord], -// [RecordUpdateParamsSVCBRecord], [RecordUpdateParamsTLSARecord], -// [RecordUpdateParamsTXTRecord], [RecordUpdateParamsURIRecord]. -type RecordUpdateParams interface { - ImplementsRecordUpdateParams() - - getZoneID() param.Field[string] -} - -type RecordUpdateParamsARecord 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[RecordUpdateParamsARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsARecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsARecordType string - -const ( - RecordUpdateParamsARecordTypeA RecordUpdateParamsARecordType = "A" -) - -func (r RecordUpdateParamsARecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsARecordTypeA: - return true - } - return false -} - -type RecordUpdateParamsAAAARecord 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[RecordUpdateParamsAAAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsAAAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsAAAARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsAAAARecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsAAAARecordType string - -const ( - RecordUpdateParamsAAAARecordTypeAAAA RecordUpdateParamsAAAARecordType = "AAAA" -) - -func (r RecordUpdateParamsAAAARecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsAAAARecordTypeAAAA: - return true - } - return false -} - -type RecordUpdateParamsCAARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CAA record. - Data param.Field[RecordUpdateParamsCAARecordData] `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[RecordUpdateParamsCAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsCAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsCAARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsCAARecord) ImplementsRecordUpdateParams() { - -} - -// Components of a CAA record. -type RecordUpdateParamsCAARecordData 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 RecordUpdateParamsCAARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsCAARecordType string - -const ( - RecordUpdateParamsCAARecordTypeCAA RecordUpdateParamsCAARecordType = "CAA" -) - -func (r RecordUpdateParamsCAARecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsCAARecordTypeCAA: - return true - } - return false -} - -type RecordUpdateParamsCERTRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CERT record. - Data param.Field[RecordUpdateParamsCERTRecordData] `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[RecordUpdateParamsCERTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsCERTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsCERTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsCERTRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a CERT record. -type RecordUpdateParamsCERTRecordData 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 RecordUpdateParamsCERTRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsCERTRecordType string - -const ( - RecordUpdateParamsCERTRecordTypeCERT RecordUpdateParamsCERTRecordType = "CERT" -) - -func (r RecordUpdateParamsCERTRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsCERTRecordTypeCERT: - return true - } - return false -} - -type RecordUpdateParamsCNAMERecord 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[RecordUpdateParamsCNAMERecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsCNAMERecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsCNAMERecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsCNAMERecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsCNAMERecordType string - -const ( - RecordUpdateParamsCNAMERecordTypeCNAME RecordUpdateParamsCNAMERecordType = "CNAME" -) - -func (r RecordUpdateParamsCNAMERecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsCNAMERecordTypeCNAME: - return true - } - return false -} - -type RecordUpdateParamsDNSKEYRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DNSKEY record. - Data param.Field[RecordUpdateParamsDNSKEYRecordData] `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[RecordUpdateParamsDNSKEYRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsDNSKEYRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsDNSKEYRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsDNSKEYRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a DNSKEY record. -type RecordUpdateParamsDNSKEYRecordData 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 RecordUpdateParamsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsDNSKEYRecordType string - -const ( - RecordUpdateParamsDNSKEYRecordTypeDNSKEY RecordUpdateParamsDNSKEYRecordType = "DNSKEY" -) - -func (r RecordUpdateParamsDNSKEYRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsDNSKEYRecordTypeDNSKEY: - return true - } - return false -} - -type RecordUpdateParamsDSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DS record. - Data param.Field[RecordUpdateParamsDSRecordData] `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[RecordUpdateParamsDSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsDSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsDSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsDSRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a DS record. -type RecordUpdateParamsDSRecordData 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 RecordUpdateParamsDSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsDSRecordType string - -const ( - RecordUpdateParamsDSRecordTypeDS RecordUpdateParamsDSRecordType = "DS" -) - -func (r RecordUpdateParamsDSRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsDSRecordTypeDS: - return true - } - return false -} - -type RecordUpdateParamsHTTPSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a HTTPS record. - Data param.Field[RecordUpdateParamsHTTPSRecordData] `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[RecordUpdateParamsHTTPSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsHTTPSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsHTTPSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsHTTPSRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a HTTPS record. -type RecordUpdateParamsHTTPSRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordUpdateParamsHTTPSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsHTTPSRecordType string - -const ( - RecordUpdateParamsHTTPSRecordTypeHTTPS RecordUpdateParamsHTTPSRecordType = "HTTPS" -) - -func (r RecordUpdateParamsHTTPSRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsHTTPSRecordTypeHTTPS: - return true - } - return false -} - -type RecordUpdateParamsLOCRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a LOC record. - Data param.Field[RecordUpdateParamsLOCRecordData] `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[RecordUpdateParamsLOCRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsLOCRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsLOCRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsLOCRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a LOC record. -type RecordUpdateParamsLOCRecordData 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[RecordUpdateParamsLOCRecordDataLatDirection] `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[RecordUpdateParamsLOCRecordDataLongDirection] `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 RecordUpdateParamsLOCRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Latitude direction. -type RecordUpdateParamsLOCRecordDataLatDirection string - -const ( - RecordUpdateParamsLOCRecordDataLatDirectionN RecordUpdateParamsLOCRecordDataLatDirection = "N" - RecordUpdateParamsLOCRecordDataLatDirectionS RecordUpdateParamsLOCRecordDataLatDirection = "S" -) - -func (r RecordUpdateParamsLOCRecordDataLatDirection) IsKnown() bool { - switch r { - case RecordUpdateParamsLOCRecordDataLatDirectionN, RecordUpdateParamsLOCRecordDataLatDirectionS: - return true - } - return false -} - -// Longitude direction. -type RecordUpdateParamsLOCRecordDataLongDirection string - -const ( - RecordUpdateParamsLOCRecordDataLongDirectionE RecordUpdateParamsLOCRecordDataLongDirection = "E" - RecordUpdateParamsLOCRecordDataLongDirectionW RecordUpdateParamsLOCRecordDataLongDirection = "W" -) - -func (r RecordUpdateParamsLOCRecordDataLongDirection) IsKnown() bool { - switch r { - case RecordUpdateParamsLOCRecordDataLongDirectionE, RecordUpdateParamsLOCRecordDataLongDirectionW: - return true - } - return false -} - -// Record type. -type RecordUpdateParamsLOCRecordType string - -const ( - RecordUpdateParamsLOCRecordTypeLOC RecordUpdateParamsLOCRecordType = "LOC" -) - -func (r RecordUpdateParamsLOCRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsLOCRecordTypeLOC: - return true - } - return false -} - -type RecordUpdateParamsMXRecord 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[RecordUpdateParamsMXRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsMXRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsMXRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsMXRecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsMXRecordType string - -const ( - RecordUpdateParamsMXRecordTypeMX RecordUpdateParamsMXRecordType = "MX" -) - -func (r RecordUpdateParamsMXRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsMXRecordTypeMX: - return true - } - return false -} - -type RecordUpdateParamsNAPTRRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a NAPTR record. - Data param.Field[RecordUpdateParamsNAPTRRecordData] `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[RecordUpdateParamsNAPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsNAPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsNAPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsNAPTRRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a NAPTR record. -type RecordUpdateParamsNAPTRRecordData 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 RecordUpdateParamsNAPTRRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsNAPTRRecordType string - -const ( - RecordUpdateParamsNAPTRRecordTypeNAPTR RecordUpdateParamsNAPTRRecordType = "NAPTR" -) - -func (r RecordUpdateParamsNAPTRRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsNAPTRRecordTypeNAPTR: - return true - } - return false -} - -type RecordUpdateParamsNSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A valid name server host name. - 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[RecordUpdateParamsNSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsNSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsNSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsNSRecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsNSRecordType string - -const ( - RecordUpdateParamsNSRecordTypeNS RecordUpdateParamsNSRecordType = "NS" -) - -func (r RecordUpdateParamsNSRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsNSRecordTypeNS: - return true - } - return false -} - -type RecordUpdateParamsPTRRecord 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[RecordUpdateParamsPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsPTRRecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsPTRRecordType string - -const ( - RecordUpdateParamsPTRRecordTypePTR RecordUpdateParamsPTRRecordType = "PTR" -) - -func (r RecordUpdateParamsPTRRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsPTRRecordTypePTR: - return true - } - return false -} - -type RecordUpdateParamsSMIMEARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SMIMEA record. - Data param.Field[RecordUpdateParamsSMIMEARecordData] `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[RecordUpdateParamsSMIMEARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsSMIMEARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsSMIMEARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsSMIMEARecord) ImplementsRecordUpdateParams() { - -} - -// Components of a SMIMEA record. -type RecordUpdateParamsSMIMEARecordData 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 RecordUpdateParamsSMIMEARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsSMIMEARecordType string - -const ( - RecordUpdateParamsSMIMEARecordTypeSMIMEA RecordUpdateParamsSMIMEARecordType = "SMIMEA" -) - -func (r RecordUpdateParamsSMIMEARecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsSMIMEARecordTypeSMIMEA: - return true - } - return false -} - -type RecordUpdateParamsSRVRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SRV record. - Data param.Field[RecordUpdateParamsSRVRecordData] `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[RecordUpdateParamsSRVRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsSRVRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsSRVRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsSRVRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a SRV record. -type RecordUpdateParamsSRVRecordData 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 RecordUpdateParamsSRVRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsSRVRecordType string - -const ( - RecordUpdateParamsSRVRecordTypeSRV RecordUpdateParamsSRVRecordType = "SRV" -) - -func (r RecordUpdateParamsSRVRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsSRVRecordTypeSRV: - return true - } - return false -} - -type RecordUpdateParamsSSHFPRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SSHFP record. - Data param.Field[RecordUpdateParamsSSHFPRecordData] `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[RecordUpdateParamsSSHFPRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsSSHFPRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsSSHFPRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsSSHFPRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a SSHFP record. -type RecordUpdateParamsSSHFPRecordData struct { - // algorithm. - Algorithm param.Field[float64] `json:"algorithm"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // type. - Type param.Field[float64] `json:"type"` -} - -func (r RecordUpdateParamsSSHFPRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsSSHFPRecordType string - -const ( - RecordUpdateParamsSSHFPRecordTypeSSHFP RecordUpdateParamsSSHFPRecordType = "SSHFP" -) - -func (r RecordUpdateParamsSSHFPRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsSSHFPRecordTypeSSHFP: - return true - } - return false -} - -type RecordUpdateParamsSVCBRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SVCB record. - Data param.Field[RecordUpdateParamsSVCBRecordData] `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[RecordUpdateParamsSVCBRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsSVCBRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsSVCBRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsSVCBRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a SVCB record. -type RecordUpdateParamsSVCBRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordUpdateParamsSVCBRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsSVCBRecordType string - -const ( - RecordUpdateParamsSVCBRecordTypeSVCB RecordUpdateParamsSVCBRecordType = "SVCB" -) - -func (r RecordUpdateParamsSVCBRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsSVCBRecordTypeSVCB: - return true - } - return false -} - -type RecordUpdateParamsTLSARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a TLSA record. - Data param.Field[RecordUpdateParamsTLSARecordData] `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[RecordUpdateParamsTLSARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsTLSARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsTLSARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsTLSARecord) ImplementsRecordUpdateParams() { - -} - -// Components of a TLSA record. -type RecordUpdateParamsTLSARecordData 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 RecordUpdateParamsTLSARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsTLSARecordType string - -const ( - RecordUpdateParamsTLSARecordTypeTLSA RecordUpdateParamsTLSARecordType = "TLSA" -) - -func (r RecordUpdateParamsTLSARecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsTLSARecordTypeTLSA: - return true - } - return false -} - -type RecordUpdateParamsTXTRecord 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[RecordUpdateParamsTXTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsTXTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsTXTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsTXTRecord) ImplementsRecordUpdateParams() { - -} - -// Record type. -type RecordUpdateParamsTXTRecordType string - -const ( - RecordUpdateParamsTXTRecordTypeTXT RecordUpdateParamsTXTRecordType = "TXT" -) - -func (r RecordUpdateParamsTXTRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsTXTRecordTypeTXT: - return true - } - return false -} - -type RecordUpdateParamsURIRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a URI record. - Data param.Field[RecordUpdateParamsURIRecordData] `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[RecordUpdateParamsURIRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordUpdateParamsURIRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordUpdateParamsURIRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordUpdateParamsURIRecord) ImplementsRecordUpdateParams() { - -} - -// Components of a URI record. -type RecordUpdateParamsURIRecordData struct { - // The record content. - Content param.Field[string] `json:"content"` - // The record weight. - Weight param.Field[float64] `json:"weight"` -} - -func (r RecordUpdateParamsURIRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordUpdateParamsURIRecordType string - -const ( - RecordUpdateParamsURIRecordTypeURI RecordUpdateParamsURIRecordType = "URI" -) - -func (r RecordUpdateParamsURIRecordType) IsKnown() bool { - switch r { - case RecordUpdateParamsURIRecordTypeURI: - return true - } - return false -} - -type RecordUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result Record `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 -} - -// 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.ArrayQueryFormatRepeat, - 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.ArrayQueryFormatRepeat, - 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.ArrayQueryFormatRepeat, - 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"` - Body param.Field[interface{}] `json:"body,required"` -} - -func (r RecordDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -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: -// [RecordEditParamsARecord], [RecordEditParamsAAAARecord], -// [RecordEditParamsCAARecord], [RecordEditParamsCERTRecord], -// [RecordEditParamsCNAMERecord], [RecordEditParamsDNSKEYRecord], -// [RecordEditParamsDSRecord], [RecordEditParamsHTTPSRecord], -// [RecordEditParamsLOCRecord], [RecordEditParamsMXRecord], -// [RecordEditParamsNAPTRRecord], [RecordEditParamsNSRecord], -// [RecordEditParamsPTRRecord], [RecordEditParamsSMIMEARecord], -// [RecordEditParamsSRVRecord], [RecordEditParamsSSHFPRecord], -// [RecordEditParamsSVCBRecord], [RecordEditParamsTLSARecord], -// [RecordEditParamsTXTRecord], [RecordEditParamsURIRecord]. -type RecordEditParams interface { - ImplementsRecordEditParams() - - getZoneID() param.Field[string] -} - -type RecordEditParamsARecord 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[RecordEditParamsARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsARecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsARecordType string - -const ( - RecordEditParamsARecordTypeA RecordEditParamsARecordType = "A" -) - -func (r RecordEditParamsARecordType) IsKnown() bool { - switch r { - case RecordEditParamsARecordTypeA: - return true - } - return false -} - -type RecordEditParamsAAAARecord 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[RecordEditParamsAAAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsAAAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsAAAARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsAAAARecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsAAAARecordType string - -const ( - RecordEditParamsAAAARecordTypeAAAA RecordEditParamsAAAARecordType = "AAAA" -) - -func (r RecordEditParamsAAAARecordType) IsKnown() bool { - switch r { - case RecordEditParamsAAAARecordTypeAAAA: - return true - } - return false -} - -type RecordEditParamsCAARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CAA record. - Data param.Field[RecordEditParamsCAARecordData] `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[RecordEditParamsCAARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsCAARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsCAARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsCAARecord) ImplementsRecordEditParams() { - -} - -// Components of a CAA record. -type RecordEditParamsCAARecordData 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 RecordEditParamsCAARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsCAARecordType string - -const ( - RecordEditParamsCAARecordTypeCAA RecordEditParamsCAARecordType = "CAA" -) - -func (r RecordEditParamsCAARecordType) IsKnown() bool { - switch r { - case RecordEditParamsCAARecordTypeCAA: - return true - } - return false -} - -type RecordEditParamsCERTRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a CERT record. - Data param.Field[RecordEditParamsCERTRecordData] `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[RecordEditParamsCERTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsCERTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsCERTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsCERTRecord) ImplementsRecordEditParams() { - -} - -// Components of a CERT record. -type RecordEditParamsCERTRecordData 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 RecordEditParamsCERTRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsCERTRecordType string - -const ( - RecordEditParamsCERTRecordTypeCERT RecordEditParamsCERTRecordType = "CERT" -) - -func (r RecordEditParamsCERTRecordType) IsKnown() bool { - switch r { - case RecordEditParamsCERTRecordTypeCERT: - return true - } - return false -} - -type RecordEditParamsCNAMERecord 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[RecordEditParamsCNAMERecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsCNAMERecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsCNAMERecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsCNAMERecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsCNAMERecordType string - -const ( - RecordEditParamsCNAMERecordTypeCNAME RecordEditParamsCNAMERecordType = "CNAME" -) - -func (r RecordEditParamsCNAMERecordType) IsKnown() bool { - switch r { - case RecordEditParamsCNAMERecordTypeCNAME: - return true - } - return false -} - -type RecordEditParamsDNSKEYRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DNSKEY record. - Data param.Field[RecordEditParamsDNSKEYRecordData] `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[RecordEditParamsDNSKEYRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsDNSKEYRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsDNSKEYRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsDNSKEYRecord) ImplementsRecordEditParams() { - -} - -// Components of a DNSKEY record. -type RecordEditParamsDNSKEYRecordData 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 RecordEditParamsDNSKEYRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsDNSKEYRecordType string - -const ( - RecordEditParamsDNSKEYRecordTypeDNSKEY RecordEditParamsDNSKEYRecordType = "DNSKEY" -) - -func (r RecordEditParamsDNSKEYRecordType) IsKnown() bool { - switch r { - case RecordEditParamsDNSKEYRecordTypeDNSKEY: - return true - } - return false -} - -type RecordEditParamsDSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a DS record. - Data param.Field[RecordEditParamsDSRecordData] `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[RecordEditParamsDSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsDSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsDSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsDSRecord) ImplementsRecordEditParams() { - -} - -// Components of a DS record. -type RecordEditParamsDSRecordData 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 RecordEditParamsDSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsDSRecordType string - -const ( - RecordEditParamsDSRecordTypeDS RecordEditParamsDSRecordType = "DS" -) - -func (r RecordEditParamsDSRecordType) IsKnown() bool { - switch r { - case RecordEditParamsDSRecordTypeDS: - return true - } - return false -} - -type RecordEditParamsHTTPSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a HTTPS record. - Data param.Field[RecordEditParamsHTTPSRecordData] `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[RecordEditParamsHTTPSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsHTTPSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsHTTPSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsHTTPSRecord) ImplementsRecordEditParams() { - -} - -// Components of a HTTPS record. -type RecordEditParamsHTTPSRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordEditParamsHTTPSRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsHTTPSRecordType string - -const ( - RecordEditParamsHTTPSRecordTypeHTTPS RecordEditParamsHTTPSRecordType = "HTTPS" -) - -func (r RecordEditParamsHTTPSRecordType) IsKnown() bool { - switch r { - case RecordEditParamsHTTPSRecordTypeHTTPS: - return true - } - return false -} - -type RecordEditParamsLOCRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a LOC record. - Data param.Field[RecordEditParamsLOCRecordData] `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[RecordEditParamsLOCRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsLOCRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsLOCRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsLOCRecord) ImplementsRecordEditParams() { - -} - -// Components of a LOC record. -type RecordEditParamsLOCRecordData 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[RecordEditParamsLOCRecordDataLatDirection] `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[RecordEditParamsLOCRecordDataLongDirection] `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 RecordEditParamsLOCRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Latitude direction. -type RecordEditParamsLOCRecordDataLatDirection string - -const ( - RecordEditParamsLOCRecordDataLatDirectionN RecordEditParamsLOCRecordDataLatDirection = "N" - RecordEditParamsLOCRecordDataLatDirectionS RecordEditParamsLOCRecordDataLatDirection = "S" -) - -func (r RecordEditParamsLOCRecordDataLatDirection) IsKnown() bool { - switch r { - case RecordEditParamsLOCRecordDataLatDirectionN, RecordEditParamsLOCRecordDataLatDirectionS: - return true - } - return false -} - -// Longitude direction. -type RecordEditParamsLOCRecordDataLongDirection string - -const ( - RecordEditParamsLOCRecordDataLongDirectionE RecordEditParamsLOCRecordDataLongDirection = "E" - RecordEditParamsLOCRecordDataLongDirectionW RecordEditParamsLOCRecordDataLongDirection = "W" -) - -func (r RecordEditParamsLOCRecordDataLongDirection) IsKnown() bool { - switch r { - case RecordEditParamsLOCRecordDataLongDirectionE, RecordEditParamsLOCRecordDataLongDirectionW: - return true - } - return false -} - -// Record type. -type RecordEditParamsLOCRecordType string - -const ( - RecordEditParamsLOCRecordTypeLOC RecordEditParamsLOCRecordType = "LOC" -) - -func (r RecordEditParamsLOCRecordType) IsKnown() bool { - switch r { - case RecordEditParamsLOCRecordTypeLOC: - return true - } - return false -} - -type RecordEditParamsMXRecord 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[RecordEditParamsMXRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsMXRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsMXRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsMXRecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsMXRecordType string - -const ( - RecordEditParamsMXRecordTypeMX RecordEditParamsMXRecordType = "MX" -) - -func (r RecordEditParamsMXRecordType) IsKnown() bool { - switch r { - case RecordEditParamsMXRecordTypeMX: - return true - } - return false -} - -type RecordEditParamsNAPTRRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a NAPTR record. - Data param.Field[RecordEditParamsNAPTRRecordData] `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[RecordEditParamsNAPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsNAPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsNAPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsNAPTRRecord) ImplementsRecordEditParams() { - -} - -// Components of a NAPTR record. -type RecordEditParamsNAPTRRecordData 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 RecordEditParamsNAPTRRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsNAPTRRecordType string - -const ( - RecordEditParamsNAPTRRecordTypeNAPTR RecordEditParamsNAPTRRecordType = "NAPTR" -) - -func (r RecordEditParamsNAPTRRecordType) IsKnown() bool { - switch r { - case RecordEditParamsNAPTRRecordTypeNAPTR: - return true - } - return false -} - -type RecordEditParamsNSRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A valid name server host name. - 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[RecordEditParamsNSRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsNSRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsNSRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsNSRecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsNSRecordType string - -const ( - RecordEditParamsNSRecordTypeNS RecordEditParamsNSRecordType = "NS" -) - -func (r RecordEditParamsNSRecordType) IsKnown() bool { - switch r { - case RecordEditParamsNSRecordTypeNS: - return true - } - return false -} - -type RecordEditParamsPTRRecord 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[RecordEditParamsPTRRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsPTRRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsPTRRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsPTRRecord) ImplementsRecordEditParams() { - -} - -// Record type. -type RecordEditParamsPTRRecordType string - -const ( - RecordEditParamsPTRRecordTypePTR RecordEditParamsPTRRecordType = "PTR" -) - -func (r RecordEditParamsPTRRecordType) IsKnown() bool { - switch r { - case RecordEditParamsPTRRecordTypePTR: - return true - } - return false -} - -type RecordEditParamsSMIMEARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SMIMEA record. - Data param.Field[RecordEditParamsSMIMEARecordData] `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[RecordEditParamsSMIMEARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsSMIMEARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsSMIMEARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsSMIMEARecord) ImplementsRecordEditParams() { - -} - -// Components of a SMIMEA record. -type RecordEditParamsSMIMEARecordData 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 RecordEditParamsSMIMEARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsSMIMEARecordType string - -const ( - RecordEditParamsSMIMEARecordTypeSMIMEA RecordEditParamsSMIMEARecordType = "SMIMEA" -) - -func (r RecordEditParamsSMIMEARecordType) IsKnown() bool { - switch r { - case RecordEditParamsSMIMEARecordTypeSMIMEA: - return true - } - return false -} - -type RecordEditParamsSRVRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SRV record. - Data param.Field[RecordEditParamsSRVRecordData] `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[RecordEditParamsSRVRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsSRVRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsSRVRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsSRVRecord) ImplementsRecordEditParams() { - -} - -// Components of a SRV record. -type RecordEditParamsSRVRecordData 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 RecordEditParamsSRVRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsSRVRecordType string - -const ( - RecordEditParamsSRVRecordTypeSRV RecordEditParamsSRVRecordType = "SRV" -) - -func (r RecordEditParamsSRVRecordType) IsKnown() bool { - switch r { - case RecordEditParamsSRVRecordTypeSRV: - return true - } - return false -} - -type RecordEditParamsSSHFPRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SSHFP record. - Data param.Field[RecordEditParamsSSHFPRecordData] `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[RecordEditParamsSSHFPRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsSSHFPRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsSSHFPRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsSSHFPRecord) ImplementsRecordEditParams() { - -} - -// Components of a SSHFP record. -type RecordEditParamsSSHFPRecordData struct { - // algorithm. - Algorithm param.Field[float64] `json:"algorithm"` - // fingerprint. - Fingerprint param.Field[string] `json:"fingerprint"` - // type. - Type param.Field[float64] `json:"type"` +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 RecordEditParamsSSHFPRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// URLQuery serializes [RecordListParamsComment]'s query parameters as +// `url.Values`. +func (r RecordListParamsComment) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) } -// Record type. -type RecordEditParamsSSHFPRecordType string +// Direction to order DNS records in. +type RecordListParamsDirection string const ( - RecordEditParamsSSHFPRecordTypeSSHFP RecordEditParamsSSHFPRecordType = "SSHFP" + RecordListParamsDirectionAsc RecordListParamsDirection = "asc" + RecordListParamsDirectionDesc RecordListParamsDirection = "desc" ) -func (r RecordEditParamsSSHFPRecordType) IsKnown() bool { +func (r RecordListParamsDirection) IsKnown() bool { switch r { - case RecordEditParamsSSHFPRecordTypeSSHFP: + case RecordListParamsDirectionAsc, RecordListParamsDirectionDesc: return true } return false } -type RecordEditParamsSVCBRecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a SVCB record. - Data param.Field[RecordEditParamsSVCBRecordData] `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[RecordEditParamsSVCBRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsSVCBRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsSVCBRecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsSVCBRecord) ImplementsRecordEditParams() { - -} - -// Components of a SVCB record. -type RecordEditParamsSVCBRecordData struct { - // priority. - Priority param.Field[float64] `json:"priority"` - // target. - Target param.Field[string] `json:"target"` - // value. - Value param.Field[string] `json:"value"` -} - -func (r RecordEditParamsSVCBRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsSVCBRecordType string +// 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 ( - RecordEditParamsSVCBRecordTypeSVCB RecordEditParamsSVCBRecordType = "SVCB" + RecordListParamsMatchAny RecordListParamsMatch = "any" + RecordListParamsMatchAll RecordListParamsMatch = "all" ) -func (r RecordEditParamsSVCBRecordType) IsKnown() bool { +func (r RecordListParamsMatch) IsKnown() bool { switch r { - case RecordEditParamsSVCBRecordTypeSVCB: + case RecordListParamsMatchAny, RecordListParamsMatchAll: return true } return false } -type RecordEditParamsTLSARecord struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a TLSA record. - Data param.Field[RecordEditParamsTLSARecordData] `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[RecordEditParamsTLSARecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` -} - -func (r RecordEditParamsTLSARecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RecordEditParamsTLSARecord) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RecordEditParamsTLSARecord) ImplementsRecordEditParams() { - -} - -// Components of a TLSA record. -type RecordEditParamsTLSARecordData 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 RecordEditParamsTLSARecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Record type. -type RecordEditParamsTLSARecordType string +// Field to order DNS records by. +type RecordListParamsOrder string const ( - RecordEditParamsTLSARecordTypeTLSA RecordEditParamsTLSARecordType = "TLSA" + RecordListParamsOrderType RecordListParamsOrder = "type" + RecordListParamsOrderName RecordListParamsOrder = "name" + RecordListParamsOrderContent RecordListParamsOrder = "content" + RecordListParamsOrderTTL RecordListParamsOrder = "ttl" + RecordListParamsOrderProxied RecordListParamsOrder = "proxied" ) -func (r RecordEditParamsTLSARecordType) IsKnown() bool { +func (r RecordListParamsOrder) IsKnown() bool { switch r { - case RecordEditParamsTLSARecordTypeTLSA: + case RecordListParamsOrderType, RecordListParamsOrderName, RecordListParamsOrderContent, RecordListParamsOrderTTL, RecordListParamsOrderProxied: return true } return false } -type RecordEditParamsTXTRecord 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[RecordEditParamsTXTRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` +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"` } -func (r RecordEditParamsTXTRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// URLQuery serializes [RecordListParamsTag]'s query parameters as `url.Values`. +func (r RecordListParamsTag) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) } -func (r RecordEditParamsTXTRecord) getZoneID() param.Field[string] { - return r.ZoneID -} +// 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 (RecordEditParamsTXTRecord) ImplementsRecordEditParams() { +const ( + RecordListParamsTagMatchAny RecordListParamsTagMatch = "any" + RecordListParamsTagMatchAll RecordListParamsTagMatch = "all" +) +func (r RecordListParamsTagMatch) IsKnown() bool { + switch r { + case RecordListParamsTagMatchAny, RecordListParamsTagMatchAll: + return true + } + return false } // Record type. -type RecordEditParamsTXTRecordType string +type RecordListParamsType string const ( - RecordEditParamsTXTRecordTypeTXT RecordEditParamsTXTRecordType = "TXT" + 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 RecordEditParamsTXTRecordType) IsKnown() bool { +func (r RecordListParamsType) IsKnown() bool { switch r { - case RecordEditParamsTXTRecordTypeTXT: + 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 RecordEditParamsURIRecord struct { +type RecordDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // Components of a URI record. - Data param.Field[RecordEditParamsURIRecordData] `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[RecordEditParamsURIRecordType] `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[[]RecordTagsParam] `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[TTLUnionParam] `json:"ttl"` + Body interface{} `json:"body,required"` } -func (r RecordEditParamsURIRecord) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r RecordDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) } -func (r RecordEditParamsURIRecord) getZoneID() param.Field[string] { - return r.ZoneID +type RecordDeleteResponseEnvelope struct { + Result RecordDeleteResponse `json:"result"` + JSON recordDeleteResponseEnvelopeJSON `json:"-"` } -func (RecordEditParamsURIRecord) ImplementsRecordEditParams() { - +// recordDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [RecordDeleteResponseEnvelope] +type recordDeleteResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// Components of a URI record. -type RecordEditParamsURIRecordData struct { - // The record content. - Content param.Field[string] `json:"content"` - // The record weight. - Weight param.Field[float64] `json:"weight"` +func (r *RecordDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RecordEditParamsURIRecordData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r recordDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// Record type. -type RecordEditParamsURIRecordType string - -const ( - RecordEditParamsURIRecordTypeURI RecordEditParamsURIRecordType = "URI" -) +type RecordEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Record RecordUnionParam `json:"record,required"` +} -func (r RecordEditParamsURIRecordType) IsKnown() bool { - switch r { - case RecordEditParamsURIRecordTypeURI: - return true - } - return false +func (r RecordEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Record) } type RecordEditResponseEnvelope struct { @@ -6902,9 +4005,9 @@ type RecordImportResponseEnvelope struct { Messages []shared.ResponseInfo `json:"messages,required"` Result RecordImportResponse `json:"result,required"` // Whether the API call was successful - Success RecordImportResponseEnvelopeSuccess `json:"success,required"` - Timing UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd `json:"timing"` - JSON recordImportResponseEnvelopeJSON `json:"-"` + Success RecordImportResponseEnvelopeSuccess `json:"success,required"` + Timing RecordProcessTiming `json:"timing"` + JSON recordImportResponseEnvelopeJSON `json:"-"` } // recordImportResponseEnvelopeJSON contains the JSON metadata for the struct @@ -6944,8 +4047,8 @@ func (r RecordImportResponseEnvelopeSuccess) IsKnown() bool { type RecordScanParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r RecordScanParams) MarshalJSON() (data []byte, err error) { @@ -6957,9 +4060,9 @@ type RecordScanResponseEnvelope struct { Messages []shared.ResponseInfo `json:"messages,required"` Result RecordScanResponse `json:"result,required"` // Whether the API call was successful - Success RecordScanResponseEnvelopeSuccess `json:"success,required"` - Timing UnnamedSchemaRef2f895e023ae55b55d2f5925449b819cd `json:"timing"` - JSON recordScanResponseEnvelopeJSON `json:"-"` + Success RecordScanResponseEnvelopeSuccess `json:"success,required"` + Timing RecordProcessTiming `json:"timing"` + JSON recordScanResponseEnvelopeJSON `json:"-"` } // recordScanResponseEnvelopeJSON contains the JSON metadata for the struct diff --git a/dns/record_test.go b/dns/record_test.go index 3707bff7940..267e28141f4 100644 --- a/dns/record_test.go +++ b/dns/record_test.go @@ -29,15 +29,17 @@ func TestRecordNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParamsARecord{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Content: cloudflare.F("198.51.100.4"), - Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordNewParamsARecordTypeA), - Comment: cloudflare.F("Domain verification record"), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + _, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Record: dns.ARecordParam{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Proxied: cloudflare.F(false), + Type: cloudflare.F(dns.ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + }, }) if err != nil { var apierr *cloudflare.Error @@ -65,15 +67,17 @@ func TestRecordUpdateWithOptionalParams(t *testing.T) { _, err := client.DNS.Records.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - dns.RecordUpdateParamsARecord{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Content: cloudflare.F("198.51.100.4"), - Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordUpdateParamsARecordTypeA), - Comment: cloudflare.F("Domain verification record"), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + dns.RecordUpdateParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Record: dns.ARecordParam{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Proxied: cloudflare.F(false), + Type: cloudflare.F(dns.ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + }, }, ) if err != nil { @@ -157,7 +161,7 @@ func TestRecordDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", dns.RecordDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -186,15 +190,17 @@ func TestRecordEditWithOptionalParams(t *testing.T) { _, err := client.DNS.Records.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - dns.RecordEditParamsARecord{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Content: cloudflare.F("198.51.100.4"), - Name: cloudflare.F("example.com"), - Type: cloudflare.F(dns.RecordEditParamsARecordTypeA), - Comment: cloudflare.F("Domain verification record"), - Proxied: cloudflare.F(false), - Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), - TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + dns.RecordEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Record: dns.ARecordParam{ + Content: cloudflare.F("198.51.100.4"), + Name: cloudflare.F("example.com"), + Proxied: cloudflare.F(false), + Type: cloudflare.F(dns.ARecordTypeA), + Comment: cloudflare.F("Domain verification record"), + Tags: cloudflare.F([]dns.RecordTagsParam{"owner:dns-team", "owner:dns-team", "owner:dns-team"}), + TTL: cloudflare.F[dns.TTLUnionParam](shared.UnionFloat(3600.000000)), + }, }, ) if err != nil { @@ -306,7 +312,7 @@ func TestRecordScan(t *testing.T) { ) _, err := client.DNS.Records.Scan(context.TODO(), dns.RecordScanParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/dnssec/aliases.go b/dnssec/aliases.go index 0321a226e32..1a7e15d5698 100644 --- a/dnssec/aliases.go +++ b/dnssec/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/dnssec/dnssec.go b/dnssec/dnssec.go index 3220efda3a1..0cbbb31b673 100644 --- a/dnssec/dnssec.go +++ b/dnssec/dnssec.go @@ -180,8 +180,8 @@ func init() { type DNSSECDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r DNSSECDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/dnssec/dnssec_test.go b/dnssec/dnssec_test.go index 2bc46f92997..2e87d475d14 100644 --- a/dnssec/dnssec_test.go +++ b/dnssec/dnssec_test.go @@ -30,7 +30,7 @@ func TestDNSSECDelete(t *testing.T) { ) _, err := client.DNSSEC.Delete(context.TODO(), dnssec.DNSSECDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/durable_objects/aliases.go b/durable_objects/aliases.go index 29b2c8c7d38..446c78110af 100644 --- a/durable_objects/aliases.go +++ b/durable_objects/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/email_routing/aliases.go b/email_routing/aliases.go index 01ef7532ee3..cfc4080568d 100644 --- a/email_routing/aliases.go +++ b/email_routing/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/email_routing/emailrouting.go b/email_routing/emailrouting.go index d304b2d26b2..35bded23be9 100644 --- a/email_routing/emailrouting.go +++ b/email_routing/emailrouting.go @@ -9,7 +9,6 @@ import ( "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" @@ -174,7 +173,7 @@ func (r SettingsStatus) IsKnown() bool { } type EmailRoutingDisableParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r EmailRoutingDisableParams) MarshalJSON() (data []byte, err error) { @@ -225,7 +224,7 @@ func (r EmailRoutingDisableResponseEnvelopeSuccess) IsKnown() bool { } type EmailRoutingEnableParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r EmailRoutingEnableParams) MarshalJSON() (data []byte, err error) { diff --git a/email_routing/emailrouting_test.go b/email_routing/emailrouting_test.go index 833ab873fca..6bcafdd26b9 100644 --- a/email_routing/emailrouting_test.go +++ b/email_routing/emailrouting_test.go @@ -32,7 +32,7 @@ func TestEmailRoutingDisable(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", email_routing.EmailRoutingDisableParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -62,7 +62,7 @@ func TestEmailRoutingEnable(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", email_routing.EmailRoutingEnableParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/filters/aliases.go b/filters/aliases.go index cf320eb34b0..db41f932ed4 100644 --- a/filters/aliases.go +++ b/filters/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/filters/filter.go b/filters/filter.go index 4133fd4052b..8ed53f1a813 100644 --- a/filters/filter.go +++ b/filters/filter.go @@ -148,7 +148,7 @@ func (r firewallFilterJSON) RawJSON() string { func (r FirewallFilter) implementsFirewallFirewallRuleFilter() {} type FilterNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r FilterNewParams) MarshalJSON() (data []byte, err error) { @@ -232,7 +232,7 @@ func (r filterNewResponseEnvelopeResultInfoJSON) RawJSON() string { } type FilterUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r FilterUpdateParams) MarshalJSON() (data []byte, err error) { @@ -308,7 +308,7 @@ func (r FilterListParams) URLQuery() (v url.Values) { } type FilterDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r FilterDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/filters/filter_test.go b/filters/filter_test.go index c27fb6ed1d6..f39799c8455 100644 --- a/filters/filter_test.go +++ b/filters/filter_test.go @@ -32,7 +32,7 @@ func TestFilterNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", filters.FilterNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -63,7 +63,7 @@ func TestFilterUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b61", filters.FilterUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -130,7 +130,7 @@ func TestFilterDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b61", filters.FilterDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/firewall/accessrule.go b/firewall/accessrule.go index 311aa597509..6a4cd47f388 100644 --- a/firewall/accessrule.go +++ b/firewall/accessrule.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // AccessRuleService contains methods and other services that help with interacting @@ -39,7 +41,7 @@ func NewAccessRuleService(opts ...option.RequestOption) (r *AccessRuleService) { // // Note: To create an IP Access rule that applies to a single zone, refer to the // [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. -func (r *AccessRuleService) New(ctx context.Context, params AccessRuleNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccessRuleService) New(ctx context.Context, params AccessRuleNewParams, opts ...option.RequestOption) (res *AccessRuleNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccessRuleNewResponseEnvelope var accountOrZone string @@ -123,7 +125,7 @@ func (r *AccessRuleService) Delete(ctx context.Context, identifier interface{}, // Updates an IP Access rule defined. // // Note: This operation will affect all zones in the account or zone. -func (r *AccessRuleService) Edit(ctx context.Context, identifier interface{}, params AccessRuleEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccessRuleService) Edit(ctx context.Context, identifier interface{}, params AccessRuleEditParams, opts ...option.RequestOption) (res *AccessRuleEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccessRuleEditResponseEnvelope var accountOrZone string @@ -145,7 +147,7 @@ func (r *AccessRuleService) Edit(ctx context.Context, identifier interface{}, pa } // Fetches the details of an IP Access rule defined. -func (r *AccessRuleService) Get(ctx context.Context, identifier interface{}, query AccessRuleGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccessRuleService) Get(ctx context.Context, identifier interface{}, query AccessRuleGetParams, opts ...option.RequestOption) (res *AccessRuleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccessRuleGetResponseEnvelope var accountOrZone string @@ -330,6 +332,23 @@ func (r IPV6ConfigurationTarget) IsKnown() bool { return false } +// Union satisfied by [firewall.AccessRuleNewResponseUnknown] or +// [shared.UnionString]. +type AccessRuleNewResponseUnion interface { + ImplementsFirewallAccessRuleNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccessRuleNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AccessRuleListResponse = interface{} type AccessRuleDeleteResponse struct { @@ -354,6 +373,40 @@ func (r accessRuleDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [firewall.AccessRuleEditResponseUnknown] or +// [shared.UnionString]. +type AccessRuleEditResponseUnion interface { + ImplementsFirewallAccessRuleEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccessRuleEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [firewall.AccessRuleGetResponseUnknown] or +// [shared.UnionString]. +type AccessRuleGetResponseUnion interface { + ImplementsFirewallAccessRuleGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccessRuleGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AccessRuleNewParams struct { // The rule configuration. Configuration param.Field[AccessRuleNewParamsConfigurationUnion] `json:"configuration,required"` @@ -437,9 +490,9 @@ func (r AccessRuleNewParamsMode) IsKnown() bool { } type AccessRuleNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccessRuleNewResponseUnion `json:"result,required"` // Whether the API call was successful Success AccessRuleNewResponseEnvelopeSuccess `json:"success,required"` JSON accessRuleNewResponseEnvelopeJSON `json:"-"` @@ -650,7 +703,7 @@ func (r AccessRuleListParamsOrder) IsKnown() bool { } type AccessRuleDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,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. @@ -788,9 +841,9 @@ func (r AccessRuleEditParamsMode) IsKnown() bool { } type AccessRuleEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccessRuleEditResponseUnion `json:"result,required"` // Whether the API call was successful Success AccessRuleEditResponseEnvelopeSuccess `json:"success,required"` JSON accessRuleEditResponseEnvelopeJSON `json:"-"` @@ -838,9 +891,9 @@ type AccessRuleGetParams struct { } type AccessRuleGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccessRuleGetResponseUnion `json:"result,required"` // Whether the API call was successful Success AccessRuleGetResponseEnvelopeSuccess `json:"success,required"` JSON accessRuleGetResponseEnvelopeJSON `json:"-"` diff --git a/firewall/accessrule_test.go b/firewall/accessrule_test.go index 388ba0cabdf..102a172c4c0 100644 --- a/firewall/accessrule_test.go +++ b/firewall/accessrule_test.go @@ -109,7 +109,7 @@ func TestAccessRuleDeleteWithOptionalParams(t *testing.T) { context.TODO(), map[string]interface{}{}, firewall.AccessRuleDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), }, diff --git a/firewall/aliases.go b/firewall/aliases.go index 47a3c6fb0ea..bb286f1a07b 100644 --- a/firewall/aliases.go +++ b/firewall/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/firewall/lockdown.go b/firewall/lockdown.go index c2355342350..4d509127efa 100644 --- a/firewall/lockdown.go +++ b/firewall/lockdown.go @@ -379,7 +379,7 @@ func (r lockdownDeleteResponseJSON) RawJSON() string { } type LockdownNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r LockdownNewParams) MarshalJSON() (data []byte, err error) { @@ -430,7 +430,7 @@ func (r LockdownNewResponseEnvelopeSuccess) IsKnown() bool { } type LockdownUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r LockdownUpdateParams) MarshalJSON() (data []byte, err error) { @@ -517,7 +517,7 @@ func (r LockdownListParams) URLQuery() (v url.Values) { } type LockdownDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r LockdownDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/firewall/lockdown_test.go b/firewall/lockdown_test.go index a9b6739e81c..37c38596048 100644 --- a/firewall/lockdown_test.go +++ b/firewall/lockdown_test.go @@ -33,7 +33,7 @@ func TestLockdownNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", firewall.LockdownNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -64,7 +64,7 @@ func TestLockdownUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", firewall.LockdownUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -135,7 +135,7 @@ func TestLockdownDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", firewall.LockdownDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/firewall/rule.go b/firewall/rule.go index 7817da5fe49..5e9e1cd9eac 100644 --- a/firewall/rule.go +++ b/firewall/rule.go @@ -286,7 +286,7 @@ func (r deletedFilterJSON) RawJSON() string { func (r DeletedFilter) implementsFirewallFirewallRuleFilter() {} type RuleNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RuleNewParams) MarshalJSON() (data []byte, err error) { @@ -370,7 +370,7 @@ func (r ruleNewResponseEnvelopeResultInfoJSON) RawJSON() string { } type RuleUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RuleUpdateParams) MarshalJSON() (data []byte, err error) { @@ -497,7 +497,7 @@ func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { } type RuleEditParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RuleEditParams) MarshalJSON() (data []byte, err error) { diff --git a/firewall/rule_test.go b/firewall/rule_test.go index e5ce680265e..2d99b0534db 100644 --- a/firewall/rule_test.go +++ b/firewall/rule_test.go @@ -32,7 +32,7 @@ func TestRuleNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", firewall.RuleNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -63,7 +63,7 @@ func TestRuleUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", firewall.RuleUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -160,7 +160,7 @@ func TestRuleEdit(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", firewall.RuleEditParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/firewall/uarule.go b/firewall/uarule.go index 188dbec79f6..d8eb53c966e 100644 --- a/firewall/uarule.go +++ b/firewall/uarule.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // UARuleService contains methods and other services that help with interacting @@ -35,7 +37,7 @@ func NewUARuleService(opts ...option.RequestOption) (r *UARuleService) { } // Creates a new User Agent Blocking rule in a zone. -func (r *UARuleService) New(ctx context.Context, zoneIdentifier string, body UARuleNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *UARuleService) New(ctx context.Context, zoneIdentifier string, body UARuleNewParams, opts ...option.RequestOption) (res *UARuleNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env UARuleNewResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/ua_rules", zoneIdentifier) @@ -48,7 +50,7 @@ func (r *UARuleService) New(ctx context.Context, zoneIdentifier string, body UAR } // Updates an existing User Agent Blocking rule. -func (r *UARuleService) Update(ctx context.Context, zoneIdentifier string, id string, body UARuleUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *UARuleService) Update(ctx context.Context, zoneIdentifier string, id string, body UARuleUpdateParams, opts ...option.RequestOption) (res *UARuleUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env UARuleUpdateResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) @@ -99,7 +101,7 @@ func (r *UARuleService) Delete(ctx context.Context, zoneIdentifier string, id st } // Fetches the details of a User Agent Blocking rule. -func (r *UARuleService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *UARuleService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *UARuleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env UARuleGetResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) @@ -111,6 +113,39 @@ func (r *UARuleService) Get(ctx context.Context, zoneIdentifier string, id strin return } +// Union satisfied by [firewall.UARuleNewResponseUnknown] or [shared.UnionString]. +type UARuleNewResponseUnion interface { + ImplementsFirewallUARuleNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*UARuleNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [firewall.UARuleUpdateResponseUnknown] or +// [shared.UnionString]. +type UARuleUpdateResponseUnion interface { + ImplementsFirewallUARuleUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*UARuleUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type UARuleListResponse struct { // The unique identifier of the User Agent Blocking rule. ID string `json:"id"` @@ -213,8 +248,24 @@ func (r uaRuleDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [firewall.UARuleGetResponseUnknown] or [shared.UnionString]. +type UARuleGetResponseUnion interface { + ImplementsFirewallUARuleGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*UARuleGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type UARuleNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r UARuleNewParams) MarshalJSON() (data []byte, err error) { @@ -222,9 +273,9 @@ func (r UARuleNewParams) MarshalJSON() (data []byte, err error) { } type UARuleNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result UARuleNewResponseUnion `json:"result,required"` // Whether the API call was successful Success UARuleNewResponseEnvelopeSuccess `json:"success,required"` JSON uaRuleNewResponseEnvelopeJSON `json:"-"` @@ -265,7 +316,7 @@ func (r UARuleNewResponseEnvelopeSuccess) IsKnown() bool { } type UARuleUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r UARuleUpdateParams) MarshalJSON() (data []byte, err error) { @@ -273,9 +324,9 @@ func (r UARuleUpdateParams) MarshalJSON() (data []byte, err error) { } type UARuleUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result UARuleUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success UARuleUpdateResponseEnvelopeSuccess `json:"success,required"` JSON uaRuleUpdateResponseEnvelopeJSON `json:"-"` @@ -338,7 +389,7 @@ func (r UARuleListParams) URLQuery() (v url.Values) { } type UARuleDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r UARuleDeleteParams) MarshalJSON() (data []byte, err error) { @@ -389,9 +440,9 @@ func (r UARuleDeleteResponseEnvelopeSuccess) IsKnown() bool { } type UARuleGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result UARuleGetResponseUnion `json:"result,required"` // Whether the API call was successful Success UARuleGetResponseEnvelopeSuccess `json:"success,required"` JSON uaRuleGetResponseEnvelopeJSON `json:"-"` diff --git a/firewall/uarule_test.go b/firewall/uarule_test.go index b0ebb7af476..909e141d2fc 100644 --- a/firewall/uarule_test.go +++ b/firewall/uarule_test.go @@ -32,7 +32,7 @@ func TestUARuleNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", firewall.UARuleNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -63,7 +63,7 @@ func TestUARuleUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", firewall.UARuleUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -128,7 +128,7 @@ func TestUARuleDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", firewall.UARuleDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/firewall/wafoverride.go b/firewall/wafoverride.go index d66a169dba9..d3afc09ecd2 100644 --- a/firewall/wafoverride.go +++ b/firewall/wafoverride.go @@ -299,7 +299,7 @@ func (r wafOverrideDeleteResponseJSON) RawJSON() string { } type WAFOverrideNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r WAFOverrideNewParams) MarshalJSON() (data []byte, err error) { @@ -350,7 +350,7 @@ func (r WAFOverrideNewResponseEnvelopeSuccess) IsKnown() bool { } type WAFOverrideUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r WAFOverrideUpdateParams) MarshalJSON() (data []byte, err error) { @@ -416,7 +416,7 @@ func (r WAFOverrideListParams) URLQuery() (v url.Values) { } type WAFOverrideDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r WAFOverrideDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/firewall/wafoverride_test.go b/firewall/wafoverride_test.go index 8587d0ee6b3..1a187260cdf 100644 --- a/firewall/wafoverride_test.go +++ b/firewall/wafoverride_test.go @@ -32,7 +32,7 @@ func TestWAFOverrideNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", firewall.WAFOverrideNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -63,7 +63,7 @@ func TestWAFOverrideUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", firewall.WAFOverrideUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -125,7 +125,7 @@ func TestWAFOverrideDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", firewall.WAFOverrideDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/firewall/wafpackagegroup.go b/firewall/wafpackagegroup.go index 10f180d2665..13c542f25fd 100644 --- a/firewall/wafpackagegroup.go +++ b/firewall/wafpackagegroup.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // WAFPackageGroupService contains methods and other services that help with @@ -69,7 +71,7 @@ func (r *WAFPackageGroupService) ListAutoPaging(ctx context.Context, packageID s // // **Note:** Applies only to the // [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). -func (r *WAFPackageGroupService) Edit(ctx context.Context, packageID string, groupID string, params WAFPackageGroupEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WAFPackageGroupService) Edit(ctx context.Context, packageID string, groupID string, params WAFPackageGroupEditParams, opts ...option.RequestOption) (res *WAFPackageGroupEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WAFPackageGroupEditResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/groups/%s", params.ZoneID, packageID, groupID) @@ -85,7 +87,7 @@ func (r *WAFPackageGroupService) Edit(ctx context.Context, packageID string, gro // // **Note:** Applies only to the // [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). -func (r *WAFPackageGroupService) Get(ctx context.Context, packageID string, groupID string, query WAFPackageGroupGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WAFPackageGroupService) Get(ctx context.Context, packageID string, groupID string, query WAFPackageGroupGetParams, opts ...option.RequestOption) (res *WAFPackageGroupGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WAFPackageGroupGetResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/groups/%s", query.ZoneID, packageID, groupID) @@ -175,6 +177,40 @@ func (r GroupAllowedMode) IsKnown() bool { return false } +// Union satisfied by [firewall.WAFPackageGroupEditResponseUnknown] or +// [shared.UnionString]. +type WAFPackageGroupEditResponseUnion interface { + ImplementsFirewallWAFPackageGroupEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WAFPackageGroupEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [firewall.WAFPackageGroupGetResponseUnknown] or +// [shared.UnionString]. +type WAFPackageGroupGetResponseUnion interface { + ImplementsFirewallWAFPackageGroupGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WAFPackageGroupGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type WAFPackageGroupListParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -303,9 +339,9 @@ func (r WAFPackageGroupEditParamsMode) IsKnown() bool { } type WAFPackageGroupEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WAFPackageGroupEditResponseUnion `json:"result,required"` // Whether the API call was successful Success WAFPackageGroupEditResponseEnvelopeSuccess `json:"success,required"` JSON wafPackageGroupEditResponseEnvelopeJSON `json:"-"` @@ -351,9 +387,9 @@ type WAFPackageGroupGetParams struct { } type WAFPackageGroupGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WAFPackageGroupGetResponseUnion `json:"result,required"` // Whether the API call was successful Success WAFPackageGroupGetResponseEnvelopeSuccess `json:"success,required"` JSON wafPackageGroupGetResponseEnvelopeJSON `json:"-"` diff --git a/firewall/wafpackagerule.go b/firewall/wafpackagerule.go index e0aae5753c0..5c84fb624d2 100644 --- a/firewall/wafpackagerule.go +++ b/firewall/wafpackagerule.go @@ -86,7 +86,7 @@ func (r *WAFPackageRuleService) Edit(ctx context.Context, packageID string, rule // // **Note:** Applies only to the // [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). -func (r *WAFPackageRuleService) Get(ctx context.Context, packageID string, ruleID string, query WAFPackageRuleGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WAFPackageRuleService) Get(ctx context.Context, packageID string, ruleID string, query WAFPackageRuleGetParams, opts ...option.RequestOption) (res *WAFPackageRuleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WAFPackageRuleGetResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules/%s", query.ZoneID, packageID, ruleID) @@ -879,6 +879,23 @@ func (r WAFPackageRuleEditResponseMode) IsKnown() bool { return false } +// Union satisfied by [firewall.WAFPackageRuleGetResponseUnknown] or +// [shared.UnionString]. +type WAFPackageRuleGetResponseUnion interface { + ImplementsFirewallWAFPackageRuleGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WAFPackageRuleGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type WAFPackageRuleListParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -1067,9 +1084,9 @@ type WAFPackageRuleGetParams struct { } type WAFPackageRuleGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WAFPackageRuleGetResponseUnion `json:"result,required"` // Whether the API call was successful Success WAFPackageRuleGetResponseEnvelopeSuccess `json:"success,required"` JSON wafPackageRuleGetResponseEnvelopeJSON `json:"-"` diff --git a/healthchecks/aliases.go b/healthchecks/aliases.go index bce28067867..7d17f47d897 100644 --- a/healthchecks/aliases.go +++ b/healthchecks/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/healthchecks/healthcheck.go b/healthchecks/healthcheck.go index 80d629beca3..867246819cf 100644 --- a/healthchecks/healthcheck.go +++ b/healthchecks/healthcheck.go @@ -344,6 +344,47 @@ func (r HTTPConfigurationParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +type QueryHealthcheckParam struct { + // The hostname or IP address of the origin server to run health checks on. + Address param.Field[string] `json:"address,required"` + // A short name to identify the health check. Only alphanumeric characters, hyphens + // and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // A list of regions from which to run health checks. Null means Cloudflare will + // pick a default region. + CheckRegions param.Field[[]CheckRegion] `json:"check_regions"` + // The number of consecutive fails required from a health check before changing the + // health to unhealthy. + ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` + // The number of consecutive successes required from a health check before changing + // the health to healthy. + ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` + // A human-readable description of the health check. + Description param.Field[string] `json:"description"` + // Parameters specific to an HTTP or HTTPS health check. + HTTPConfig param.Field[HTTPConfigurationParam] `json:"http_config"` + // The interval between each health check. Shorter intervals may give quicker + // notifications if the origin status changes, but will increase load on the origin + // as we check from multiple locations. + Interval param.Field[int64] `json:"interval"` + // The number of retries to attempt in case of a timeout before marking the origin + // as unhealthy. Retries are attempted immediately. + Retries param.Field[int64] `json:"retries"` + // If suspended, no health checks are sent to the origin. + Suspended param.Field[bool] `json:"suspended"` + // Parameters specific to TCP health check. + TCPConfig param.Field[TCPConfigurationParam] `json:"tcp_config"` + // The timeout (in seconds) before marking the health check as failed. + Timeout param.Field[int64] `json:"timeout"` + // The protocol to use for the health check. Currently supported protocols are + // 'HTTP', 'HTTPS' and 'TCP'. + Type param.Field[string] `json:"type"` +} + +func (r QueryHealthcheckParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // Parameters specific to TCP health check. type TCPConfiguration struct { // The TCP connection method to use for the health check. @@ -421,45 +462,12 @@ func (r healthcheckDeleteResponseJSON) RawJSON() string { type HealthcheckNewParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The hostname or IP address of the origin server to run health checks on. - Address param.Field[string] `json:"address,required"` - // A short name to identify the health check. Only alphanumeric characters, hyphens - // and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // A list of regions from which to run health checks. Null means Cloudflare will - // pick a default region. - CheckRegions param.Field[[]CheckRegion] `json:"check_regions"` - // The number of consecutive fails required from a health check before changing the - // health to unhealthy. - ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` - // The number of consecutive successes required from a health check before changing - // the health to healthy. - ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` - // A human-readable description of the health check. - Description param.Field[string] `json:"description"` - // Parameters specific to an HTTP or HTTPS health check. - HTTPConfig param.Field[HTTPConfigurationParam] `json:"http_config"` - // The interval between each health check. Shorter intervals may give quicker - // notifications if the origin status changes, but will increase load on the origin - // as we check from multiple locations. - Interval param.Field[int64] `json:"interval"` - // The number of retries to attempt in case of a timeout before marking the origin - // as unhealthy. Retries are attempted immediately. - Retries param.Field[int64] `json:"retries"` - // If suspended, no health checks are sent to the origin. - Suspended param.Field[bool] `json:"suspended"` - // Parameters specific to TCP health check. - TCPConfig param.Field[TCPConfigurationParam] `json:"tcp_config"` - // The timeout (in seconds) before marking the health check as failed. - Timeout param.Field[int64] `json:"timeout"` - // The protocol to use for the health check. Currently supported protocols are - // 'HTTP', 'HTTPS' and 'TCP'. - Type param.Field[string] `json:"type"` + ZoneID param.Field[string] `path:"zone_id,required"` + QueryHealthcheck QueryHealthcheckParam `json:"query_healthcheck,required"` } func (r HealthcheckNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.QueryHealthcheck) } type HealthcheckNewResponseEnvelope struct { @@ -507,45 +515,12 @@ func (r HealthcheckNewResponseEnvelopeSuccess) IsKnown() bool { type HealthcheckUpdateParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The hostname or IP address of the origin server to run health checks on. - Address param.Field[string] `json:"address,required"` - // A short name to identify the health check. Only alphanumeric characters, hyphens - // and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // A list of regions from which to run health checks. Null means Cloudflare will - // pick a default region. - CheckRegions param.Field[[]CheckRegion] `json:"check_regions"` - // The number of consecutive fails required from a health check before changing the - // health to unhealthy. - ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` - // The number of consecutive successes required from a health check before changing - // the health to healthy. - ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` - // A human-readable description of the health check. - Description param.Field[string] `json:"description"` - // Parameters specific to an HTTP or HTTPS health check. - HTTPConfig param.Field[HTTPConfigurationParam] `json:"http_config"` - // The interval between each health check. Shorter intervals may give quicker - // notifications if the origin status changes, but will increase load on the origin - // as we check from multiple locations. - Interval param.Field[int64] `json:"interval"` - // The number of retries to attempt in case of a timeout before marking the origin - // as unhealthy. Retries are attempted immediately. - Retries param.Field[int64] `json:"retries"` - // If suspended, no health checks are sent to the origin. - Suspended param.Field[bool] `json:"suspended"` - // Parameters specific to TCP health check. - TCPConfig param.Field[TCPConfigurationParam] `json:"tcp_config"` - // The timeout (in seconds) before marking the health check as failed. - Timeout param.Field[int64] `json:"timeout"` - // The protocol to use for the health check. Currently supported protocols are - // 'HTTP', 'HTTPS' and 'TCP'. - Type param.Field[string] `json:"type"` + ZoneID param.Field[string] `path:"zone_id,required"` + QueryHealthcheck QueryHealthcheckParam `json:"query_healthcheck,required"` } func (r HealthcheckUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.QueryHealthcheck) } type HealthcheckUpdateResponseEnvelope struct { @@ -598,8 +573,8 @@ type HealthcheckListParams struct { type HealthcheckDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r HealthcheckDeleteParams) MarshalJSON() (data []byte, err error) { @@ -651,45 +626,12 @@ func (r HealthcheckDeleteResponseEnvelopeSuccess) IsKnown() bool { type HealthcheckEditParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The hostname or IP address of the origin server to run health checks on. - Address param.Field[string] `json:"address,required"` - // A short name to identify the health check. Only alphanumeric characters, hyphens - // and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // A list of regions from which to run health checks. Null means Cloudflare will - // pick a default region. - CheckRegions param.Field[[]CheckRegion] `json:"check_regions"` - // The number of consecutive fails required from a health check before changing the - // health to unhealthy. - ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` - // The number of consecutive successes required from a health check before changing - // the health to healthy. - ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` - // A human-readable description of the health check. - Description param.Field[string] `json:"description"` - // Parameters specific to an HTTP or HTTPS health check. - HTTPConfig param.Field[HTTPConfigurationParam] `json:"http_config"` - // The interval between each health check. Shorter intervals may give quicker - // notifications if the origin status changes, but will increase load on the origin - // as we check from multiple locations. - Interval param.Field[int64] `json:"interval"` - // The number of retries to attempt in case of a timeout before marking the origin - // as unhealthy. Retries are attempted immediately. - Retries param.Field[int64] `json:"retries"` - // If suspended, no health checks are sent to the origin. - Suspended param.Field[bool] `json:"suspended"` - // Parameters specific to TCP health check. - TCPConfig param.Field[TCPConfigurationParam] `json:"tcp_config"` - // The timeout (in seconds) before marking the health check as failed. - Timeout param.Field[int64] `json:"timeout"` - // The protocol to use for the health check. Currently supported protocols are - // 'HTTP', 'HTTPS' and 'TCP'. - Type param.Field[string] `json:"type"` + ZoneID param.Field[string] `path:"zone_id,required"` + QueryHealthcheck QueryHealthcheckParam `json:"query_healthcheck,required"` } func (r HealthcheckEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.QueryHealthcheck) } type HealthcheckEditResponseEnvelope struct { diff --git a/healthchecks/healthcheck_test.go b/healthchecks/healthcheck_test.go index 33dc1897c83..c74edc22035 100644 --- a/healthchecks/healthcheck_test.go +++ b/healthchecks/healthcheck_test.go @@ -29,70 +29,9 @@ func TestHealthcheckNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Healthchecks.New(context.TODO(), healthchecks.HealthcheckNewParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Address: cloudflare.F("www.example.com"), - Name: cloudflare.F("server-1"), - CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), - ConsecutiveFails: cloudflare.F(int64(0)), - ConsecutiveSuccesses: cloudflare.F(int64(0)), - Description: cloudflare.F("Health check for www.example.com"), - HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ - AllowInsecure: cloudflare.F(true), - ExpectedBody: cloudflare.F("success"), - ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), - FollowRedirects: cloudflare.F(true), - Header: cloudflare.F[any](map[string]interface{}{ - "Host": map[string]interface{}{ - "0": "example.com", - }, - "X-App-ID": map[string]interface{}{ - "0": "abc123", - }, - }), - Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), - Path: cloudflare.F("/health"), - Port: cloudflare.F(int64(0)), - }), - Interval: cloudflare.F(int64(0)), - Retries: cloudflare.F(int64(0)), - Suspended: cloudflare.F(true), - TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ - Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), - Port: cloudflare.F(int64(0)), - }), - Timeout: cloudflare.F(int64(0)), - Type: cloudflare.F("HTTPS"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Healthchecks.Update( - context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", - healthchecks.HealthcheckUpdateParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + QueryHealthcheck: healthchecks.QueryHealthcheckParam{ Address: cloudflare.F("www.example.com"), - Name: cloudflare.F("server-1"), CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), ConsecutiveFails: cloudflare.F(int64(0)), ConsecutiveSuccesses: cloudflare.F(int64(0)), @@ -115,6 +54,7 @@ func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { Port: cloudflare.F(int64(0)), }), Interval: cloudflare.F(int64(0)), + Name: cloudflare.F("server-1"), Retries: cloudflare.F(int64(0)), Suspended: cloudflare.F(true), TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ @@ -124,6 +64,70 @@ func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { Timeout: cloudflare.F(int64(0)), Type: cloudflare.F("HTTPS"), }, + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Healthchecks.Update( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + healthchecks.HealthcheckUpdateParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + QueryHealthcheck: healthchecks.QueryHealthcheckParam{ + Address: cloudflare.F("www.example.com"), + CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), + }), + Interval: cloudflare.F(int64(0)), + Name: cloudflare.F("server-1"), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ + Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, + }, ) if err != nil { var apierr *cloudflare.Error @@ -179,7 +183,7 @@ func TestHealthcheckDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", healthchecks.HealthcheckDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -209,39 +213,41 @@ func TestHealthcheckEditWithOptionalParams(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", healthchecks.HealthcheckEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Address: cloudflare.F("www.example.com"), - Name: cloudflare.F("server-1"), - CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), - ConsecutiveFails: cloudflare.F(int64(0)), - ConsecutiveSuccesses: cloudflare.F(int64(0)), - Description: cloudflare.F("Health check for www.example.com"), - HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ - AllowInsecure: cloudflare.F(true), - ExpectedBody: cloudflare.F("success"), - ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), - FollowRedirects: cloudflare.F(true), - Header: cloudflare.F[any](map[string]interface{}{ - "Host": map[string]interface{}{ - "0": "example.com", - }, - "X-App-ID": map[string]interface{}{ - "0": "abc123", - }, + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + QueryHealthcheck: healthchecks.QueryHealthcheckParam{ + Address: cloudflare.F("www.example.com"), + CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), }), - Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), - Path: cloudflare.F("/health"), - Port: cloudflare.F(int64(0)), - }), - Interval: cloudflare.F(int64(0)), - Retries: cloudflare.F(int64(0)), - Suspended: cloudflare.F(true), - TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ - Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), - Port: cloudflare.F(int64(0)), - }), - Timeout: cloudflare.F(int64(0)), - Type: cloudflare.F("HTTPS"), + Interval: cloudflare.F(int64(0)), + Name: cloudflare.F("server-1"), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ + Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, }, ) if err != nil { diff --git a/healthchecks/preview.go b/healthchecks/preview.go index 74da8f2832c..2101e5169b2 100644 --- a/healthchecks/preview.go +++ b/healthchecks/preview.go @@ -94,45 +94,12 @@ func (r previewDeleteResponseJSON) RawJSON() string { type PreviewNewParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The hostname or IP address of the origin server to run health checks on. - Address param.Field[string] `json:"address,required"` - // A short name to identify the health check. Only alphanumeric characters, hyphens - // and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // A list of regions from which to run health checks. Null means Cloudflare will - // pick a default region. - CheckRegions param.Field[[]CheckRegion] `json:"check_regions"` - // The number of consecutive fails required from a health check before changing the - // health to unhealthy. - ConsecutiveFails param.Field[int64] `json:"consecutive_fails"` - // The number of consecutive successes required from a health check before changing - // the health to healthy. - ConsecutiveSuccesses param.Field[int64] `json:"consecutive_successes"` - // A human-readable description of the health check. - Description param.Field[string] `json:"description"` - // Parameters specific to an HTTP or HTTPS health check. - HTTPConfig param.Field[HTTPConfigurationParam] `json:"http_config"` - // The interval between each health check. Shorter intervals may give quicker - // notifications if the origin status changes, but will increase load on the origin - // as we check from multiple locations. - Interval param.Field[int64] `json:"interval"` - // The number of retries to attempt in case of a timeout before marking the origin - // as unhealthy. Retries are attempted immediately. - Retries param.Field[int64] `json:"retries"` - // If suspended, no health checks are sent to the origin. - Suspended param.Field[bool] `json:"suspended"` - // Parameters specific to TCP health check. - TCPConfig param.Field[TCPConfigurationParam] `json:"tcp_config"` - // The timeout (in seconds) before marking the health check as failed. - Timeout param.Field[int64] `json:"timeout"` - // The protocol to use for the health check. Currently supported protocols are - // 'HTTP', 'HTTPS' and 'TCP'. - Type param.Field[string] `json:"type"` + ZoneID param.Field[string] `path:"zone_id,required"` + QueryHealthcheck QueryHealthcheckParam `json:"query_healthcheck,required"` } func (r PreviewNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.QueryHealthcheck) } type PreviewNewResponseEnvelope struct { @@ -180,8 +147,8 @@ func (r PreviewNewResponseEnvelopeSuccess) IsKnown() bool { type PreviewDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r PreviewDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/healthchecks/preview_test.go b/healthchecks/preview_test.go index ee9abdf6c90..47267ef08f0 100644 --- a/healthchecks/preview_test.go +++ b/healthchecks/preview_test.go @@ -29,39 +29,41 @@ func TestPreviewNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Healthchecks.Previews.New(context.TODO(), healthchecks.PreviewNewParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Address: cloudflare.F("www.example.com"), - Name: cloudflare.F("server-1"), - CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), - ConsecutiveFails: cloudflare.F(int64(0)), - ConsecutiveSuccesses: cloudflare.F(int64(0)), - Description: cloudflare.F("Health check for www.example.com"), - HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ - AllowInsecure: cloudflare.F(true), - ExpectedBody: cloudflare.F("success"), - ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), - FollowRedirects: cloudflare.F(true), - Header: cloudflare.F[any](map[string]interface{}{ - "Host": map[string]interface{}{ - "0": "example.com", - }, - "X-App-ID": map[string]interface{}{ - "0": "abc123", - }, + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + QueryHealthcheck: healthchecks.QueryHealthcheckParam{ + Address: cloudflare.F("www.example.com"), + CheckRegions: cloudflare.F([]healthchecks.CheckRegion{healthchecks.CheckRegionWeu, healthchecks.CheckRegionEnam}), + ConsecutiveFails: cloudflare.F(int64(0)), + ConsecutiveSuccesses: cloudflare.F(int64(0)), + Description: cloudflare.F("Health check for www.example.com"), + HTTPConfig: cloudflare.F(healthchecks.HTTPConfigurationParam{ + AllowInsecure: cloudflare.F(true), + ExpectedBody: cloudflare.F("success"), + ExpectedCodes: cloudflare.F([]string{"2xx", "302"}), + FollowRedirects: cloudflare.F(true), + Header: cloudflare.F[any](map[string]interface{}{ + "Host": map[string]interface{}{ + "0": "example.com", + }, + "X-App-ID": map[string]interface{}{ + "0": "abc123", + }, + }), + Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), + Path: cloudflare.F("/health"), + Port: cloudflare.F(int64(0)), }), - Method: cloudflare.F(healthchecks.HTTPConfigurationMethodGet), - Path: cloudflare.F("/health"), - Port: cloudflare.F(int64(0)), - }), - Interval: cloudflare.F(int64(0)), - Retries: cloudflare.F(int64(0)), - Suspended: cloudflare.F(true), - TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ - Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), - Port: cloudflare.F(int64(0)), - }), - Timeout: cloudflare.F(int64(0)), - Type: cloudflare.F("HTTPS"), + Interval: cloudflare.F(int64(0)), + Name: cloudflare.F("server-1"), + Retries: cloudflare.F(int64(0)), + Suspended: cloudflare.F(true), + TCPConfig: cloudflare.F(healthchecks.TCPConfigurationParam{ + Method: cloudflare.F(healthchecks.TCPConfigurationMethodConnectionEstablished), + Port: cloudflare.F(int64(0)), + }), + Timeout: cloudflare.F(int64(0)), + Type: cloudflare.F("HTTPS"), + }, }) if err != nil { var apierr *cloudflare.Error @@ -91,7 +93,7 @@ func TestPreviewDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", healthchecks.PreviewDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/hostnames/aliases.go b/hostnames/aliases.go index cdc318ef2aa..3e1c62dff61 100644 --- a/hostnames/aliases.go +++ b/hostnames/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/hyperdrive/aliases.go b/hyperdrive/aliases.go index ab6e749b8b2..ce46b185f43 100644 --- a/hyperdrive/aliases.go +++ b/hyperdrive/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/hyperdrive/config.go b/hyperdrive/config.go index f6f1db4d70e..c20bf9e5b65 100644 --- a/hyperdrive/config.go +++ b/hyperdrive/config.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // ConfigService contains methods and other services that help with interacting @@ -82,7 +84,7 @@ func (r *ConfigService) ListAutoPaging(ctx context.Context, query ConfigListPara } // Deletes the specified Hyperdrive. -func (r *ConfigService) Delete(ctx context.Context, hyperdriveID string, body ConfigDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *ConfigService) Delete(ctx context.Context, hyperdriveID string, body ConfigDeleteParams, opts ...option.RequestOption) (res *ConfigDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env ConfigDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/hyperdrive/configs/%s", body.AccountID, hyperdriveID) @@ -121,6 +123,23 @@ func (r *ConfigService) Get(ctx context.Context, hyperdriveID string, query Conf return } +// Union satisfied by [hyperdrive.ConfigDeleteResponseUnknown] or +// [shared.UnionString]. +type ConfigDeleteResponseUnion interface { + ImplementsHyperdriveConfigDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ConfigDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type ConfigNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` @@ -240,9 +259,9 @@ type ConfigDeleteParams struct { } type ConfigDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result ConfigDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success ConfigDeleteResponseEnvelopeSuccess `json:"success,required"` JSON configDeleteResponseEnvelopeJSON `json:"-"` diff --git a/images/aliases.go b/images/aliases.go index b6304492dcc..1158f7dbbdb 100644 --- a/images/aliases.go +++ b/images/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/images/v1.go b/images/v1.go index 1e47595f34f..5508db86710 100644 --- a/images/v1.go +++ b/images/v1.go @@ -87,7 +87,7 @@ func (r *V1Service) ListAutoPaging(ctx context.Context, params V1ListParams, opt // Delete an image on Cloudflare Images. On success, all copies of the image are // deleted and purged from cache. -func (r *V1Service) Delete(ctx context.Context, imageID string, params V1DeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *V1Service) Delete(ctx context.Context, imageID string, params V1DeleteParams, opts ...option.RequestOption) (res *V1DeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env V1DeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/images/v1/%s", params.AccountID, imageID) @@ -254,6 +254,22 @@ func (r V1ListResponseSuccess) IsKnown() bool { return false } +// Union satisfied by [images.V1DeleteResponseUnknown] or [shared.UnionString]. +type V1DeleteResponseUnion interface { + ImplementsImagesV1DeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*V1DeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type V1NewParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` @@ -335,8 +351,8 @@ func (r V1ListParams) URLQuery() (v url.Values) { type V1DeleteParams struct { // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r V1DeleteParams) MarshalJSON() (data []byte, err error) { @@ -344,9 +360,9 @@ func (r V1DeleteParams) MarshalJSON() (data []byte, err error) { } type V1DeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result V1DeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success V1DeleteResponseEnvelopeSuccess `json:"success,required"` JSON v1DeleteResponseEnvelopeJSON `json:"-"` diff --git a/images/v1_test.go b/images/v1_test.go index 094015caa7b..3971ac966bf 100644 --- a/images/v1_test.go +++ b/images/v1_test.go @@ -91,7 +91,7 @@ func TestV1Delete(t *testing.T) { "string", images.V1DeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/images/v1variant.go b/images/v1variant.go index 8951092304e..1e1222b24a2 100644 --- a/images/v1variant.go +++ b/images/v1variant.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // V1VariantService contains methods and other services that help with interacting @@ -58,7 +60,7 @@ func (r *V1VariantService) List(ctx context.Context, query V1VariantListParams, } // Deleting a variant purges the cache for all images associated with the variant. -func (r *V1VariantService) Delete(ctx context.Context, variantID string, params V1VariantDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *V1VariantService) Delete(ctx context.Context, variantID string, params V1VariantDeleteParams, opts ...option.RequestOption) (res *V1VariantDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env V1VariantDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/images/v1/variants/%s", params.AccountID, variantID) @@ -353,6 +355,23 @@ func (r V1VariantNewResponseVariantOptionsMetadata) IsKnown() bool { return false } +// Union satisfied by [images.V1VariantDeleteResponseUnknown] or +// [shared.UnionString]. +type V1VariantDeleteResponseUnion interface { + ImplementsImagesV1VariantDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*V1VariantDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type V1VariantEditResponse struct { Variant V1VariantEditResponseVariant `json:"variant"` JSON v1VariantEditResponseJSON `json:"-"` @@ -753,8 +772,8 @@ func (r V1VariantListResponseEnvelopeSuccess) IsKnown() bool { type V1VariantDeleteParams struct { // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r V1VariantDeleteParams) MarshalJSON() (data []byte, err error) { @@ -762,9 +781,9 @@ func (r V1VariantDeleteParams) MarshalJSON() (data []byte, err error) { } type V1VariantDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result V1VariantDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success V1VariantDeleteResponseEnvelopeSuccess `json:"success,required"` JSON v1VariantDeleteResponseEnvelopeJSON `json:"-"` diff --git a/images/v1variant_test.go b/images/v1variant_test.go index a359935e0cc..75b21ec3790 100644 --- a/images/v1variant_test.go +++ b/images/v1variant_test.go @@ -93,7 +93,7 @@ func TestV1VariantDelete(t *testing.T) { "hero", images.V1VariantDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/intel/aliases.go b/intel/aliases.go index 1e5dcbaa653..45d1643d3b7 100644 --- a/intel/aliases.go +++ b/intel/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/internal/shared/shared.go b/internal/shared/shared.go index 500666a18ec..33fc43d0a72 100644 --- a/internal/shared/shared.go +++ b/internal/shared/shared.go @@ -3,11 +3,8 @@ package shared import ( - "reflect" - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/tidwall/gjson" ) type ErrorData struct { @@ -62,69 +59,3 @@ type ResponseInfoParam struct { func (r ResponseInfoParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } - -// An object configuring the rule's logging behavior. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c struct { - // Whether to generate a log when the rule matches. - Enabled bool `json:"enabled,required"` - JSON unnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cJSON `json:"-"` -} - -// unnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cJSON contains the JSON metadata -// for the struct [UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] -type unnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cJSON struct { - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r unnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cJSON) RawJSON() string { - return r.raw -} - -// An object configuring the rule's logging behavior. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam struct { - // Whether to generate a log when the rule matches. - Enabled param.Field[bool] `json:"enabled,required"` -} - -func (r UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Union satisfied by -// [shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnknown] or -// [shared.UnionString]. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion interface { - ImplementsSharedUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(UnionString("")), - }, - ) -} - -// JSON encoded metadata about the uploaded parts and Worker configuration. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param struct { - // Name of the part in the multipart request that contains the script (e.g. the - // file adding a listener to the `fetch` event). Indicates a - // `service worker syntax` Worker. - BodyPart param.Field[string] `json:"body_part"` - // Name of the part in the multipart request that contains the main module (e.g. - // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. - MainModule param.Field[string] `json:"main_module"` -} - -func (r UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} diff --git a/internal/shared/union.go b/internal/shared/union.go index 2e5150461d3..3ce4c02ece4 100644 --- a/internal/shared/union.go +++ b/internal/shared/union.go @@ -4,30 +4,86 @@ package shared type UnionString string -func (UnionString) ImplementsSharedUnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion() {} -func (UnionString) ImplementsUserAuditLogListResponse() {} -func (UnionString) ImplementsZonesCustomNameserverUpdateResponseUnion() {} -func (UnionString) ImplementsZonesCustomNameserverGetResponseUnion() {} -func (UnionString) ImplementsLoadBalancersPoolHealthGetResponseUnion() {} -func (UnionString) ImplementsLoadBalancersRegionGetResponseUnion() {} -func (UnionString) ImplementsCacheCachePurgeParamsCachePurgeFilesFileUnion() {} -func (UnionString) ImplementsCustomNameserversCustomNameserverDeleteResponseUnion() {} -func (UnionString) ImplementsDNSFirewallIPsUnionParam() {} -func (UnionString) ImplementsDNSFirewallIPsUnion() {} -func (UnionString) ImplementsDNSUpstreamIPsUnionParam() {} -func (UnionString) ImplementsDNSUpstreamIPsUnion() {} -func (UnionString) ImplementsDNSSECDNSSECDeleteResponseUnion() {} +func (UnionString) ImplementsAccountsAccountUpdateResponseUnion() {} +func (UnionString) ImplementsAccountsAccountGetResponseUnion() {} +func (UnionString) ImplementsAccountsRoleGetResponseUnion() {} +func (UnionString) ImplementsOriginCACertificatesOriginCACertificateNewResponseUnion() {} +func (UnionString) ImplementsOriginCACertificatesOriginCACertificateGetResponseUnion() {} +func (UnionString) ImplementsMembershipsMembershipUpdateResponseUnion() {} +func (UnionString) ImplementsMembershipsMembershipGetResponseUnion() {} +func (UnionString) ImplementsUserUserEditResponseUnion() {} +func (UnionString) ImplementsUserUserGetResponseUnion() {} +func (UnionString) ImplementsUserAuditLogListResponse() {} +func (UnionString) ImplementsUserBillingProfileGetResponseUnion() {} +func (UnionString) ImplementsUserInviteEditResponseUnion() {} +func (UnionString) ImplementsUserInviteGetResponseUnion() {} +func (UnionString) ImplementsUserOrganizationGetResponseUnion() {} +func (UnionString) ImplementsUserSubscriptionUpdateResponseUnion() {} +func (UnionString) ImplementsUserSubscriptionEditResponseUnion() {} +func (UnionString) ImplementsUserTokenUpdateResponseUnion() {} +func (UnionString) ImplementsUserTokenGetResponseUnion() {} +func (UnionString) ImplementsZonesCustomNameserverUpdateResponseUnion() {} +func (UnionString) ImplementsZonesCustomNameserverGetResponseUnion() {} +func (UnionString) ImplementsZonesSubscriptionNewResponseUnion() {} +func (UnionString) ImplementsZonesSubscriptionGetResponseUnion() {} +func (UnionString) ImplementsLoadBalancersPoolHealthGetResponseUnion() {} +func (UnionString) ImplementsLoadBalancersRegionListResponseUnion() {} +func (UnionString) ImplementsLoadBalancersRegionGetResponseUnion() {} +func (UnionString) ImplementsCacheCachePurgeParamsBodyCachePurgeFilesFileUnion() {} +func (UnionString) ImplementsCacheSmartTieredCacheDeleteResponseUnion() {} +func (UnionString) ImplementsCacheSmartTieredCacheEditResponseUnion() {} +func (UnionString) ImplementsCacheSmartTieredCacheGetResponseUnion() {} +func (UnionString) ImplementsSSLAnalyzeNewResponseUnion() {} +func (UnionString) ImplementsSSLCertificatePackGetResponseUnion() {} +func (UnionString) ImplementsSubscriptionsSubscriptionNewResponseUnion() {} +func (UnionString) ImplementsSubscriptionsSubscriptionUpdateResponseUnion() {} +func (UnionString) ImplementsSubscriptionsSubscriptionGetResponseUnion() {} +func (UnionString) ImplementsArgoSmartRoutingEditResponseUnion() {} +func (UnionString) ImplementsArgoSmartRoutingGetResponseUnion() {} +func (UnionString) ImplementsArgoTieredCachingEditResponseUnion() {} +func (UnionString) ImplementsArgoTieredCachingGetResponseUnion() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateNewResponseUnion() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateEditResponseUnion() {} +func (UnionString) ImplementsCustomCertificatesCustomCertificateGetResponseUnion() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginUpdateResponseUnion() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginDeleteResponseUnion() {} +func (UnionString) ImplementsCustomHostnamesFallbackOriginGetResponseUnion() {} +func (UnionString) ImplementsCustomNameserversCustomNameserverDeleteResponseUnion() {} +func (UnionString) ImplementsDNSFirewallIPsUnionParam() {} +func (UnionString) ImplementsDNSFirewallIPsUnion() {} +func (UnionString) ImplementsDNSUpstreamIPsUnionParam() {} +func (UnionString) ImplementsDNSUpstreamIPsUnion() {} +func (UnionString) ImplementsDNSSECDNSSECDeleteResponseUnion() {} +func (UnionString) ImplementsFirewallAccessRuleNewResponseUnion() {} +func (UnionString) ImplementsFirewallAccessRuleEditResponseUnion() {} +func (UnionString) ImplementsFirewallAccessRuleGetResponseUnion() {} +func (UnionString) ImplementsFirewallUARuleNewResponseUnion() {} +func (UnionString) ImplementsFirewallUARuleUpdateResponseUnion() {} +func (UnionString) ImplementsFirewallUARuleGetResponseUnion() {} func (UnionString) ImplementsFirewallWAFPackageListResponseFirewallAPIResponseCollectionResultUnion() { } func (UnionString) ImplementsFirewallWAFPackageGetResponseFirewallAPIResponseSingleResultUnion() {} +func (UnionString) ImplementsFirewallWAFPackageGroupEditResponseUnion() {} +func (UnionString) ImplementsFirewallWAFPackageGroupGetResponseUnion() {} +func (UnionString) ImplementsFirewallWAFPackageRuleGetResponseUnion() {} func (UnionString) ImplementsLogpushJobDeleteResponseUnion() {} func (UnionString) ImplementsLogsControlCmbConfigDeleteResponseUnion() {} func (UnionString) ImplementsLogsRayIDGetResponseUnion() {} func (UnionString) ImplementsLogsReceivedGetResponseUnion() {} func (UnionString) ImplementsLogsReceivedGetParamsEndUnion() {} func (UnionString) ImplementsLogsReceivedGetParamsStartUnion() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthNewResponseUnion() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthDeleteResponseUnion() {} +func (UnionString) ImplementsOriginTLSClientAuthOriginTLSClientAuthGetResponseUnion() {} +func (UnionString) ImplementsPagerulesPageruleNewResponseUnion() {} +func (UnionString) ImplementsPagerulesPageruleUpdateResponseUnion() {} +func (UnionString) ImplementsPagerulesPageruleEditResponseUnion() {} +func (UnionString) ImplementsPagerulesPageruleGetResponseUnion() {} +func (UnionString) ImplementsRateLimitsRateLimitNewResponseUnion() {} +func (UnionString) ImplementsRateLimitsRateLimitEditResponseUnion() {} +func (UnionString) ImplementsRateLimitsRateLimitGetResponseUnion() {} func (UnionString) ImplementsWorkersAIRunResponseUnion() {} -func (UnionString) ImplementsWorkersAIRunParamsTextEmbeddingsTextUnion() {} +func (UnionString) ImplementsWorkersAIRunParamsBodyTextEmbeddingsTextUnion() {} func (UnionString) ImplementsWorkersScriptTailDeleteResponseUnion() {} func (UnionString) ImplementsKVNamespaceUpdateResponseUnion() {} func (UnionString) ImplementsKVNamespaceDeleteResponseUnion() {} @@ -41,6 +97,7 @@ func (UnionString) ImplementsSpectrumOriginPortUnionParam() func (UnionString) ImplementsSpectrumOriginPortUnion() {} func (UnionString) ImplementsSpectrumAnalyticsEventBytimeGetResponseUnion() {} func (UnionString) ImplementsSpectrumAnalyticsEventSummaryGetResponseUnion() {} +func (UnionString) ImplementsSpectrumAppGetResponseUnion() {} func (UnionString) ImplementsAddressingAddressMapDeleteResponseUnion() {} func (UnionString) ImplementsAddressingAddressMapAccountUpdateResponseUnion() {} func (UnionString) ImplementsAddressingAddressMapAccountDeleteResponseUnion() {} @@ -51,7 +108,10 @@ func (UnionString) ImplementsAddressingAddressMapZoneDeleteResponseUnion() func (UnionString) ImplementsAddressingPrefixDeleteResponseUnion() {} func (UnionString) ImplementsAddressingPrefixBGPBindingDeleteResponseUnion() {} func (UnionString) ImplementsAuditLogsAuditLogListResponse() {} +func (UnionString) ImplementsBillingProfileGetResponseUnion() {} func (UnionString) ImplementsImagesImageVariantsUnion() {} +func (UnionString) ImplementsImagesV1DeleteResponseUnion() {} +func (UnionString) ImplementsImagesV1VariantDeleteResponseUnion() {} func (UnionString) ImplementsIntelIpipUnion() {} func (UnionString) ImplementsIntelMiscategorizationNewResponseUnion() {} func (UnionString) ImplementsIntelAttackSurfaceReportIssueDismissResponseUnion() {} @@ -68,10 +128,17 @@ func (UnionString) ImplementsRegistrarDomainGetResponseUnion() func (UnionString) ImplementsRulesListItemGetResponseUnion() {} func (UnionString) ImplementsStreamAudioTrackDeleteResponseUnion() {} func (UnionString) ImplementsStreamKeyDeleteResponseUnion() {} +func (UnionString) ImplementsStreamWatermarkNewResponseUnion() {} func (UnionString) ImplementsStreamWatermarkDeleteResponseUnion() {} +func (UnionString) ImplementsStreamWatermarkGetResponseUnion() {} +func (UnionString) ImplementsStreamWebhookUpdateResponseUnion() {} func (UnionString) ImplementsStreamWebhookDeleteResponseUnion() {} +func (UnionString) ImplementsStreamWebhookGetResponseUnion() {} +func (UnionString) ImplementsStreamCaptionUpdateResponseUnion() {} func (UnionString) ImplementsStreamCaptionDeleteResponseUnion() {} +func (UnionString) ImplementsStreamDownloadNewResponseUnion() {} func (UnionString) ImplementsStreamDownloadDeleteResponseUnion() {} +func (UnionString) ImplementsStreamDownloadGetResponseUnion() {} func (UnionString) ImplementsAlertingAvailableAlertListResponseUnion() {} func (UnionString) ImplementsAlertingDestinationEligibleGetResponseUnion() {} func (UnionString) ImplementsAlertingDestinationPagerdutyDeleteResponseUnion() {} @@ -79,8 +146,15 @@ func (UnionString) ImplementsAlertingDestinationWebhookDeleteResponseUnion() func (UnionString) ImplementsAlertingMechanismIDUnionParam() {} func (UnionString) ImplementsAlertingMechanismIDUnion() {} func (UnionString) ImplementsAlertingPolicyDeleteResponseUnion() {} +func (UnionString) ImplementsD1DatabaseDeleteResponseUnion() {} func (UnionString) ImplementsWARPConnectorWARPConnectorTokenResponseUnion() {} +func (UnionString) ImplementsZeroTrustDeviceGetResponseUnion() {} +func (UnionString) ImplementsZeroTrustDevicePostureIntegrationDeleteResponseUnion() {} +func (UnionString) ImplementsZeroTrustDeviceRevokeNewResponseUnion() {} +func (UnionString) ImplementsZeroTrustDeviceUnrevokeNewResponseUnion() {} func (UnionString) ImplementsZeroTrustAppIDUnionParam() {} +func (UnionString) ImplementsZeroTrustAccessApplicationCANewResponseUnion() {} +func (UnionString) ImplementsZeroTrustAccessApplicationCAGetResponseUnion() {} func (UnionString) ImplementsZeroTrustAccessKeyUpdateResponseUnion() {} func (UnionString) ImplementsZeroTrustAccessKeyGetResponseUnion() {} func (UnionString) ImplementsZeroTrustAccessKeyRotateResponseUnion() {} @@ -90,16 +164,26 @@ func (UnionString) ImplementsZeroTrustTunnelConnectionDeleteResponseUnion() func (UnionString) ImplementsZeroTrustTunnelTokenGetResponseUnion() {} func (UnionString) ImplementsZeroTrustTunnelManagementNewResponseUnion() {} func (UnionString) ImplementsZeroTrustDLPProfileCustomDeleteResponseUnion() {} +func (UnionString) ImplementsZeroTrustGatewayListDeleteResponseUnion() {} +func (UnionString) ImplementsZeroTrustGatewayLocationDeleteResponseUnion() {} +func (UnionString) ImplementsZeroTrustGatewayProxyEndpointDeleteResponseUnion() {} +func (UnionString) ImplementsZeroTrustGatewayRuleDeleteResponseUnion() {} func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkNewResponseUnion() {} func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkDeleteResponseUnion() {} func (UnionString) ImplementsZeroTrustNetworkVirtualNetworkEditResponseUnion() {} +func (UnionString) ImplementsHyperdriveConfigDeleteResponseUnion() {} +func (UnionString) ImplementsVectorizeIndexDeleteResponseUnion() {} func (UnionString) ImplementsRadarRankingTimeseriesGroupsResponseSerie0Union() {} -func (UnionString) ImplementsHostnamesSettingValueUnionParam() {} -func (UnionString) ImplementsHostnamesSettingValueUnion() {} -func (UnionString) ImplementsSnippetsSnippetDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() {} +func (UnionString) ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncryptionUpdateResponseUnion() { +} +func (UnionString) ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncryptionGetResponseUnion() { +} +func (UnionString) ImplementsHostnamesSettingValueUnionParam() {} +func (UnionString) ImplementsHostnamesSettingValueUnion() {} +func (UnionString) ImplementsSnippetsSnippetDeleteResponseUnion() {} +func (UnionString) ImplementsCloudforceOneRequestDeleteResponseUnion() {} +func (UnionString) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() {} +func (UnionString) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() {} type UnionInt int64 diff --git a/ips/aliases.go b/ips/aliases.go index cef5adfc792..cbaf296e647 100644 --- a/ips/aliases.go +++ b/ips/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/keyless_certificates/aliases.go b/keyless_certificates/aliases.go index 79316556623..77f5cb92627 100644 --- a/keyless_certificates/aliases.go +++ b/keyless_certificates/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/keyless_certificates/keylesscertificate.go b/keyless_certificates/keylesscertificate.go index 2b25de907c1..6dd95160ff6 100644 --- a/keyless_certificates/keylesscertificate.go +++ b/keyless_certificates/keylesscertificate.go @@ -333,7 +333,7 @@ type KeylessCertificateNewParams struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[custom_hostnames.BundleMethod] `json:"bundle_method"` // The keyless SSL name. Name param.Field[string] `json:"name"` // Configuration for using Keyless SSL through a Cloudflare Tunnel @@ -394,8 +394,8 @@ type KeylessCertificateListParams struct { type KeylessCertificateDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r KeylessCertificateDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/keyless_certificates/keylesscertificate_test.go b/keyless_certificates/keylesscertificate_test.go index 707342c4834..bef4462bd5f 100644 --- a/keyless_certificates/keylesscertificate_test.go +++ b/keyless_certificates/keylesscertificate_test.go @@ -34,7 +34,7 @@ func TestKeylessCertificateNewWithOptionalParams(t *testing.T) { Certificate: cloudflare.F("-----BEGIN CERTIFICATE----- MIIDtTCCAp2gAwIBAgIJAM15n7fdxhRtMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV BAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX aWRnaXRzIFB0eSBMdGQwHhcNMTQwMzExMTkyMTU5WhcNMTQwNDEwMTkyMTU5WjBF MQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB CgKCAQEAvq3sKsHpeduJHimOK+fvQdKsI8z8A05MZyyLp2/R/GE8FjNv+hkVY1WQ LIyTNNQH7CJecE1nbTfo8Y56S7x/rhxC6/DJ8MIulapFPnorq46KU6yRxiM0MQ3N nTJHlHA2ozZta6YBBfVfhHWl1F0IfNbXCLKvGwWWMbCx43OfW6KTkbRnE6gFWKuO fSO5h2u5TaWVuSIzBvYs7Vza6m+gtYAvKAJV2nSZ+eSEFPDo29corOy8+huEOUL8 5FAw4BFPsr1TlrlGPFitduQUHGrSL7skk1ESGza0to3bOtrodKei2s9bk5MXm7lZ qI+WZJX4Zu9+mzZhc9pCVi8r/qlXuQIDAQABo4GnMIGkMB0GA1UdDgQWBBRvavf+ sWM4IwKiH9X9w1vl6nUVRDB1BgNVHSMEbjBsgBRvavf+sWM4IwKiH9X9w1vl6nUV RKFJpEcwRTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAM15n7fdxhRtMAwGA1UdEwQF MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBABY2ZzBaW0dMsAAT7tPJzrVWVzQx6KU4 UEBLudIlWPlkAwTnINCWR/8eNjCCmGA4heUdHmazdpPa8RzwOmc0NT1NQqzSyktt vTqb4iHD7+8f9MqJ9/FssCfTtqr/Qst/hGH4Wmdf1EJ/6FqYAAb5iRlPgshFZxU8 uXtA8hWn6fK6eISD9HBdcAFToUvKNZ1BIDPvh9f95Ine8ar6yGd56TUNrHR8eHBs ESxz5ddVR/oWRysNJ+aGAyYqHS8S/ttmC7r4XCAHqXptkHPCGRqkAhsterYhd4I8 /cBzejUobNCjjHFbtkAL/SjxZOLW+pNkZwfeYdM8iPkD54Uua1v2tdw= -----END CERTIFICATE-----"), Host: cloudflare.F("example.com"), Port: cloudflare.F(24008.000000), - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), Name: cloudflare.F("example.com Keyless SSL"), Tunnel: cloudflare.F(keyless_certificates.TunnelParam{ PrivateIP: cloudflare.F("10.0.0.1"), @@ -95,7 +95,7 @@ func TestKeylessCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", keyless_certificates.KeylessCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/kv/aliases.go b/kv/aliases.go index 6d82f12ee35..1580d944445 100644 --- a/kv/aliases.go +++ b/kv/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/kv/namespace.go b/kv/namespace.go index c9bd021fbe7..c91a623e4b9 100644 --- a/kv/namespace.go +++ b/kv/namespace.go @@ -331,8 +331,8 @@ func (r NamespaceListParamsOrder) IsKnown() bool { type NamespaceDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r NamespaceDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/kv/namespace_test.go b/kv/namespace_test.go index ca0aee5e53d..3d4bbb4e88f 100644 --- a/kv/namespace_test.go +++ b/kv/namespace_test.go @@ -121,7 +121,7 @@ func TestNamespaceDelete(t *testing.T) { "0f2ac74b498b48028cb68387c421e279", kv.NamespaceDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/kv/namespacebulk.go b/kv/namespacebulk.go index a9de7d78909..6d492909e2a 100644 --- a/kv/namespacebulk.go +++ b/kv/namespacebulk.go @@ -102,8 +102,8 @@ func init() { type NamespaceBulkUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]NamespaceBulkUpdateParamsBody] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []NamespaceBulkUpdateParamsBody `json:"body,required"` } func (r NamespaceBulkUpdateParams) MarshalJSON() (data []byte, err error) { @@ -179,8 +179,8 @@ func (r NamespaceBulkUpdateResponseEnvelopeSuccess) IsKnown() bool { type NamespaceBulkDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]string] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []string `json:"body,required"` } func (r NamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/kv/namespacebulk_test.go b/kv/namespacebulk_test.go index dafa63c7c3d..b8ab731e9f1 100644 --- a/kv/namespacebulk_test.go +++ b/kv/namespacebulk_test.go @@ -33,7 +33,7 @@ func TestNamespaceBulkUpdate(t *testing.T) { "0f2ac74b498b48028cb68387c421e279", kv.NamespaceBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]kv.NamespaceBulkUpdateParamsBody{{ + Body: []kv.NamespaceBulkUpdateParamsBody{{ Base64: cloudflare.F(true), Expiration: cloudflare.F(1578435000.000000), ExpirationTTL: cloudflare.F(300.000000), @@ -60,7 +60,7 @@ func TestNamespaceBulkUpdate(t *testing.T) { "someMetadataKey": "someMetadataValue", }), Value: cloudflare.F("Some string"), - }}), + }}, }, ) if err != nil { @@ -91,7 +91,7 @@ func TestNamespaceBulkDelete(t *testing.T) { "0f2ac74b498b48028cb68387c421e279", kv.NamespaceBulkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]string{"My-Key", "My-Key", "My-Key"}), + Body: []string{"My-Key", "My-Key", "My-Key"}, }, ) if err != nil { diff --git a/kv/namespacevalue.go b/kv/namespacevalue.go index 0d6796a5b11..c5b061402af 100644 --- a/kv/namespacevalue.go +++ b/kv/namespacevalue.go @@ -170,8 +170,8 @@ func (r NamespaceValueUpdateResponseEnvelopeSuccess) IsKnown() bool { type NamespaceValueDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r NamespaceValueDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/kv/namespacevalue_test.go b/kv/namespacevalue_test.go index 16dc6b4c80e..175a684b6fd 100644 --- a/kv/namespacevalue_test.go +++ b/kv/namespacevalue_test.go @@ -67,7 +67,7 @@ func TestNamespaceValueDelete(t *testing.T) { "My-Key", kv.NamespaceValueDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/load_balancers/aliases.go b/load_balancers/aliases.go index 6346c3cb05d..37ed2fe6fe7 100644 --- a/load_balancers/aliases.go +++ b/load_balancers/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/load_balancers/loadbalancer.go b/load_balancers/loadbalancer.go index 3f1b5f3f505..1447f7662cd 100644 --- a/load_balancers/loadbalancer.go +++ b/load_balancers/loadbalancer.go @@ -2193,8 +2193,8 @@ type LoadBalancerListParams struct { } type LoadBalancerDeleteParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r LoadBalancerDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/load_balancers/loadbalancer_test.go b/load_balancers/loadbalancer_test.go index b24a96c591d..ce92749b2f3 100644 --- a/load_balancers/loadbalancer_test.go +++ b/load_balancers/loadbalancer_test.go @@ -680,7 +680,7 @@ func TestLoadBalancerDelete(t *testing.T) { "699d98642c564d2e855e9661899b7252", load_balancers.LoadBalancerDeleteParams{ ZoneID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/load_balancers/monitor.go b/load_balancers/monitor.go index 8c02f8d554d..261f4ad0abe 100644 --- a/load_balancers/monitor.go +++ b/load_balancers/monitor.go @@ -952,8 +952,8 @@ type MonitorListParams struct { type MonitorDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r MonitorDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/load_balancers/monitor_test.go b/load_balancers/monitor_test.go index 696313c74a4..60066c91079 100644 --- a/load_balancers/monitor_test.go +++ b/load_balancers/monitor_test.go @@ -161,7 +161,7 @@ func TestMonitorDelete(t *testing.T) { "f1aba936b94213e5b8dca0c0dbf1f9cc", load_balancers.MonitorDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/load_balancers/pool.go b/load_balancers/pool.go index cc3ebd68af6..49a79ff74a6 100644 --- a/load_balancers/pool.go +++ b/load_balancers/pool.go @@ -434,8 +434,8 @@ func (r PoolListParams) URLQuery() (v url.Values) { type PoolDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r PoolDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/load_balancers/pool_test.go b/load_balancers/pool_test.go index c7561521162..2d164435952 100644 --- a/load_balancers/pool_test.go +++ b/load_balancers/pool_test.go @@ -227,7 +227,7 @@ func TestPoolDelete(t *testing.T) { "17b5962d775c646f3f9725cbc7a53df4", load_balancers.PoolDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/load_balancers/region.go b/load_balancers/region.go index 24e7042082e..11438b44492 100644 --- a/load_balancers/region.go +++ b/load_balancers/region.go @@ -36,7 +36,7 @@ func NewRegionService(opts ...option.RequestOption) (r *RegionService) { } // List all region mappings. -func (r *RegionService) List(ctx context.Context, params RegionListParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *RegionService) List(ctx context.Context, params RegionListParams, opts ...option.RequestOption) (res *RegionListResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RegionListResponseEnvelope path := fmt.Sprintf("accounts/%s/load_balancers/regions", params.AccountID) @@ -61,6 +61,23 @@ func (r *RegionService) Get(ctx context.Context, regionID RegionGetParamsRegionI return } +// Union satisfied by [load_balancers.RegionListResponseUnknown] or +// [shared.UnionString]. +type RegionListResponseUnion interface { + ImplementsLoadBalancersRegionListResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RegionListResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + // A list of countries and subdivisions mapped to a region. // // Union satisfied by [load_balancers.RegionGetResponseUnknown] or @@ -100,9 +117,9 @@ func (r RegionListParams) URLQuery() (v url.Values) { } type RegionListResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result RegionListResponseUnion `json:"result,required"` // Whether the API call was successful Success RegionListResponseEnvelopeSuccess `json:"success,required"` JSON regionListResponseEnvelopeJSON `json:"-"` diff --git a/logpush/aliases.go b/logpush/aliases.go index f6208c3646a..564aeed6c35 100644 --- a/logpush/aliases.go +++ b/logpush/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/logpush/job.go b/logpush/job.go index 6b35915a7c7..37e6f0e58b5 100644 --- a/logpush/job.go +++ b/logpush/job.go @@ -379,7 +379,7 @@ type JobListParams struct { } type JobDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,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. diff --git a/logpush/job_test.go b/logpush/job_test.go index d477d189bf2..b1793153a73 100644 --- a/logpush/job_test.go +++ b/logpush/job_test.go @@ -157,7 +157,7 @@ func TestJobDeleteWithOptionalParams(t *testing.T) { context.TODO(), int64(1), logpush.JobDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), }, diff --git a/logs/aliases.go b/logs/aliases.go index 51c4224048a..08e1e5ce857 100644 --- a/logs/aliases.go +++ b/logs/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/logs/controlcmbconfig.go b/logs/controlcmbconfig.go index 0a989547fff..b66ff77cefb 100644 --- a/logs/controlcmbconfig.go +++ b/logs/controlcmbconfig.go @@ -94,6 +94,15 @@ func (r cmbConfigJSON) RawJSON() string { return r.raw } +type CmbConfigParam struct { + // Comma-separated list of regions. + Regions param.Field[string] `json:"regions"` +} + +func (r CmbConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // Union satisfied by [logs.ControlCmbConfigDeleteResponseUnknown], // [logs.ControlCmbConfigDeleteResponseArray] or [shared.UnionString]. type ControlCmbConfigDeleteResponseUnion interface { @@ -122,12 +131,11 @@ func (r ControlCmbConfigDeleteResponseArray) ImplementsLogsControlCmbConfigDelet type ControlCmbConfigNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - // Comma-separated list of regions. - Regions param.Field[string] `json:"regions"` + CmbConfig CmbConfigParam `json:"cmb_config,required"` } func (r ControlCmbConfigNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.CmbConfig) } type ControlCmbConfigNewResponseEnvelope struct { @@ -175,8 +183,8 @@ func (r ControlCmbConfigNewResponseEnvelopeSuccess) IsKnown() bool { type ControlCmbConfigDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ControlCmbConfigDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/logs/controlcmbconfig_test.go b/logs/controlcmbconfig_test.go index c8b1ebe345d..adad27d9232 100644 --- a/logs/controlcmbconfig_test.go +++ b/logs/controlcmbconfig_test.go @@ -30,7 +30,9 @@ func TestControlCmbConfigNewWithOptionalParams(t *testing.T) { ) _, err := client.Logs.Control.Cmb.Config.New(context.TODO(), logs.ControlCmbConfigNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Regions: cloudflare.F("eu"), + CmbConfig: logs.CmbConfigParam{ + Regions: cloudflare.F("eu"), + }, }) if err != nil { var apierr *cloudflare.Error @@ -57,7 +59,7 @@ func TestControlCmbConfigDelete(t *testing.T) { ) _, err := client.Logs.Control.Cmb.Config.Delete(context.TODO(), logs.ControlCmbConfigDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/magic_network_monitoring/aliases.go b/magic_network_monitoring/aliases.go index 9ce5ed97973..13a9f4fc0bc 100644 --- a/magic_network_monitoring/aliases.go +++ b/magic_network_monitoring/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/magic_network_monitoring/config.go b/magic_network_monitoring/config.go index 04ddc9ccb9d..9d68c935aa1 100644 --- a/magic_network_monitoring/config.go +++ b/magic_network_monitoring/config.go @@ -140,8 +140,8 @@ func (r ConfigurationParam) MarshalJSON() (data []byte, err error) { } type ConfigNewParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConfigNewParams) MarshalJSON() (data []byte, err error) { @@ -192,8 +192,8 @@ func (r ConfigNewResponseEnvelopeSuccess) IsKnown() bool { } type ConfigUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConfigUpdateParams) MarshalJSON() (data []byte, err error) { @@ -244,8 +244,8 @@ func (r ConfigUpdateResponseEnvelopeSuccess) IsKnown() bool { } type ConfigDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConfigDeleteParams) MarshalJSON() (data []byte, err error) { @@ -296,8 +296,8 @@ func (r ConfigDeleteResponseEnvelopeSuccess) IsKnown() bool { } type ConfigEditParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConfigEditParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_network_monitoring/config_test.go b/magic_network_monitoring/config_test.go index 7edba8abfb9..7cc445edfb9 100644 --- a/magic_network_monitoring/config_test.go +++ b/magic_network_monitoring/config_test.go @@ -30,7 +30,7 @@ func TestConfigNew(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Configs.New(context.TODO(), magic_network_monitoring.ConfigNewParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -57,7 +57,7 @@ func TestConfigUpdate(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Configs.Update(context.TODO(), magic_network_monitoring.ConfigUpdateParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -84,7 +84,7 @@ func TestConfigDelete(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Configs.Delete(context.TODO(), magic_network_monitoring.ConfigDeleteParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -111,7 +111,7 @@ func TestConfigEdit(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Configs.Edit(context.TODO(), magic_network_monitoring.ConfigEditParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/magic_network_monitoring/rule.go b/magic_network_monitoring/rule.go index b8e7dd46191..bd37e0e101a 100644 --- a/magic_network_monitoring/rule.go +++ b/magic_network_monitoring/rule.go @@ -172,8 +172,8 @@ func (r magicNetworkMonitoringRuleJSON) RawJSON() string { } type RuleNewParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RuleNewParams) MarshalJSON() (data []byte, err error) { @@ -224,8 +224,8 @@ func (r RuleNewResponseEnvelopeSuccess) IsKnown() bool { } type RuleUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RuleUpdateParams) MarshalJSON() (data []byte, err error) { @@ -280,8 +280,8 @@ type RuleListParams struct { } type RuleDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RuleDeleteParams) MarshalJSON() (data []byte, err error) { @@ -332,8 +332,8 @@ func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { } type RuleEditParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RuleEditParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_network_monitoring/rule_test.go b/magic_network_monitoring/rule_test.go index 43de8a215a5..711b273f820 100644 --- a/magic_network_monitoring/rule_test.go +++ b/magic_network_monitoring/rule_test.go @@ -30,7 +30,7 @@ func TestRuleNew(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Rules.New(context.TODO(), magic_network_monitoring.RuleNewParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -57,7 +57,7 @@ func TestRuleUpdate(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Rules.Update(context.TODO(), magic_network_monitoring.RuleUpdateParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -113,7 +113,7 @@ func TestRuleDelete(t *testing.T) { "2890e6fa406311ed9b5a23f70f6fb8cf", magic_network_monitoring.RuleDeleteParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -144,7 +144,7 @@ func TestRuleEdit(t *testing.T) { "2890e6fa406311ed9b5a23f70f6fb8cf", magic_network_monitoring.RuleEditParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_network_monitoring/ruleadvertisement.go b/magic_network_monitoring/ruleadvertisement.go index 433c907285a..a3ccf7f6bf9 100644 --- a/magic_network_monitoring/ruleadvertisement.go +++ b/magic_network_monitoring/ruleadvertisement.go @@ -69,8 +69,8 @@ func (r advertisementJSON) RawJSON() string { } type RuleAdvertisementEditParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RuleAdvertisementEditParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_network_monitoring/ruleadvertisement_test.go b/magic_network_monitoring/ruleadvertisement_test.go index 4f59af57180..dfe6f09bd81 100644 --- a/magic_network_monitoring/ruleadvertisement_test.go +++ b/magic_network_monitoring/ruleadvertisement_test.go @@ -33,7 +33,7 @@ func TestRuleAdvertisementEdit(t *testing.T) { "2890e6fa406311ed9b5a23f70f6fb8cf", magic_network_monitoring.RuleAdvertisementEditParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/aliases.go b/magic_transit/aliases.go index e7040bacdd9..90130181ba8 100644 --- a/magic_transit/aliases.go +++ b/magic_transit/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/magic_transit/gretunnel.go b/magic_transit/gretunnel.go index 881693e495e..7e522ece0e5 100644 --- a/magic_transit/gretunnel.go +++ b/magic_transit/gretunnel.go @@ -321,8 +321,8 @@ func (r greTunnelGetResponseJSON) RawJSON() string { type GRETunnelNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GRETunnelNewParams) MarshalJSON() (data []byte, err error) { @@ -493,8 +493,8 @@ func (r GRETunnelListResponseEnvelopeSuccess) IsKnown() bool { type GRETunnelDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GRETunnelDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/gretunnel_test.go b/magic_transit/gretunnel_test.go index 229efcbc355..6a371ab264c 100644 --- a/magic_transit/gretunnel_test.go +++ b/magic_transit/gretunnel_test.go @@ -30,7 +30,7 @@ func TestGRETunnelNew(t *testing.T) { ) _, err := client.MagicTransit.GRETunnels.New(context.TODO(), magic_transit.GRETunnelNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -130,7 +130,7 @@ func TestGRETunnelDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.GRETunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/ipsectunnel.go b/magic_transit/ipsectunnel.go index 32656383f09..b4ad8a1344c 100644 --- a/magic_transit/ipsectunnel.go +++ b/magic_transit/ipsectunnel.go @@ -656,8 +656,8 @@ func (r IPSECTunnelListResponseEnvelopeSuccess) IsKnown() bool { type IPSECTunnelDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r IPSECTunnelDeleteParams) MarshalJSON() (data []byte, err error) { @@ -757,8 +757,8 @@ func (r IPSECTunnelGetResponseEnvelopeSuccess) IsKnown() bool { type IPSECTunnelPSKGenerateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r IPSECTunnelPSKGenerateParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/ipsectunnel_test.go b/magic_transit/ipsectunnel_test.go index 8d8888a2d07..19f1400326a 100644 --- a/magic_transit/ipsectunnel_test.go +++ b/magic_transit/ipsectunnel_test.go @@ -143,7 +143,7 @@ func TestIPSECTunnelDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -204,7 +204,7 @@ func TestIPSECTunnelPSKGenerate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelPSKGenerateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/route.go b/magic_transit/route.go index 937d1960c83..084e65dd669 100644 --- a/magic_transit/route.go +++ b/magic_transit/route.go @@ -383,8 +383,8 @@ func (r routeGetResponseJSON) RawJSON() string { type RouteNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RouteNewParams) MarshalJSON() (data []byte, err error) { @@ -548,8 +548,8 @@ func (r RouteListResponseEnvelopeSuccess) IsKnown() bool { type RouteDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r RouteDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/route_test.go b/magic_transit/route_test.go index a19c82eb004..79b5fd193e8 100644 --- a/magic_transit/route_test.go +++ b/magic_transit/route_test.go @@ -30,7 +30,7 @@ func TestRouteNew(t *testing.T) { ) _, err := client.MagicTransit.Routes.New(context.TODO(), magic_transit.RouteNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -125,7 +125,7 @@ func TestRouteDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.RouteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/site.go b/magic_transit/site.go index 011d7fca4ea..9afad017e40 100644 --- a/magic_transit/site.go +++ b/magic_transit/site.go @@ -488,8 +488,8 @@ func (r SiteListResponseEnvelopeSuccess) IsKnown() bool { type SiteDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r SiteDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/site_test.go b/magic_transit/site_test.go index dc761dd56dc..6de303b55db 100644 --- a/magic_transit/site_test.go +++ b/magic_transit/site_test.go @@ -137,7 +137,7 @@ func TestSiteDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/siteacl.go b/magic_transit/siteacl.go index ee406dc51d6..eaced8a3a61 100644 --- a/magic_transit/siteacl.go +++ b/magic_transit/siteacl.go @@ -138,6 +138,26 @@ func (r aclJSON) RawJSON() string { return r.raw } +// Bidirectional ACL policy for network traffic within a site. +type ACLParam struct { + // Description for the ACL. + Description param.Field[string] `json:"description"` + // The desired forwarding action for this ACL policy. If set to "false", the policy + // will forward traffic to Cloudflare. If set to "true", the policy will forward + // traffic locally on the Magic WAN Connector. If not included in request, will + // default to false. + ForwardLocally param.Field[bool] `json:"forward_locally"` + LAN1 param.Field[ACLConfigurationParam] `json:"lan_1"` + LAN2 param.Field[ACLConfigurationParam] `json:"lan_2"` + // The name of the ACL. + Name param.Field[string] `json:"name"` + Protocols param.Field[[]UnnamedSchemaRef87fa9e5fe9f6b8d607be1df57340d916] `json:"protocols"` +} + +func (r ACLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type ACLConfiguration struct { // The identifier for the LAN you want to create an ACL policy with. LANID string `json:"lan_id,required"` @@ -539,8 +559,8 @@ func (r SiteACLListResponseEnvelopeSuccess) IsKnown() bool { type SiteACLDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r SiteACLDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/siteacl_test.go b/magic_transit/siteacl_test.go index 48a2cf2d207..b09d1b8a675 100644 --- a/magic_transit/siteacl_test.go +++ b/magic_transit/siteacl_test.go @@ -162,7 +162,7 @@ func TestSiteACLDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/sitelan.go b/magic_transit/sitelan.go index e5ce7b5a04d..219802b42ee 100644 --- a/magic_transit/sitelan.go +++ b/magic_transit/sitelan.go @@ -637,8 +637,8 @@ func (r SiteLANListResponseEnvelopeSuccess) IsKnown() bool { type SiteLANDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r SiteLANDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/sitelan_test.go b/magic_transit/sitelan_test.go index ef35bd8148e..da69bd311e6 100644 --- a/magic_transit/sitelan_test.go +++ b/magic_transit/sitelan_test.go @@ -214,7 +214,7 @@ func TestSiteLANDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/magic_transit/sitewan.go b/magic_transit/sitewan.go index 8e25b29c6dc..7960714ecb0 100644 --- a/magic_transit/sitewan.go +++ b/magic_transit/sitewan.go @@ -472,8 +472,8 @@ func (r SiteWANListResponseEnvelopeSuccess) IsKnown() bool { type SiteWANDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r SiteWANDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/magic_transit/sitewan_test.go b/magic_transit/sitewan_test.go index efbc8b9e2fe..2f34eff3512 100644 --- a/magic_transit/sitewan_test.go +++ b/magic_transit/sitewan_test.go @@ -147,7 +147,7 @@ func TestSiteWANDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/managed_headers/aliases.go b/managed_headers/aliases.go index 34e140fc9c7..3db2fffc7b5 100644 --- a/managed_headers/aliases.go +++ b/managed_headers/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/memberships/aliases.go b/memberships/aliases.go index 9f9ead2314c..68f5a497da9 100644 --- a/memberships/aliases.go +++ b/memberships/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/memberships/membership.go b/memberships/membership.go index 90067c4061a..4f013e531dd 100644 --- a/memberships/membership.go +++ b/memberships/membership.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/accounts" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,6 +17,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // MembershipService contains methods and other services that help with interacting @@ -36,7 +38,7 @@ func NewMembershipService(opts ...option.RequestOption) (r *MembershipService) { } // Accept or reject this account invitation. -func (r *MembershipService) Update(ctx context.Context, membershipID string, body MembershipUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *MembershipService) Update(ctx context.Context, membershipID string, body MembershipUpdateParams, opts ...option.RequestOption) (res *MembershipUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env MembershipUpdateResponseEnvelope path := fmt.Sprintf("memberships/%s", membershipID) @@ -85,7 +87,7 @@ func (r *MembershipService) Delete(ctx context.Context, membershipID string, bod } // Get a specific membership. -func (r *MembershipService) Get(ctx context.Context, membershipID string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *MembershipService) Get(ctx context.Context, membershipID string, opts ...option.RequestOption) (res *MembershipGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env MembershipGetResponseEnvelope path := fmt.Sprintf("memberships/%s", membershipID) @@ -197,6 +199,23 @@ func (r MembershipStatus) IsKnown() bool { return false } +// Union satisfied by [memberships.MembershipUpdateResponseUnknown] or +// [shared.UnionString]. +type MembershipUpdateResponseUnion interface { + ImplementsMembershipsMembershipUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*MembershipUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type MembershipDeleteResponse struct { // Membership identifier tag. ID string `json:"id"` @@ -219,6 +238,23 @@ func (r membershipDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [memberships.MembershipGetResponseUnknown] or +// [shared.UnionString]. +type MembershipGetResponseUnion interface { + ImplementsMembershipsMembershipGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*MembershipGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type MembershipUpdateParams struct { // Whether to accept or reject this account invitation. Status param.Field[MembershipUpdateParamsStatus] `json:"status,required"` @@ -245,9 +281,9 @@ func (r MembershipUpdateParamsStatus) IsKnown() bool { } type MembershipUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result MembershipUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success MembershipUpdateResponseEnvelopeSuccess `json:"success,required"` JSON membershipUpdateResponseEnvelopeJSON `json:"-"` @@ -376,7 +412,7 @@ func (r MembershipListParamsStatus) IsKnown() bool { } type MembershipDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r MembershipDeleteParams) MarshalJSON() (data []byte, err error) { @@ -427,9 +463,9 @@ func (r MembershipDeleteResponseEnvelopeSuccess) IsKnown() bool { } type MembershipGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result MembershipGetResponseUnion `json:"result,required"` // Whether the API call was successful Success MembershipGetResponseEnvelopeSuccess `json:"success,required"` JSON membershipGetResponseEnvelopeJSON `json:"-"` diff --git a/memberships/membership_test.go b/memberships/membership_test.go index 9c31fcbd51b..cd5c30699ea 100644 --- a/memberships/membership_test.go +++ b/memberships/membership_test.go @@ -96,7 +96,7 @@ func TestMembershipDelete(t *testing.T) { context.TODO(), "4536bcfad5faccb111b47003c79917fa", memberships.MembershipDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/mtls_certificates/aliases.go b/mtls_certificates/aliases.go index 46fae157a2c..8b75202b8ba 100644 --- a/mtls_certificates/aliases.go +++ b/mtls_certificates/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/mtls_certificates/mtlscertificate.go b/mtls_certificates/mtlscertificate.go index a5f96825f0b..f6edb7beb2a 100644 --- a/mtls_certificates/mtlscertificate.go +++ b/mtls_certificates/mtlscertificate.go @@ -260,8 +260,8 @@ type MTLSCertificateListParams struct { type MTLSCertificateDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r MTLSCertificateDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/mtls_certificates/mtlscertificate_test.go b/mtls_certificates/mtlscertificate_test.go index b4b3f746fff..339b113e186 100644 --- a/mtls_certificates/mtlscertificate_test.go +++ b/mtls_certificates/mtlscertificate_test.go @@ -89,7 +89,7 @@ func TestMTLSCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", mtls_certificates.MTLSCertificateDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/origin_ca_certificates/aliases.go b/origin_ca_certificates/aliases.go index 35c53f1d6e8..7ff69ba79de 100644 --- a/origin_ca_certificates/aliases.go +++ b/origin_ca_certificates/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/origin_ca_certificates/origincacertificate.go b/origin_ca_certificates/origincacertificate.go index 9ebcdaa3507..53660efd004 100644 --- a/origin_ca_certificates/origincacertificate.go +++ b/origin_ca_certificates/origincacertificate.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,6 +17,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // OriginCACertificateService contains methods and other services that help with @@ -38,7 +40,7 @@ func NewOriginCACertificateService(opts ...option.RequestOption) (r *OriginCACer // Create an Origin CA certificate. Use your Origin CA Key as your User Service Key // when calling this endpoint ([see above](#requests)). -func (r *OriginCACertificateService) New(ctx context.Context, body OriginCACertificateNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginCACertificateService) New(ctx context.Context, body OriginCACertificateNewParams, opts ...option.RequestOption) (res *OriginCACertificateNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginCACertificateNewResponseEnvelope path := "certificates" @@ -95,7 +97,7 @@ func (r *OriginCACertificateService) Delete(ctx context.Context, certificateID s // Get an existing Origin CA certificate by its serial number. Use your Origin CA // Key as your User Service Key when calling this endpoint // ([see above](#requests)). -func (r *OriginCACertificateService) Get(ctx context.Context, certificateID string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginCACertificateService) Get(ctx context.Context, certificateID string, opts ...option.RequestOption) (res *OriginCACertificateGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginCACertificateGetResponseEnvelope path := fmt.Sprintf("certificates/%s", certificateID) @@ -188,6 +190,24 @@ func (r OriginCACertificateRequestedValidity) IsKnown() bool { return false } +// Union satisfied by +// [origin_ca_certificates.OriginCACertificateNewResponseUnknown] or +// [shared.UnionString]. +type OriginCACertificateNewResponseUnion interface { + ImplementsOriginCACertificatesOriginCACertificateNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginCACertificateNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type OriginCACertificateDeleteResponse struct { // Identifier ID string `json:"id"` @@ -210,6 +230,24 @@ func (r originCACertificateDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by +// [origin_ca_certificates.OriginCACertificateGetResponseUnknown] or +// [shared.UnionString]. +type OriginCACertificateGetResponseUnion interface { + ImplementsOriginCACertificatesOriginCACertificateGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginCACertificateGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type OriginCACertificateNewParams struct { // The Certificate Signing Request (CSR). Must be newline-encoded. Csr param.Field[string] `json:"csr"` @@ -267,9 +305,9 @@ func (r OriginCACertificateNewParamsRequestedValidity) IsKnown() bool { } type OriginCACertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginCACertificateNewResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginCACertificateNewResponseEnvelopeSuccess `json:"success,required"` JSON originCACertificateNewResponseEnvelopeJSON `json:"-"` @@ -324,7 +362,7 @@ func (r OriginCACertificateListParams) URLQuery() (v url.Values) { } type OriginCACertificateDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r OriginCACertificateDeleteParams) MarshalJSON() (data []byte, err error) { @@ -375,9 +413,9 @@ func (r OriginCACertificateDeleteResponseEnvelopeSuccess) IsKnown() bool { } type OriginCACertificateGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginCACertificateGetResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginCACertificateGetResponseEnvelopeSuccess `json:"success,required"` JSON originCACertificateGetResponseEnvelopeJSON `json:"-"` diff --git a/origin_ca_certificates/origincacertificate_test.go b/origin_ca_certificates/origincacertificate_test.go index b1452e2d76f..d9697157fb1 100644 --- a/origin_ca_certificates/origincacertificate_test.go +++ b/origin_ca_certificates/origincacertificate_test.go @@ -87,7 +87,7 @@ func TestOriginCACertificateDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", origin_ca_certificates.OriginCACertificateDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/origin_post_quantum_encryption/aliases.go b/origin_post_quantum_encryption/aliases.go index 3c3cae30b58..d46b926f6eb 100644 --- a/origin_post_quantum_encryption/aliases.go +++ b/origin_post_quantum_encryption/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/origin_post_quantum_encryption/originpostquantumencryption.go b/origin_post_quantum_encryption/originpostquantumencryption.go index 18eaeeb2567..19f69f1f495 100644 --- a/origin_post_quantum_encryption/originpostquantumencryption.go +++ b/origin_post_quantum_encryption/originpostquantumencryption.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // OriginPostQuantumEncryptionService contains methods and other services that help @@ -38,7 +40,7 @@ func NewOriginPostQuantumEncryptionService(opts ...option.RequestOption) (r *Ori // connections when the origin supports and prefers PQ), supported means that PQ // algorithms are advertised but only used when requested by the origin, and off // means that PQ algorithms are not advertised -func (r *OriginPostQuantumEncryptionService) Update(ctx context.Context, params OriginPostQuantumEncryptionUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginPostQuantumEncryptionService) Update(ctx context.Context, params OriginPostQuantumEncryptionUpdateParams, opts ...option.RequestOption) (res *OriginPostQuantumEncryptionUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginPostQuantumEncryptionUpdateResponseEnvelope path := fmt.Sprintf("zones/%s/cache/origin_post_quantum_encryption", params.ZoneID) @@ -56,7 +58,7 @@ func (r *OriginPostQuantumEncryptionService) Update(ctx context.Context, params // connections when the origin supports and prefers PQ), supported means that PQ // algorithms are advertised but only used when requested by the origin, and off // means that PQ algorithms are not advertised -func (r *OriginPostQuantumEncryptionService) Get(ctx context.Context, query OriginPostQuantumEncryptionGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginPostQuantumEncryptionService) Get(ctx context.Context, query OriginPostQuantumEncryptionGetParams, opts ...option.RequestOption) (res *OriginPostQuantumEncryptionGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginPostQuantumEncryptionGetResponseEnvelope path := fmt.Sprintf("zones/%s/cache/origin_post_quantum_encryption", query.ZoneID) @@ -68,6 +70,42 @@ func (r *OriginPostQuantumEncryptionService) Get(ctx context.Context, query Orig return } +// Union satisfied by +// [origin_post_quantum_encryption.OriginPostQuantumEncryptionUpdateResponseUnknown] +// or [shared.UnionString]. +type OriginPostQuantumEncryptionUpdateResponseUnion interface { + ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncryptionUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginPostQuantumEncryptionUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by +// [origin_post_quantum_encryption.OriginPostQuantumEncryptionGetResponseUnknown] +// or [shared.UnionString]. +type OriginPostQuantumEncryptionGetResponseUnion interface { + ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncryptionGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginPostQuantumEncryptionGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type OriginPostQuantumEncryptionUpdateParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -97,9 +135,9 @@ func (r OriginPostQuantumEncryptionUpdateParamsValue) IsKnown() bool { } type OriginPostQuantumEncryptionUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginPostQuantumEncryptionUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginPostQuantumEncryptionUpdateResponseEnvelopeSuccess `json:"success,required"` JSON originPostQuantumEncryptionUpdateResponseEnvelopeJSON `json:"-"` @@ -145,9 +183,9 @@ type OriginPostQuantumEncryptionGetParams struct { } type OriginPostQuantumEncryptionGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginPostQuantumEncryptionGetResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginPostQuantumEncryptionGetResponseEnvelopeSuccess `json:"success,required"` JSON originPostQuantumEncryptionGetResponseEnvelopeJSON `json:"-"` diff --git a/origin_tls_client_auth/aliases.go b/origin_tls_client_auth/aliases.go index f3e5bc81e10..1f15a8f440b 100644 --- a/origin_tls_client_auth/aliases.go +++ b/origin_tls_client_auth/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/origin_tls_client_auth/hostnamecertificate.go b/origin_tls_client_auth/hostnamecertificate.go index b0944daf136..b375299cb70 100644 --- a/origin_tls_client_auth/hostnamecertificate.go +++ b/origin_tls_client_auth/hostnamecertificate.go @@ -223,8 +223,8 @@ type HostnameCertificateListParams struct { type HostnameCertificateDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r HostnameCertificateDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/origin_tls_client_auth/hostnamecertificate_test.go b/origin_tls_client_auth/hostnamecertificate_test.go index fdbc6a4af14..28868c3714f 100644 --- a/origin_tls_client_auth/hostnamecertificate_test.go +++ b/origin_tls_client_auth/hostnamecertificate_test.go @@ -87,7 +87,7 @@ func TestHostnameCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", origin_tls_client_auth.HostnameCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/origin_tls_client_auth/origintlsclientauth.go b/origin_tls_client_auth/origintlsclientauth.go index 3808e4dfeb4..a98b0602fc1 100644 --- a/origin_tls_client_auth/origintlsclientauth.go +++ b/origin_tls_client_auth/origintlsclientauth.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // OriginTLSClientAuthService contains methods and other services that help with @@ -42,7 +44,7 @@ func NewOriginTLSClientAuthService(opts ...option.RequestOption) (r *OriginTLSCl // important to keep only one certificate active. Also, make sure to enable // zone-level authenticated origin pulls by making a PUT call to settings endpoint // to see the uploaded certificate in use. -func (r *OriginTLSClientAuthService) New(ctx context.Context, params OriginTLSClientAuthNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginTLSClientAuthService) New(ctx context.Context, params OriginTLSClientAuthNewParams, opts ...option.RequestOption) (res *OriginTLSClientAuthNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginTLSClientAuthNewResponseEnvelope path := fmt.Sprintf("zones/%s/origin_tls_client_auth", params.ZoneID) @@ -78,7 +80,7 @@ func (r *OriginTLSClientAuthService) ListAutoPaging(ctx context.Context, query O } // Delete Certificate -func (r *OriginTLSClientAuthService) Delete(ctx context.Context, certificateID string, params OriginTLSClientAuthDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginTLSClientAuthService) Delete(ctx context.Context, certificateID string, params OriginTLSClientAuthDeleteParams, opts ...option.RequestOption) (res *OriginTLSClientAuthDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginTLSClientAuthDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", params.ZoneID, certificateID) @@ -91,7 +93,7 @@ func (r *OriginTLSClientAuthService) Delete(ctx context.Context, certificateID s } // Get Certificate Details -func (r *OriginTLSClientAuthService) Get(ctx context.Context, certificateID string, query OriginTLSClientAuthGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OriginTLSClientAuthService) Get(ctx context.Context, certificateID string, query OriginTLSClientAuthGetParams, opts ...option.RequestOption) (res *OriginTLSClientAuthGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginTLSClientAuthGetResponseEnvelope path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", query.ZoneID, certificateID) @@ -134,6 +136,60 @@ func (r zoneAuthenticatedOriginPullJSON) RawJSON() string { return r.raw } +// Union satisfied by +// [origin_tls_client_auth.OriginTLSClientAuthNewResponseUnknown] or +// [shared.UnionString]. +type OriginTLSClientAuthNewResponseUnion interface { + ImplementsOriginTLSClientAuthOriginTLSClientAuthNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginTLSClientAuthNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by +// [origin_tls_client_auth.OriginTLSClientAuthDeleteResponseUnknown] or +// [shared.UnionString]. +type OriginTLSClientAuthDeleteResponseUnion interface { + ImplementsOriginTLSClientAuthOriginTLSClientAuthDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginTLSClientAuthDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by +// [origin_tls_client_auth.OriginTLSClientAuthGetResponseUnknown] or +// [shared.UnionString]. +type OriginTLSClientAuthGetResponseUnion interface { + ImplementsOriginTLSClientAuthOriginTLSClientAuthGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OriginTLSClientAuthGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type OriginTLSClientAuthNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -148,9 +204,9 @@ func (r OriginTLSClientAuthNewParams) MarshalJSON() (data []byte, err error) { } type OriginTLSClientAuthNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginTLSClientAuthNewResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginTLSClientAuthNewResponseEnvelopeSuccess `json:"success,required"` JSON originTLSClientAuthNewResponseEnvelopeJSON `json:"-"` @@ -197,8 +253,8 @@ type OriginTLSClientAuthListParams struct { type OriginTLSClientAuthDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r OriginTLSClientAuthDeleteParams) MarshalJSON() (data []byte, err error) { @@ -206,9 +262,9 @@ func (r OriginTLSClientAuthDeleteParams) MarshalJSON() (data []byte, err error) } type OriginTLSClientAuthDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginTLSClientAuthDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginTLSClientAuthDeleteResponseEnvelopeSuccess `json:"success,required"` JSON originTLSClientAuthDeleteResponseEnvelopeJSON `json:"-"` @@ -254,9 +310,9 @@ type OriginTLSClientAuthGetParams struct { } type OriginTLSClientAuthGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OriginTLSClientAuthGetResponseUnion `json:"result,required"` // Whether the API call was successful Success OriginTLSClientAuthGetResponseEnvelopeSuccess `json:"success,required"` JSON originTLSClientAuthGetResponseEnvelopeJSON `json:"-"` diff --git a/origin_tls_client_auth/origintlsclientauth_test.go b/origin_tls_client_auth/origintlsclientauth_test.go index c4fed90599a..a35d31223c1 100644 --- a/origin_tls_client_auth/origintlsclientauth_test.go +++ b/origin_tls_client_auth/origintlsclientauth_test.go @@ -87,7 +87,7 @@ func TestOriginTLSClientAuthDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", origin_tls_client_auth.OriginTLSClientAuthDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/page_shield/aliases.go b/page_shield/aliases.go index 0aa56eb951e..2de0fed1ec8 100644 --- a/page_shield/aliases.go +++ b/page_shield/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/pagerules/aliases.go b/pagerules/aliases.go index c356a631835..6c28a3932d5 100644 --- a/pagerules/aliases.go +++ b/pagerules/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/pagerules/pagerule.go b/pagerules/pagerule.go index fbe2e5d3e4c..3a7b042993a 100644 --- a/pagerules/pagerule.go +++ b/pagerules/pagerule.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // PageruleService contains methods and other services that help with interacting @@ -37,7 +39,7 @@ func NewPageruleService(opts ...option.RequestOption) (r *PageruleService) { } // Creates a new Page Rule. -func (r *PageruleService) New(ctx context.Context, params PageruleNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *PageruleService) New(ctx context.Context, params PageruleNewParams, opts ...option.RequestOption) (res *PageruleNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env PageruleNewResponseEnvelope path := fmt.Sprintf("zones/%s/pagerules", params.ZoneID) @@ -51,7 +53,7 @@ func (r *PageruleService) New(ctx context.Context, params PageruleNewParams, opt // Replaces the configuration of an existing Page Rule. The configuration of the // updated Page Rule will exactly match the data passed in the API request. -func (r *PageruleService) Update(ctx context.Context, pageruleID string, params PageruleUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *PageruleService) Update(ctx context.Context, pageruleID string, params PageruleUpdateParams, opts ...option.RequestOption) (res *PageruleUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env PageruleUpdateResponseEnvelope path := fmt.Sprintf("zones/%s/pagerules/%s", params.ZoneID, pageruleID) @@ -90,7 +92,7 @@ func (r *PageruleService) Delete(ctx context.Context, pageruleID string, params } // Updates one or more fields of an existing Page Rule. -func (r *PageruleService) Edit(ctx context.Context, pageruleID string, params PageruleEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *PageruleService) Edit(ctx context.Context, pageruleID string, params PageruleEditParams, opts ...option.RequestOption) (res *PageruleEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env PageruleEditResponseEnvelope path := fmt.Sprintf("zones/%s/pagerules/%s", params.ZoneID, pageruleID) @@ -103,7 +105,7 @@ func (r *PageruleService) Edit(ctx context.Context, pageruleID string, params Pa } // Fetches the details of a Page Rule. -func (r *PageruleService) Get(ctx context.Context, pageruleID string, query PageruleGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *PageruleService) Get(ctx context.Context, pageruleID string, query PageruleGetParams, opts ...option.RequestOption) (res *PageruleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env PageruleGetResponseEnvelope path := fmt.Sprintf("zones/%s/pagerules/%s", query.ZoneID, pageruleID) @@ -390,6 +392,40 @@ func (r TargesConstraintParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Union satisfied by [pagerules.PageruleNewResponseUnknown] or +// [shared.UnionString]. +type PageruleNewResponseUnion interface { + ImplementsPagerulesPageruleNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*PageruleNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [pagerules.PageruleUpdateResponseUnknown] or +// [shared.UnionString]. +type PageruleUpdateResponseUnion interface { + ImplementsPagerulesPageruleUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*PageruleUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type PageruleDeleteResponse struct { // Identifier ID string `json:"id,required"` @@ -412,6 +448,40 @@ func (r pageruleDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [pagerules.PageruleEditResponseUnknown] or +// [shared.UnionString]. +type PageruleEditResponseUnion interface { + ImplementsPagerulesPageruleEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*PageruleEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [pagerules.PageruleGetResponseUnknown] or +// [shared.UnionString]. +type PageruleGetResponseUnion interface { + ImplementsPagerulesPageruleGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*PageruleGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type PageruleNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -451,9 +521,9 @@ func (r PageruleNewParamsStatus) IsKnown() bool { } type PageruleNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result PageruleNewResponseUnion `json:"result,required"` // Whether the API call was successful Success PageruleNewResponseEnvelopeSuccess `json:"success,required"` JSON pageruleNewResponseEnvelopeJSON `json:"-"` @@ -532,9 +602,9 @@ func (r PageruleUpdateParamsStatus) IsKnown() bool { } type PageruleUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result PageruleUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success PageruleUpdateResponseEnvelopeSuccess `json:"success,required"` JSON pageruleUpdateResponseEnvelopeJSON `json:"-"` @@ -706,8 +776,8 @@ func (r PageruleListResponseEnvelopeSuccess) IsKnown() bool { type PageruleDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r PageruleDeleteParams) MarshalJSON() (data []byte, err error) { @@ -796,9 +866,9 @@ func (r PageruleEditParamsStatus) IsKnown() bool { } type PageruleEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result PageruleEditResponseUnion `json:"result,required"` // Whether the API call was successful Success PageruleEditResponseEnvelopeSuccess `json:"success,required"` JSON pageruleEditResponseEnvelopeJSON `json:"-"` @@ -844,9 +914,9 @@ type PageruleGetParams struct { } type PageruleGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result PageruleGetResponseUnion `json:"result,required"` // Whether the API call was successful Success PageruleGetResponseEnvelopeSuccess `json:"success,required"` JSON pageruleGetResponseEnvelopeJSON `json:"-"` diff --git a/pagerules/pagerule_test.go b/pagerules/pagerule_test.go index ee2883d729f..59734c63a3e 100644 --- a/pagerules/pagerule_test.go +++ b/pagerules/pagerule_test.go @@ -151,7 +151,7 @@ func TestPageruleDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pagerules.PageruleDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/pages/aliases.go b/pages/aliases.go index daf756f12c5..84c3a2399f3 100644 --- a/pages/aliases.go +++ b/pages/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/pages/project.go b/pages/project.go index e9308d3a3ee..39d97451126 100644 --- a/pages/project.go +++ b/pages/project.go @@ -1763,122 +1763,25 @@ func (r projectDeploymentConfigsProductionVectorizeBindingsVectorizeJSON) RawJSO return r.raw } -// The status of the deployment. -type Stage struct { - // When the stage ended. - EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` - // The current build stage. - Name string `json:"name"` - // When the stage started. - StartedOn time.Time `json:"started_on,nullable" format:"date-time"` - // State of the current stage. - Status string `json:"status"` - JSON stageJSON `json:"-"` -} - -// stageJSON contains the JSON metadata for the struct [Stage] -type stageJSON struct { - EndedOn apijson.Field - Name apijson.Field - StartedOn apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Stage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r stageJSON) RawJSON() string { - return r.raw -} - -// The status of the deployment. -type StageParam struct { - // The current build stage. - Name param.Field[string] `json:"name"` -} - -func (r StageParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Union satisfied by [pages.ProjectNewResponseUnknown], -// [pages.ProjectNewResponseArray] or [shared.UnionString]. -type ProjectNewResponseUnion interface { - ImplementsPagesProjectNewResponseUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectNewResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type ProjectNewResponseArray []interface{} - -func (r ProjectNewResponseArray) ImplementsPagesProjectNewResponseUnion() {} - -type ProjectDeleteResponse = interface{} - -// Union satisfied by [pages.ProjectEditResponseUnknown], -// [pages.ProjectEditResponseArray] or [shared.UnionString]. -type ProjectEditResponseUnion interface { - ImplementsPagesProjectEditResponseUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectEditResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectEditResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type ProjectEditResponseArray []interface{} - -func (r ProjectEditResponseArray) ImplementsPagesProjectEditResponseUnion() {} - -type ProjectPurgeBuildCacheResponse = interface{} - -type ProjectNewParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` +type ProjectParam struct { // Configs for the project build process. - BuildConfig param.Field[ProjectNewParamsBuildConfig] `json:"build_config"` - CanonicalDeployment param.Field[DeploymentParam] `json:"canonical_deployment"` + BuildConfig param.Field[ProjectBuildConfigParam] `json:"build_config"` + CanonicalDeployment param.Field[DeploymentParam] `json:"canonical_deployment"` // Configs for deployments in a project. - DeploymentConfigs param.Field[ProjectNewParamsDeploymentConfigs] `json:"deployment_configs"` - LatestDeployment param.Field[DeploymentParam] `json:"latest_deployment"` + DeploymentConfigs param.Field[ProjectDeploymentConfigsParam] `json:"deployment_configs"` + LatestDeployment param.Field[DeploymentParam] `json:"latest_deployment"` // Name of the project. Name param.Field[string] `json:"name"` // Production branch of the project. Used to identify production deployments. ProductionBranch param.Field[string] `json:"production_branch"` } -func (r ProjectNewParams) MarshalJSON() (data []byte, err error) { +func (r ProjectParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Configs for the project build process. -type ProjectNewParamsBuildConfig struct { +type ProjectBuildConfigParam struct { // Enable build caching for the project. BuildCaching param.Field[bool] `json:"build_caching"` // Command used to build project. @@ -1893,309 +1796,293 @@ type ProjectNewParamsBuildConfig struct { WebAnalyticsToken param.Field[string] `json:"web_analytics_token"` } -func (r ProjectNewParamsBuildConfig) MarshalJSON() (data []byte, err error) { +func (r ProjectBuildConfigParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Configs for deployments in a project. -type ProjectNewParamsDeploymentConfigs struct { +type ProjectDeploymentConfigsParam struct { // Configs for preview deploys. - Preview param.Field[ProjectNewParamsDeploymentConfigsPreview] `json:"preview"` + Preview param.Field[ProjectDeploymentConfigsPreviewParam] `json:"preview"` // Configs for production deploys. - Production param.Field[ProjectNewParamsDeploymentConfigsProduction] `json:"production"` + Production param.Field[ProjectDeploymentConfigsProductionParam] `json:"production"` } -func (r ProjectNewParamsDeploymentConfigs) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Configs for preview deploys. -type ProjectNewParamsDeploymentConfigsPreview struct { +type ProjectDeploymentConfigsPreviewParam struct { // Constellation bindings used for Pages Functions. - AIBindings param.Field[ProjectNewParamsDeploymentConfigsPreviewAIBindings] `json:"ai_bindings"` + AIBindings param.Field[ProjectDeploymentConfigsPreviewAIBindingsParam] `json:"ai_bindings"` // Analytics Engine bindings used for Pages Functions. - AnalyticsEngineDatasets param.Field[ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasets] `json:"analytics_engine_datasets"` + AnalyticsEngineDatasets param.Field[ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsParam] `json:"analytics_engine_datasets"` // Browser bindings used for Pages Functions. - Browsers param.Field[ProjectNewParamsDeploymentConfigsPreviewBrowsers] `json:"browsers"` + Browsers param.Field[ProjectDeploymentConfigsPreviewBrowsersParam] `json:"browsers"` // Compatibility date used for Pages Functions. CompatibilityDate param.Field[string] `json:"compatibility_date"` // Compatibility flags used for Pages Functions. CompatibilityFlags param.Field[[]interface{}] `json:"compatibility_flags"` // D1 databases used for Pages Functions. - D1Databases param.Field[ProjectNewParamsDeploymentConfigsPreviewD1Databases] `json:"d1_databases"` + D1Databases param.Field[ProjectDeploymentConfigsPreviewD1DatabasesParam] `json:"d1_databases"` // Durabble Object namespaces used for Pages Functions. - DurableObjectNamespaces param.Field[ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespaces] `json:"durable_object_namespaces"` + DurableObjectNamespaces param.Field[ProjectDeploymentConfigsPreviewDurableObjectNamespacesParam] `json:"durable_object_namespaces"` // Environment variables for build configs. - EnvVars param.Field[ProjectNewParamsDeploymentConfigsPreviewEnvVars] `json:"env_vars"` + EnvVars param.Field[ProjectDeploymentConfigsPreviewEnvVarsParam] `json:"env_vars"` // Hyperdrive bindings used for Pages Functions. - HyperdriveBindings param.Field[ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindings] `json:"hyperdrive_bindings"` + HyperdriveBindings param.Field[ProjectDeploymentConfigsPreviewHyperdriveBindingsParam] `json:"hyperdrive_bindings"` // KV namespaces used for Pages Functions. - KVNamespaces param.Field[ProjectNewParamsDeploymentConfigsPreviewKVNamespaces] `json:"kv_namespaces"` + KVNamespaces param.Field[ProjectDeploymentConfigsPreviewKVNamespacesParam] `json:"kv_namespaces"` // mTLS bindings used for Pages Functions. - MTLSCertificates param.Field[ProjectNewParamsDeploymentConfigsPreviewMTLSCertificates] `json:"mtls_certificates"` + MTLSCertificates param.Field[ProjectDeploymentConfigsPreviewMTLSCertificatesParam] `json:"mtls_certificates"` // Placement setting used for Pages Functions. - Placement param.Field[ProjectNewParamsDeploymentConfigsPreviewPlacement] `json:"placement"` + Placement param.Field[ProjectDeploymentConfigsPreviewPlacementParam] `json:"placement"` // Queue Producer bindings used for Pages Functions. - QueueProducers param.Field[ProjectNewParamsDeploymentConfigsPreviewQueueProducers] `json:"queue_producers"` + QueueProducers param.Field[ProjectDeploymentConfigsPreviewQueueProducersParam] `json:"queue_producers"` // R2 buckets used for Pages Functions. - R2Buckets param.Field[ProjectNewParamsDeploymentConfigsPreviewR2Buckets] `json:"r2_buckets"` + R2Buckets param.Field[ProjectDeploymentConfigsPreviewR2BucketsParam] `json:"r2_buckets"` // Services used for Pages Functions. - Services param.Field[ProjectNewParamsDeploymentConfigsPreviewServices] `json:"services"` + Services param.Field[ProjectDeploymentConfigsPreviewServicesParam] `json:"services"` // Vectorize bindings used for Pages Functions. - VectorizeBindings param.Field[ProjectNewParamsDeploymentConfigsPreviewVectorizeBindings] `json:"vectorize_bindings"` + VectorizeBindings param.Field[ProjectDeploymentConfigsPreviewVectorizeBindingsParam] `json:"vectorize_bindings"` } -func (r ProjectNewParamsDeploymentConfigsPreview) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Constellation bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewAIBindings struct { +type ProjectDeploymentConfigsPreviewAIBindingsParam struct { // AI binding. - AIBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewAIBindingsAIBinding] `json:"AI_BINDING"` + AIBinding param.Field[ProjectDeploymentConfigsPreviewAIBindingsAIBindingParam] `json:"AI_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewAIBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewAIBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // AI binding. -type ProjectNewParamsDeploymentConfigsPreviewAIBindingsAIBinding struct { +type ProjectDeploymentConfigsPreviewAIBindingsAIBindingParam struct { ProjectID param.Field[interface{}] `json:"project_id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewAIBindingsAIBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewAIBindingsAIBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Analytics Engine bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasets struct { +type ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsParam struct { // Analytics Engine binding. - AnalyticsEngineBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding] `json:"ANALYTICS_ENGINE_BINDING"` + AnalyticsEngineBinding param.Field[ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingParam] `json:"ANALYTICS_ENGINE_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasets) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Analytics Engine binding. -type ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding struct { +type ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingParam struct { // Name of the dataset. Dataset param.Field[string] `json:"dataset"` } -func (r ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Browser bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewBrowsers struct { +type ProjectDeploymentConfigsPreviewBrowsersParam struct { // Browser binding. Browser param.Field[interface{}] `json:"BROWSER"` } -func (r ProjectNewParamsDeploymentConfigsPreviewBrowsers) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewBrowsersParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // D1 databases used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewD1Databases struct { +type ProjectDeploymentConfigsPreviewD1DatabasesParam struct { // D1 binding. - D1Binding param.Field[ProjectNewParamsDeploymentConfigsPreviewD1DatabasesD1Binding] `json:"D1_BINDING"` + D1Binding param.Field[ProjectDeploymentConfigsPreviewD1DatabasesD1BindingParam] `json:"D1_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewD1Databases) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewD1DatabasesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // D1 binding. -type ProjectNewParamsDeploymentConfigsPreviewD1DatabasesD1Binding struct { +type ProjectDeploymentConfigsPreviewD1DatabasesD1BindingParam struct { // UUID of the D1 database. ID param.Field[string] `json:"id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewD1DatabasesD1Binding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewD1DatabasesD1BindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Durabble Object namespaces used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespaces struct { +type ProjectDeploymentConfigsPreviewDurableObjectNamespacesParam struct { // Durabble Object binding. - DoBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding] `json:"DO_BINDING"` + DoBinding param.Field[ProjectDeploymentConfigsPreviewDurableObjectNamespacesDoBindingParam] `json:"DO_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespaces) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewDurableObjectNamespacesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Durabble Object binding. -type ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding struct { +type ProjectDeploymentConfigsPreviewDurableObjectNamespacesDoBindingParam struct { // ID of the Durabble Object namespace. NamespaceID param.Field[string] `json:"namespace_id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewDurableObjectNamespacesDoBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Environment variables for build configs. -type ProjectNewParamsDeploymentConfigsPreviewEnvVars struct { +type ProjectDeploymentConfigsPreviewEnvVarsParam struct { // Environment variable. - EnvironmentVariable param.Field[ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable] `json:"ENVIRONMENT_VARIABLE"` + EnvironmentVariable param.Field[ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableParam] `json:"ENVIRONMENT_VARIABLE"` } -func (r ProjectNewParamsDeploymentConfigsPreviewEnvVars) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewEnvVarsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Environment variable. -type ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable struct { +type ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableParam struct { // The type of environment variable (plain text or secret) - Type param.Field[ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType] `json:"type"` + Type param.Field[ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableType] `json:"type"` // Environment variable value. Value param.Field[string] `json:"value"` } -func (r ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The type of environment variable (plain text or secret) -type ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType string - -const ( - ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "plain_text" - ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypeSecretText ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType = "secret_text" -) - -func (r ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableType) IsKnown() bool { - switch r { - case ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText, ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypeSecretText: - return true - } - return false -} - // Hyperdrive bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindings struct { +type ProjectDeploymentConfigsPreviewHyperdriveBindingsParam struct { // Hyperdrive binding. - Hyperdrive param.Field[ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindingsHyperdrive] `json:"HYPERDRIVE"` + Hyperdrive param.Field[ProjectDeploymentConfigsPreviewHyperdriveBindingsHyperdriveParam] `json:"HYPERDRIVE"` } -func (r ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewHyperdriveBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Hyperdrive binding. -type ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindingsHyperdrive struct { +type ProjectDeploymentConfigsPreviewHyperdriveBindingsHyperdriveParam struct { ID param.Field[string] `json:"id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindingsHyperdrive) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewHyperdriveBindingsHyperdriveParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // KV namespaces used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewKVNamespaces struct { +type ProjectDeploymentConfigsPreviewKVNamespacesParam struct { // KV binding. - KVBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewKVNamespacesKVBinding] `json:"KV_BINDING"` + KVBinding param.Field[ProjectDeploymentConfigsPreviewKVNamespacesKVBindingParam] `json:"KV_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewKVNamespaces) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewKVNamespacesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // KV binding. -type ProjectNewParamsDeploymentConfigsPreviewKVNamespacesKVBinding struct { +type ProjectDeploymentConfigsPreviewKVNamespacesKVBindingParam struct { // ID of the KV namespace. NamespaceID param.Field[string] `json:"namespace_id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewKVNamespacesKVBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewKVNamespacesKVBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // mTLS bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewMTLSCertificates struct { +type ProjectDeploymentConfigsPreviewMTLSCertificatesParam struct { // mTLS binding. - MTLS param.Field[ProjectNewParamsDeploymentConfigsPreviewMTLSCertificatesMTLS] `json:"MTLS"` + MTLS param.Field[ProjectDeploymentConfigsPreviewMTLSCertificatesMTLSParam] `json:"MTLS"` } -func (r ProjectNewParamsDeploymentConfigsPreviewMTLSCertificates) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewMTLSCertificatesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // mTLS binding. -type ProjectNewParamsDeploymentConfigsPreviewMTLSCertificatesMTLS struct { +type ProjectDeploymentConfigsPreviewMTLSCertificatesMTLSParam struct { CertificateID param.Field[string] `json:"certificate_id"` } -func (r ProjectNewParamsDeploymentConfigsPreviewMTLSCertificatesMTLS) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewMTLSCertificatesMTLSParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Placement setting used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewPlacement struct { +type ProjectDeploymentConfigsPreviewPlacementParam struct { // Placement mode. Mode param.Field[string] `json:"mode"` } -func (r ProjectNewParamsDeploymentConfigsPreviewPlacement) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewPlacementParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Queue Producer bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewQueueProducers struct { +type ProjectDeploymentConfigsPreviewQueueProducersParam struct { // Queue Producer binding. - QueueProducerBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding] `json:"QUEUE_PRODUCER_BINDING"` + QueueProducerBinding param.Field[ProjectDeploymentConfigsPreviewQueueProducersQueueProducerBindingParam] `json:"QUEUE_PRODUCER_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewQueueProducers) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewQueueProducersParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Queue Producer binding. -type ProjectNewParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding struct { +type ProjectDeploymentConfigsPreviewQueueProducersQueueProducerBindingParam struct { // Name of the Queue. Name param.Field[string] `json:"name"` } -func (r ProjectNewParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewQueueProducersQueueProducerBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // R2 buckets used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewR2Buckets struct { +type ProjectDeploymentConfigsPreviewR2BucketsParam struct { // R2 binding. - R2Binding param.Field[ProjectNewParamsDeploymentConfigsPreviewR2BucketsR2Binding] `json:"R2_BINDING"` + R2Binding param.Field[ProjectDeploymentConfigsPreviewR2BucketsR2BindingParam] `json:"R2_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewR2Buckets) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewR2BucketsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // R2 binding. -type ProjectNewParamsDeploymentConfigsPreviewR2BucketsR2Binding struct { +type ProjectDeploymentConfigsPreviewR2BucketsR2BindingParam struct { // Name of the R2 bucket. Name param.Field[string] `json:"name"` } -func (r ProjectNewParamsDeploymentConfigsPreviewR2BucketsR2Binding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewR2BucketsR2BindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Services used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewServices struct { +type ProjectDeploymentConfigsPreviewServicesParam struct { // Service binding. - ServiceBinding param.Field[ProjectNewParamsDeploymentConfigsPreviewServicesServiceBinding] `json:"SERVICE_BINDING"` + ServiceBinding param.Field[ProjectDeploymentConfigsPreviewServicesServiceBindingParam] `json:"SERVICE_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsPreviewServices) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewServicesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Service binding. -type ProjectNewParamsDeploymentConfigsPreviewServicesServiceBinding struct { +type ProjectDeploymentConfigsPreviewServicesServiceBindingParam struct { // The entrypoint to bind to. Entrypoint param.Field[string] `json:"entrypoint"` // The Service environment. @@ -2204,316 +2091,300 @@ type ProjectNewParamsDeploymentConfigsPreviewServicesServiceBinding struct { Service param.Field[string] `json:"service"` } -func (r ProjectNewParamsDeploymentConfigsPreviewServicesServiceBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewServicesServiceBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Vectorize bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsPreviewVectorizeBindings struct { +type ProjectDeploymentConfigsPreviewVectorizeBindingsParam struct { // Vectorize binding. - Vectorize param.Field[ProjectNewParamsDeploymentConfigsPreviewVectorizeBindingsVectorize] `json:"VECTORIZE"` + Vectorize param.Field[ProjectDeploymentConfigsPreviewVectorizeBindingsVectorizeParam] `json:"VECTORIZE"` } -func (r ProjectNewParamsDeploymentConfigsPreviewVectorizeBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewVectorizeBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Vectorize binding. -type ProjectNewParamsDeploymentConfigsPreviewVectorizeBindingsVectorize struct { +type ProjectDeploymentConfigsPreviewVectorizeBindingsVectorizeParam struct { IndexName param.Field[string] `json:"index_name"` } -func (r ProjectNewParamsDeploymentConfigsPreviewVectorizeBindingsVectorize) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsPreviewVectorizeBindingsVectorizeParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Configs for production deploys. -type ProjectNewParamsDeploymentConfigsProduction struct { +type ProjectDeploymentConfigsProductionParam struct { // Constellation bindings used for Pages Functions. - AIBindings param.Field[ProjectNewParamsDeploymentConfigsProductionAIBindings] `json:"ai_bindings"` + AIBindings param.Field[ProjectDeploymentConfigsProductionAIBindingsParam] `json:"ai_bindings"` // Analytics Engine bindings used for Pages Functions. - AnalyticsEngineDatasets param.Field[ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasets] `json:"analytics_engine_datasets"` + AnalyticsEngineDatasets param.Field[ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsParam] `json:"analytics_engine_datasets"` // Browser bindings used for Pages Functions. - Browsers param.Field[ProjectNewParamsDeploymentConfigsProductionBrowsers] `json:"browsers"` + Browsers param.Field[ProjectDeploymentConfigsProductionBrowsersParam] `json:"browsers"` // Compatibility date used for Pages Functions. CompatibilityDate param.Field[string] `json:"compatibility_date"` // Compatibility flags used for Pages Functions. CompatibilityFlags param.Field[[]interface{}] `json:"compatibility_flags"` // D1 databases used for Pages Functions. - D1Databases param.Field[ProjectNewParamsDeploymentConfigsProductionD1Databases] `json:"d1_databases"` + D1Databases param.Field[ProjectDeploymentConfigsProductionD1DatabasesParam] `json:"d1_databases"` // Durabble Object namespaces used for Pages Functions. - DurableObjectNamespaces param.Field[ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespaces] `json:"durable_object_namespaces"` + DurableObjectNamespaces param.Field[ProjectDeploymentConfigsProductionDurableObjectNamespacesParam] `json:"durable_object_namespaces"` // Environment variables for build configs. - EnvVars param.Field[ProjectNewParamsDeploymentConfigsProductionEnvVars] `json:"env_vars"` + EnvVars param.Field[ProjectDeploymentConfigsProductionEnvVarsParam] `json:"env_vars"` // Hyperdrive bindings used for Pages Functions. - HyperdriveBindings param.Field[ProjectNewParamsDeploymentConfigsProductionHyperdriveBindings] `json:"hyperdrive_bindings"` + HyperdriveBindings param.Field[ProjectDeploymentConfigsProductionHyperdriveBindingsParam] `json:"hyperdrive_bindings"` // KV namespaces used for Pages Functions. - KVNamespaces param.Field[ProjectNewParamsDeploymentConfigsProductionKVNamespaces] `json:"kv_namespaces"` + KVNamespaces param.Field[ProjectDeploymentConfigsProductionKVNamespacesParam] `json:"kv_namespaces"` // mTLS bindings used for Pages Functions. - MTLSCertificates param.Field[ProjectNewParamsDeploymentConfigsProductionMTLSCertificates] `json:"mtls_certificates"` + MTLSCertificates param.Field[ProjectDeploymentConfigsProductionMTLSCertificatesParam] `json:"mtls_certificates"` // Placement setting used for Pages Functions. - Placement param.Field[ProjectNewParamsDeploymentConfigsProductionPlacement] `json:"placement"` + Placement param.Field[ProjectDeploymentConfigsProductionPlacementParam] `json:"placement"` // Queue Producer bindings used for Pages Functions. - QueueProducers param.Field[ProjectNewParamsDeploymentConfigsProductionQueueProducers] `json:"queue_producers"` + QueueProducers param.Field[ProjectDeploymentConfigsProductionQueueProducersParam] `json:"queue_producers"` // R2 buckets used for Pages Functions. - R2Buckets param.Field[ProjectNewParamsDeploymentConfigsProductionR2Buckets] `json:"r2_buckets"` + R2Buckets param.Field[ProjectDeploymentConfigsProductionR2BucketsParam] `json:"r2_buckets"` // Services used for Pages Functions. - Services param.Field[ProjectNewParamsDeploymentConfigsProductionServices] `json:"services"` + Services param.Field[ProjectDeploymentConfigsProductionServicesParam] `json:"services"` // Vectorize bindings used for Pages Functions. - VectorizeBindings param.Field[ProjectNewParamsDeploymentConfigsProductionVectorizeBindings] `json:"vectorize_bindings"` + VectorizeBindings param.Field[ProjectDeploymentConfigsProductionVectorizeBindingsParam] `json:"vectorize_bindings"` } -func (r ProjectNewParamsDeploymentConfigsProduction) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Constellation bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionAIBindings struct { +type ProjectDeploymentConfigsProductionAIBindingsParam struct { // AI binding. - AIBinding param.Field[ProjectNewParamsDeploymentConfigsProductionAIBindingsAIBinding] `json:"AI_BINDING"` + AIBinding param.Field[ProjectDeploymentConfigsProductionAIBindingsAIBindingParam] `json:"AI_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionAIBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionAIBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // AI binding. -type ProjectNewParamsDeploymentConfigsProductionAIBindingsAIBinding struct { +type ProjectDeploymentConfigsProductionAIBindingsAIBindingParam struct { ProjectID param.Field[interface{}] `json:"project_id"` } -func (r ProjectNewParamsDeploymentConfigsProductionAIBindingsAIBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionAIBindingsAIBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Analytics Engine bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasets struct { +type ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsParam struct { // Analytics Engine binding. - AnalyticsEngineBinding param.Field[ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding] `json:"ANALYTICS_ENGINE_BINDING"` + AnalyticsEngineBinding param.Field[ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingParam] `json:"ANALYTICS_ENGINE_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasets) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Analytics Engine binding. -type ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding struct { +type ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingParam struct { // Name of the dataset. Dataset param.Field[string] `json:"dataset"` } -func (r ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Browser bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionBrowsers struct { +type ProjectDeploymentConfigsProductionBrowsersParam struct { // Browser binding. Browser param.Field[interface{}] `json:"BROWSER"` } -func (r ProjectNewParamsDeploymentConfigsProductionBrowsers) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionBrowsersParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // D1 databases used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionD1Databases struct { +type ProjectDeploymentConfigsProductionD1DatabasesParam struct { // D1 binding. - D1Binding param.Field[ProjectNewParamsDeploymentConfigsProductionD1DatabasesD1Binding] `json:"D1_BINDING"` + D1Binding param.Field[ProjectDeploymentConfigsProductionD1DatabasesD1BindingParam] `json:"D1_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionD1Databases) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionD1DatabasesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // D1 binding. -type ProjectNewParamsDeploymentConfigsProductionD1DatabasesD1Binding struct { +type ProjectDeploymentConfigsProductionD1DatabasesD1BindingParam struct { // UUID of the D1 database. ID param.Field[string] `json:"id"` } -func (r ProjectNewParamsDeploymentConfigsProductionD1DatabasesD1Binding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionD1DatabasesD1BindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Durabble Object namespaces used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespaces struct { +type ProjectDeploymentConfigsProductionDurableObjectNamespacesParam struct { // Durabble Object binding. - DoBinding param.Field[ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding] `json:"DO_BINDING"` + DoBinding param.Field[ProjectDeploymentConfigsProductionDurableObjectNamespacesDoBindingParam] `json:"DO_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespaces) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionDurableObjectNamespacesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Durabble Object binding. -type ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding struct { +type ProjectDeploymentConfigsProductionDurableObjectNamespacesDoBindingParam struct { // ID of the Durabble Object namespace. NamespaceID param.Field[string] `json:"namespace_id"` } -func (r ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionDurableObjectNamespacesDoBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Environment variables for build configs. -type ProjectNewParamsDeploymentConfigsProductionEnvVars struct { +type ProjectDeploymentConfigsProductionEnvVarsParam struct { // Environment variable. - EnvironmentVariable param.Field[ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable] `json:"ENVIRONMENT_VARIABLE"` + EnvironmentVariable param.Field[ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableParam] `json:"ENVIRONMENT_VARIABLE"` } -func (r ProjectNewParamsDeploymentConfigsProductionEnvVars) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionEnvVarsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Environment variable. -type ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable struct { +type ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableParam struct { // The type of environment variable (plain text or secret) - Type param.Field[ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType] `json:"type"` + Type param.Field[ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableType] `json:"type"` // Environment variable value. Value param.Field[string] `json:"value"` } -func (r ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The type of environment variable (plain text or secret) -type ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType string - -const ( - ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "plain_text" - ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypeSecretText ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType = "secret_text" -) - -func (r ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableType) IsKnown() bool { - switch r { - case ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText, ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypeSecretText: - return true - } - return false -} - // Hyperdrive bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionHyperdriveBindings struct { +type ProjectDeploymentConfigsProductionHyperdriveBindingsParam struct { // Hyperdrive binding. - Hyperdrive param.Field[ProjectNewParamsDeploymentConfigsProductionHyperdriveBindingsHyperdrive] `json:"HYPERDRIVE"` + Hyperdrive param.Field[ProjectDeploymentConfigsProductionHyperdriveBindingsHyperdriveParam] `json:"HYPERDRIVE"` } -func (r ProjectNewParamsDeploymentConfigsProductionHyperdriveBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionHyperdriveBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Hyperdrive binding. -type ProjectNewParamsDeploymentConfigsProductionHyperdriveBindingsHyperdrive struct { +type ProjectDeploymentConfigsProductionHyperdriveBindingsHyperdriveParam struct { ID param.Field[string] `json:"id"` } -func (r ProjectNewParamsDeploymentConfigsProductionHyperdriveBindingsHyperdrive) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionHyperdriveBindingsHyperdriveParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // KV namespaces used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionKVNamespaces struct { +type ProjectDeploymentConfigsProductionKVNamespacesParam struct { // KV binding. - KVBinding param.Field[ProjectNewParamsDeploymentConfigsProductionKVNamespacesKVBinding] `json:"KV_BINDING"` + KVBinding param.Field[ProjectDeploymentConfigsProductionKVNamespacesKVBindingParam] `json:"KV_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionKVNamespaces) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionKVNamespacesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // KV binding. -type ProjectNewParamsDeploymentConfigsProductionKVNamespacesKVBinding struct { +type ProjectDeploymentConfigsProductionKVNamespacesKVBindingParam struct { // ID of the KV namespace. NamespaceID param.Field[string] `json:"namespace_id"` } -func (r ProjectNewParamsDeploymentConfigsProductionKVNamespacesKVBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionKVNamespacesKVBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // mTLS bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionMTLSCertificates struct { +type ProjectDeploymentConfigsProductionMTLSCertificatesParam struct { // mTLS binding. - MTLS param.Field[ProjectNewParamsDeploymentConfigsProductionMTLSCertificatesMTLS] `json:"MTLS"` + MTLS param.Field[ProjectDeploymentConfigsProductionMTLSCertificatesMTLSParam] `json:"MTLS"` } -func (r ProjectNewParamsDeploymentConfigsProductionMTLSCertificates) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionMTLSCertificatesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // mTLS binding. -type ProjectNewParamsDeploymentConfigsProductionMTLSCertificatesMTLS struct { +type ProjectDeploymentConfigsProductionMTLSCertificatesMTLSParam struct { CertificateID param.Field[string] `json:"certificate_id"` } -func (r ProjectNewParamsDeploymentConfigsProductionMTLSCertificatesMTLS) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionMTLSCertificatesMTLSParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Placement setting used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionPlacement struct { +type ProjectDeploymentConfigsProductionPlacementParam struct { // Placement mode. Mode param.Field[string] `json:"mode"` } -func (r ProjectNewParamsDeploymentConfigsProductionPlacement) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionPlacementParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Queue Producer bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionQueueProducers struct { +type ProjectDeploymentConfigsProductionQueueProducersParam struct { // Queue Producer binding. - QueueProducerBinding param.Field[ProjectNewParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding] `json:"QUEUE_PRODUCER_BINDING"` + QueueProducerBinding param.Field[ProjectDeploymentConfigsProductionQueueProducersQueueProducerBindingParam] `json:"QUEUE_PRODUCER_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionQueueProducers) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionQueueProducersParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Queue Producer binding. -type ProjectNewParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding struct { +type ProjectDeploymentConfigsProductionQueueProducersQueueProducerBindingParam struct { // Name of the Queue. Name param.Field[string] `json:"name"` } -func (r ProjectNewParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionQueueProducersQueueProducerBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // R2 buckets used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionR2Buckets struct { +type ProjectDeploymentConfigsProductionR2BucketsParam struct { // R2 binding. - R2Binding param.Field[ProjectNewParamsDeploymentConfigsProductionR2BucketsR2Binding] `json:"R2_BINDING"` + R2Binding param.Field[ProjectDeploymentConfigsProductionR2BucketsR2BindingParam] `json:"R2_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionR2Buckets) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionR2BucketsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // R2 binding. -type ProjectNewParamsDeploymentConfigsProductionR2BucketsR2Binding struct { +type ProjectDeploymentConfigsProductionR2BucketsR2BindingParam struct { // Name of the R2 bucket. Name param.Field[string] `json:"name"` } -func (r ProjectNewParamsDeploymentConfigsProductionR2BucketsR2Binding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionR2BucketsR2BindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Services used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionServices struct { +type ProjectDeploymentConfigsProductionServicesParam struct { // Service binding. - ServiceBinding param.Field[ProjectNewParamsDeploymentConfigsProductionServicesServiceBinding] `json:"SERVICE_BINDING"` + ServiceBinding param.Field[ProjectDeploymentConfigsProductionServicesServiceBindingParam] `json:"SERVICE_BINDING"` } -func (r ProjectNewParamsDeploymentConfigsProductionServices) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionServicesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Service binding. -type ProjectNewParamsDeploymentConfigsProductionServicesServiceBinding struct { +type ProjectDeploymentConfigsProductionServicesServiceBindingParam struct { // The entrypoint to bind to. Entrypoint param.Field[string] `json:"entrypoint"` // The Service environment. @@ -2522,29 +2393,134 @@ type ProjectNewParamsDeploymentConfigsProductionServicesServiceBinding struct { Service param.Field[string] `json:"service"` } -func (r ProjectNewParamsDeploymentConfigsProductionServicesServiceBinding) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionServicesServiceBindingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Vectorize bindings used for Pages Functions. -type ProjectNewParamsDeploymentConfigsProductionVectorizeBindings struct { +type ProjectDeploymentConfigsProductionVectorizeBindingsParam struct { // Vectorize binding. - Vectorize param.Field[ProjectNewParamsDeploymentConfigsProductionVectorizeBindingsVectorize] `json:"VECTORIZE"` + Vectorize param.Field[ProjectDeploymentConfigsProductionVectorizeBindingsVectorizeParam] `json:"VECTORIZE"` } -func (r ProjectNewParamsDeploymentConfigsProductionVectorizeBindings) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionVectorizeBindingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Vectorize binding. -type ProjectNewParamsDeploymentConfigsProductionVectorizeBindingsVectorize struct { +type ProjectDeploymentConfigsProductionVectorizeBindingsVectorizeParam struct { IndexName param.Field[string] `json:"index_name"` } -func (r ProjectNewParamsDeploymentConfigsProductionVectorizeBindingsVectorize) MarshalJSON() (data []byte, err error) { +func (r ProjectDeploymentConfigsProductionVectorizeBindingsVectorizeParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// The status of the deployment. +type Stage struct { + // When the stage ended. + EndedOn time.Time `json:"ended_on,nullable" format:"date-time"` + // The current build stage. + Name string `json:"name"` + // When the stage started. + StartedOn time.Time `json:"started_on,nullable" format:"date-time"` + // State of the current stage. + Status string `json:"status"` + JSON stageJSON `json:"-"` +} + +// stageJSON contains the JSON metadata for the struct [Stage] +type stageJSON struct { + EndedOn apijson.Field + Name apijson.Field + StartedOn apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Stage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r stageJSON) RawJSON() string { + return r.raw +} + +// The status of the deployment. +type StageParam struct { + // The current build stage. + Name param.Field[string] `json:"name"` +} + +func (r StageParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Union satisfied by [pages.ProjectNewResponseUnknown], +// [pages.ProjectNewResponseArray] or [shared.UnionString]. +type ProjectNewResponseUnion interface { + ImplementsPagesProjectNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ProjectNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ProjectNewResponseArray{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ProjectNewResponseArray []interface{} + +func (r ProjectNewResponseArray) ImplementsPagesProjectNewResponseUnion() {} + +type ProjectDeleteResponse = interface{} + +// Union satisfied by [pages.ProjectEditResponseUnknown], +// [pages.ProjectEditResponseArray] or [shared.UnionString]. +type ProjectEditResponseUnion interface { + ImplementsPagesProjectEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ProjectEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ProjectEditResponseArray{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ProjectEditResponseArray []interface{} + +func (r ProjectEditResponseArray) ImplementsPagesProjectEditResponseUnion() {} + +type ProjectPurgeBuildCacheResponse = interface{} + +type ProjectNewParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + Project ProjectParam `json:"project,required"` +} + +func (r ProjectNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Project) +} + type ProjectNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -2595,8 +2571,8 @@ type ProjectListParams struct { type ProjectDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDeleteParams) MarshalJSON() (data []byte, err error) { @@ -2605,8 +2581,8 @@ func (r ProjectDeleteParams) MarshalJSON() (data []byte, err error) { type ProjectEditParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectEditParams) MarshalJSON() (data []byte, err error) { diff --git a/pages/project_test.go b/pages/project_test.go index c5bea85ca3b..5b8aab66c82 100644 --- a/pages/project_test.go +++ b/pages/project_test.go @@ -30,166 +30,168 @@ func TestProjectNewWithOptionalParams(t *testing.T) { ) _, err := client.Pages.Projects.New(context.TODO(), pages.ProjectNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - BuildConfig: cloudflare.F(pages.ProjectNewParamsBuildConfig{ - BuildCaching: cloudflare.F(true), - BuildCommand: cloudflare.F("npm run build"), - DestinationDir: cloudflare.F("build"), - RootDir: cloudflare.F("/"), - WebAnalyticsTag: cloudflare.F("cee1c73f6e4743d0b5e6bb1a0bcaabcc"), - WebAnalyticsToken: cloudflare.F("021e1057c18547eca7b79f2516f06o7x"), - }), - CanonicalDeployment: cloudflare.F(pages.DeploymentParam{}), - DeploymentConfigs: cloudflare.F(pages.ProjectNewParamsDeploymentConfigs{ - Preview: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreview{ - AIBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewAIBindings{ - AIBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewAIBindingsAIBinding{ - ProjectID: cloudflare.F[any](map[string]interface{}{}), + Project: pages.ProjectParam{ + BuildConfig: cloudflare.F(pages.ProjectBuildConfigParam{ + BuildCaching: cloudflare.F(true), + BuildCommand: cloudflare.F("npm run build"), + DestinationDir: cloudflare.F("build"), + RootDir: cloudflare.F("/"), + WebAnalyticsTag: cloudflare.F("cee1c73f6e4743d0b5e6bb1a0bcaabcc"), + WebAnalyticsToken: cloudflare.F("021e1057c18547eca7b79f2516f06o7x"), + }), + CanonicalDeployment: cloudflare.F(pages.DeploymentParam{}), + DeploymentConfigs: cloudflare.F(pages.ProjectDeploymentConfigsParam{ + Preview: cloudflare.F(pages.ProjectDeploymentConfigsPreviewParam{ + AIBindings: cloudflare.F(pages.ProjectDeploymentConfigsPreviewAIBindingsParam{ + AIBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewAIBindingsAIBindingParam{ + ProjectID: cloudflare.F[any](map[string]interface{}{}), + }), }), - }), - AnalyticsEngineDatasets: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasets{ - AnalyticsEngineBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBinding{ - Dataset: cloudflare.F("api_analytics"), + AnalyticsEngineDatasets: cloudflare.F(pages.ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsParam{ + AnalyticsEngineBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewAnalyticsEngineDatasetsAnalyticsEngineBindingParam{ + Dataset: cloudflare.F("api_analytics"), + }), }), - }), - Browsers: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewBrowsers{ - Browser: cloudflare.F[any](map[string]interface{}{}), - }), - CompatibilityDate: cloudflare.F("2022-01-01"), - CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), - D1Databases: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewD1Databases{ - D1Binding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewD1DatabasesD1Binding{ - ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + Browsers: cloudflare.F(pages.ProjectDeploymentConfigsPreviewBrowsersParam{ + Browser: cloudflare.F[any](map[string]interface{}{}), }), - }), - DurableObjectNamespaces: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespaces{ - DoBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewDurableObjectNamespacesDoBinding{ - NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + CompatibilityDate: cloudflare.F("2022-01-01"), + CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), + D1Databases: cloudflare.F(pages.ProjectDeploymentConfigsPreviewD1DatabasesParam{ + D1Binding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewD1DatabasesD1BindingParam{ + ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + }), }), - }), - EnvVars: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewEnvVars{ - EnvironmentVariable: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariable{ - Type: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText), - Value: cloudflare.F("hello world"), + DurableObjectNamespaces: cloudflare.F(pages.ProjectDeploymentConfigsPreviewDurableObjectNamespacesParam{ + DoBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewDurableObjectNamespacesDoBindingParam{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), }), - }), - HyperdriveBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindings{ - Hyperdrive: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewHyperdriveBindingsHyperdrive{ - ID: cloudflare.F("a76a99bc342644deb02c38d66082262a"), + EnvVars: cloudflare.F(pages.ProjectDeploymentConfigsPreviewEnvVarsParam{ + EnvironmentVariable: cloudflare.F(pages.ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableParam{ + Type: cloudflare.F(pages.ProjectDeploymentConfigsPreviewEnvVarsEnvironmentVariableTypePlainText), + Value: cloudflare.F("hello world"), + }), }), - }), - KVNamespaces: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewKVNamespaces{ - KVBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewKVNamespacesKVBinding{ - NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + HyperdriveBindings: cloudflare.F(pages.ProjectDeploymentConfigsPreviewHyperdriveBindingsParam{ + Hyperdrive: cloudflare.F(pages.ProjectDeploymentConfigsPreviewHyperdriveBindingsHyperdriveParam{ + ID: cloudflare.F("a76a99bc342644deb02c38d66082262a"), + }), }), - }), - MTLSCertificates: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewMTLSCertificates{ - MTLS: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewMTLSCertificatesMTLS{ - CertificateID: cloudflare.F("d7cdd17c-916f-4cb7-aabe-585eb382ec4e"), + KVNamespaces: cloudflare.F(pages.ProjectDeploymentConfigsPreviewKVNamespacesParam{ + KVBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewKVNamespacesKVBindingParam{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), }), - }), - Placement: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewPlacement{ - Mode: cloudflare.F("smart"), - }), - QueueProducers: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewQueueProducers{ - QueueProducerBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewQueueProducersQueueProducerBinding{ - Name: cloudflare.F("some-queue"), + MTLSCertificates: cloudflare.F(pages.ProjectDeploymentConfigsPreviewMTLSCertificatesParam{ + MTLS: cloudflare.F(pages.ProjectDeploymentConfigsPreviewMTLSCertificatesMTLSParam{ + CertificateID: cloudflare.F("d7cdd17c-916f-4cb7-aabe-585eb382ec4e"), + }), }), - }), - R2Buckets: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewR2Buckets{ - R2Binding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewR2BucketsR2Binding{ - Name: cloudflare.F("some-bucket"), + Placement: cloudflare.F(pages.ProjectDeploymentConfigsPreviewPlacementParam{ + Mode: cloudflare.F("smart"), }), - }), - Services: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewServices{ - ServiceBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewServicesServiceBinding{ - Entrypoint: cloudflare.F("MyHandler"), - Environment: cloudflare.F("production"), - Service: cloudflare.F("example-worker"), + QueueProducers: cloudflare.F(pages.ProjectDeploymentConfigsPreviewQueueProducersParam{ + QueueProducerBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewQueueProducersQueueProducerBindingParam{ + Name: cloudflare.F("some-queue"), + }), }), - }), - VectorizeBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewVectorizeBindings{ - Vectorize: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsPreviewVectorizeBindingsVectorize{ - IndexName: cloudflare.F("my_index"), + R2Buckets: cloudflare.F(pages.ProjectDeploymentConfigsPreviewR2BucketsParam{ + R2Binding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewR2BucketsR2BindingParam{ + Name: cloudflare.F("some-bucket"), + }), }), - }), - }), - Production: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProduction{ - AIBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionAIBindings{ - AIBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionAIBindingsAIBinding{ - ProjectID: cloudflare.F[any](map[string]interface{}{}), + Services: cloudflare.F(pages.ProjectDeploymentConfigsPreviewServicesParam{ + ServiceBinding: cloudflare.F(pages.ProjectDeploymentConfigsPreviewServicesServiceBindingParam{ + Entrypoint: cloudflare.F("MyHandler"), + Environment: cloudflare.F("production"), + Service: cloudflare.F("example-worker"), + }), }), - }), - AnalyticsEngineDatasets: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasets{ - AnalyticsEngineBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBinding{ - Dataset: cloudflare.F("api_analytics"), + VectorizeBindings: cloudflare.F(pages.ProjectDeploymentConfigsPreviewVectorizeBindingsParam{ + Vectorize: cloudflare.F(pages.ProjectDeploymentConfigsPreviewVectorizeBindingsVectorizeParam{ + IndexName: cloudflare.F("my_index"), + }), }), }), - Browsers: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionBrowsers{ - Browser: cloudflare.F[any](map[string]interface{}{}), - }), - CompatibilityDate: cloudflare.F("2022-01-01"), - CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), - D1Databases: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionD1Databases{ - D1Binding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionD1DatabasesD1Binding{ - ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + Production: cloudflare.F(pages.ProjectDeploymentConfigsProductionParam{ + AIBindings: cloudflare.F(pages.ProjectDeploymentConfigsProductionAIBindingsParam{ + AIBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionAIBindingsAIBindingParam{ + ProjectID: cloudflare.F[any](map[string]interface{}{}), + }), }), - }), - DurableObjectNamespaces: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespaces{ - DoBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionDurableObjectNamespacesDoBinding{ - NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + AnalyticsEngineDatasets: cloudflare.F(pages.ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsParam{ + AnalyticsEngineBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionAnalyticsEngineDatasetsAnalyticsEngineBindingParam{ + Dataset: cloudflare.F("api_analytics"), + }), }), - }), - EnvVars: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionEnvVars{ - EnvironmentVariable: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariable{ - Type: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText), - Value: cloudflare.F("hello world"), + Browsers: cloudflare.F(pages.ProjectDeploymentConfigsProductionBrowsersParam{ + Browser: cloudflare.F[any](map[string]interface{}{}), }), - }), - HyperdriveBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionHyperdriveBindings{ - Hyperdrive: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionHyperdriveBindingsHyperdrive{ - ID: cloudflare.F("a76a99bc342644deb02c38d66082262a"), + CompatibilityDate: cloudflare.F("2022-01-01"), + CompatibilityFlags: cloudflare.F([]interface{}{"url_standard"}), + D1Databases: cloudflare.F(pages.ProjectDeploymentConfigsProductionD1DatabasesParam{ + D1Binding: cloudflare.F(pages.ProjectDeploymentConfigsProductionD1DatabasesD1BindingParam{ + ID: cloudflare.F("445e2955-951a-43f8-a35b-a4d0c8138f63"), + }), }), - }), - KVNamespaces: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionKVNamespaces{ - KVBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionKVNamespacesKVBinding{ - NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + DurableObjectNamespaces: cloudflare.F(pages.ProjectDeploymentConfigsProductionDurableObjectNamespacesParam{ + DoBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionDurableObjectNamespacesDoBindingParam{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), }), - }), - MTLSCertificates: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionMTLSCertificates{ - MTLS: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionMTLSCertificatesMTLS{ - CertificateID: cloudflare.F("d7cdd17c-916f-4cb7-aabe-585eb382ec4e"), + EnvVars: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsParam{ + EnvironmentVariable: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableParam{ + Type: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsEnvironmentVariableTypePlainText), + Value: cloudflare.F("hello world"), + }), }), - }), - Placement: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionPlacement{ - Mode: cloudflare.F("smart"), - }), - QueueProducers: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionQueueProducers{ - QueueProducerBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionQueueProducersQueueProducerBinding{ - Name: cloudflare.F("some-queue"), + HyperdriveBindings: cloudflare.F(pages.ProjectDeploymentConfigsProductionHyperdriveBindingsParam{ + Hyperdrive: cloudflare.F(pages.ProjectDeploymentConfigsProductionHyperdriveBindingsHyperdriveParam{ + ID: cloudflare.F("a76a99bc342644deb02c38d66082262a"), + }), }), - }), - R2Buckets: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionR2Buckets{ - R2Binding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionR2BucketsR2Binding{ - Name: cloudflare.F("some-bucket"), + KVNamespaces: cloudflare.F(pages.ProjectDeploymentConfigsProductionKVNamespacesParam{ + KVBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionKVNamespacesKVBindingParam{ + NamespaceID: cloudflare.F("5eb63bbbe01eeed093cb22bb8f5acdc3"), + }), }), - }), - Services: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionServices{ - ServiceBinding: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionServicesServiceBinding{ - Entrypoint: cloudflare.F("MyHandler"), - Environment: cloudflare.F("production"), - Service: cloudflare.F("example-worker"), + MTLSCertificates: cloudflare.F(pages.ProjectDeploymentConfigsProductionMTLSCertificatesParam{ + MTLS: cloudflare.F(pages.ProjectDeploymentConfigsProductionMTLSCertificatesMTLSParam{ + CertificateID: cloudflare.F("d7cdd17c-916f-4cb7-aabe-585eb382ec4e"), + }), }), - }), - VectorizeBindings: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionVectorizeBindings{ - Vectorize: cloudflare.F(pages.ProjectNewParamsDeploymentConfigsProductionVectorizeBindingsVectorize{ - IndexName: cloudflare.F("my_index"), + Placement: cloudflare.F(pages.ProjectDeploymentConfigsProductionPlacementParam{ + Mode: cloudflare.F("smart"), + }), + QueueProducers: cloudflare.F(pages.ProjectDeploymentConfigsProductionQueueProducersParam{ + QueueProducerBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionQueueProducersQueueProducerBindingParam{ + Name: cloudflare.F("some-queue"), + }), + }), + R2Buckets: cloudflare.F(pages.ProjectDeploymentConfigsProductionR2BucketsParam{ + R2Binding: cloudflare.F(pages.ProjectDeploymentConfigsProductionR2BucketsR2BindingParam{ + Name: cloudflare.F("some-bucket"), + }), + }), + Services: cloudflare.F(pages.ProjectDeploymentConfigsProductionServicesParam{ + ServiceBinding: cloudflare.F(pages.ProjectDeploymentConfigsProductionServicesServiceBindingParam{ + Entrypoint: cloudflare.F("MyHandler"), + Environment: cloudflare.F("production"), + Service: cloudflare.F("example-worker"), + }), + }), + VectorizeBindings: cloudflare.F(pages.ProjectDeploymentConfigsProductionVectorizeBindingsParam{ + Vectorize: cloudflare.F(pages.ProjectDeploymentConfigsProductionVectorizeBindingsVectorizeParam{ + IndexName: cloudflare.F("my_index"), + }), }), }), }), - }), - LatestDeployment: cloudflare.F(pages.DeploymentParam{}), - Name: cloudflare.F("NextJS Blog"), - ProductionBranch: cloudflare.F("main"), + LatestDeployment: cloudflare.F(pages.DeploymentParam{}), + Name: cloudflare.F("NextJS Blog"), + ProductionBranch: cloudflare.F("main"), + }, }) if err != nil { var apierr *cloudflare.Error @@ -245,7 +247,7 @@ func TestProjectDelete(t *testing.T) { "this-is-my-project-01", pages.ProjectDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -276,7 +278,7 @@ func TestProjectEdit(t *testing.T) { "this-is-my-project-01", pages.ProjectEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "deployment_configs": map[string]interface{}{ "production": map[string]interface{}{ "compatibility_date": "2022-01-01", @@ -295,7 +297,7 @@ func TestProjectEdit(t *testing.T) { }, }, }, - }), + }, }, ) if err != nil { diff --git a/pages/projectdeployment.go b/pages/projectdeployment.go index 92fdad53303..2504a97fce3 100644 --- a/pages/projectdeployment.go +++ b/pages/projectdeployment.go @@ -213,8 +213,8 @@ func (r ProjectDeploymentListParamsEnv) IsKnown() bool { type ProjectDeploymentDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDeploymentDeleteParams) MarshalJSON() (data []byte, err error) { @@ -271,8 +271,8 @@ func (r ProjectDeploymentGetResponseEnvelopeSuccess) IsKnown() bool { type ProjectDeploymentRetryParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDeploymentRetryParams) MarshalJSON() (data []byte, err error) { @@ -324,8 +324,8 @@ func (r ProjectDeploymentRetryResponseEnvelopeSuccess) IsKnown() bool { type ProjectDeploymentRollbackParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDeploymentRollbackParams) MarshalJSON() (data []byte, err error) { diff --git a/pages/projectdeployment_test.go b/pages/projectdeployment_test.go index f3fdfde5907..cd560bf2796 100644 --- a/pages/projectdeployment_test.go +++ b/pages/projectdeployment_test.go @@ -96,7 +96,7 @@ func TestProjectDeploymentDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -159,7 +159,7 @@ func TestProjectDeploymentRetry(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentRetryParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -191,7 +191,7 @@ func TestProjectDeploymentRollback(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentRollbackParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/pages/projectdomain.go b/pages/projectdomain.go index 5afba2a71c1..6e86b6b1176 100644 --- a/pages/projectdomain.go +++ b/pages/projectdomain.go @@ -186,8 +186,8 @@ func (r ProjectDomainGetResponseArray) ImplementsPagesProjectDomainGetResponseUn type ProjectDomainNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDomainNewParams) MarshalJSON() (data []byte, err error) { @@ -244,8 +244,8 @@ type ProjectDomainListParams struct { type ProjectDomainDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDomainDeleteParams) MarshalJSON() (data []byte, err error) { @@ -254,8 +254,8 @@ func (r ProjectDomainDeleteParams) MarshalJSON() (data []byte, err error) { type ProjectDomainEditParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ProjectDomainEditParams) MarshalJSON() (data []byte, err error) { diff --git a/pages/projectdomain_test.go b/pages/projectdomain_test.go index 9c09fd8da6c..6e54698b562 100644 --- a/pages/projectdomain_test.go +++ b/pages/projectdomain_test.go @@ -33,9 +33,9 @@ func TestProjectDomainNew(t *testing.T) { "this-is-my-project-01", pages.ProjectDomainNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "name": "example.com", - }), + }, }, ) if err != nil { @@ -97,7 +97,7 @@ func TestProjectDomainDelete(t *testing.T) { "this-is-my-domain-01.com", pages.ProjectDomainDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -129,7 +129,7 @@ func TestProjectDomainEdit(t *testing.T) { "this-is-my-domain-01.com", pages.ProjectDomainEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/pcaps/aliases.go b/pcaps/aliases.go index cb82e336a44..df61c40b033 100644 --- a/pcaps/aliases.go +++ b/pcaps/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/pcaps/pcap.go b/pcaps/pcap.go index 1b10fb66921..90893ef50b0 100644 --- a/pcaps/pcap.go +++ b/pcaps/pcap.go @@ -42,7 +42,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.getAccountID()) + path := fmt.Sprintf("accounts/%s/pcaps", params.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -999,53 +999,81 @@ func (r PCAPGetResponseType) IsKnown() bool { return false } -// This interface is a union satisfied by one of the following: -// [PCAPNewParamsMagicVisibilityPCAPsRequestSimple], -// [PCAPNewParamsMagicVisibilityPCAPsRequestFull]. -type PCAPNewParams interface { - ImplementsPCAPNewParams() +type PCAPNewParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + Body PCAPNewParamsBodyUnion `json:"body,required"` +} - getAccountID() param.Field[string] +func (r PCAPNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) } -type PCAPNewParamsMagicVisibilityPCAPsRequestSimple struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` +type PCAPNewParamsBody struct { + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[PCAPFilterParam] `json:"filter_v1"` // The limit of packets contained in a packet capture. - PacketLimit param.Field[float64] `json:"packet_limit,required"` + PacketLimit param.Field[float64] `json:"packet_limit"` // The system used to collect packet captures. - System param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem] `json:"system,required"` + System param.Field[PCAPNewParamsBodySystem] `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[PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType] `json:"type,required"` - // The packet capture filter. When this field is empty, all packets are captured. - FilterV1 param.Field[PCAPFilterParam] `json:"filter_v1"` + Type param.Field[PCAPNewParamsBodyType] `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 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"` + // The full URI for the bucket. This field only applies to `full` packet captures. + DestinationConf param.Field[string] `json:"destination_conf"` } -func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimple) MarshalJSON() (data []byte, err error) { +func (r PCAPNewParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimple) getAccountID() param.Field[string] { - return r.AccountID +func (r PCAPNewParamsBody) implementsPCAPsPCAPNewParamsBodyUnion() {} + +// Satisfied by [pcaps.PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimple], +// [pcaps.PCAPNewParamsBodyMagicVisibilityPCAPsRequestFull], [PCAPNewParamsBody]. +type PCAPNewParamsBodyUnion interface { + implementsPCAPsPCAPNewParamsBodyUnion() } -func (PCAPNewParamsMagicVisibilityPCAPsRequestSimple) ImplementsPCAPNewParams() { +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimple struct { + // 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[PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystem] `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[PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleType] `json:"type,required"` + // The packet capture filter. When this field is empty, all packets are captured. + FilterV1 param.Field[PCAPFilterParam] `json:"filter_v1"` +} +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimple) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimple) implementsPCAPsPCAPNewParamsBodyUnion() {} + // The system used to collect packet captures. -type PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem string +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystem string const ( - PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem = "magic-transit" + PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystemMagicTransit PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystem = "magic-transit" ) -func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem) IsKnown() bool { +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystem) IsKnown() bool { switch r { - case PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystemMagicTransit: + case PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystemMagicTransit: return true } return false @@ -1053,24 +1081,22 @@ func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleSystem) IsKnown() bool { // The type of packet capture. `Simple` captures sampled packets, and `full` // captures entire payloads and non-sampled packets. -type PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType string +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleType string const ( - PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeSimple PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType = "simple" - PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeFull PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType = "full" + PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleTypeSimple PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleType = "simple" + PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleTypeFull PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleType = "full" ) -func (r PCAPNewParamsMagicVisibilityPCAPsRequestSimpleType) IsKnown() bool { +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleType) IsKnown() bool { switch r { - case PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeSimple, PCAPNewParamsMagicVisibilityPCAPsRequestSimpleTypeFull: + case PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleTypeSimple, PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleTypeFull: return true } return false } -type PCAPNewParamsMagicVisibilityPCAPsRequestFull struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestFull struct { // 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. @@ -1078,12 +1104,12 @@ type PCAPNewParamsMagicVisibilityPCAPsRequestFull struct { // The full URI for the bucket. This field only applies to `full` packet captures. DestinationConf param.Field[string] `json:"destination_conf,required"` // The system used to collect packet captures. - System param.Field[PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem] `json:"system,required"` + System param.Field[PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystem] `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"` + Type param.Field[PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullType] `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"` @@ -1093,28 +1119,54 @@ type PCAPNewParamsMagicVisibilityPCAPsRequestFull struct { PacketLimit param.Field[float64] `json:"packet_limit"` } -func (r PCAPNewParamsMagicVisibilityPCAPsRequestFull) MarshalJSON() (data []byte, err error) { +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestFull) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r PCAPNewParamsMagicVisibilityPCAPsRequestFull) getAccountID() param.Field[string] { - return r.AccountID +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestFull) implementsPCAPsPCAPNewParamsBodyUnion() {} + +// The system used to collect packet captures. +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystem string + +const ( + PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystemMagicTransit PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystem = "magic-transit" +) + +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystem) IsKnown() bool { + switch r { + case PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullSystemMagicTransit: + return true + } + return false } -func (PCAPNewParamsMagicVisibilityPCAPsRequestFull) ImplementsPCAPNewParams() { +// The type of packet capture. `Simple` captures sampled packets, and `full` +// captures entire payloads and non-sampled packets. +type PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullType string + +const ( + PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullTypeSimple PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullType = "simple" + PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullTypeFull PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullType = "full" +) +func (r PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullType) IsKnown() bool { + switch r { + case PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullTypeSimple, PCAPNewParamsBodyMagicVisibilityPCAPsRequestFullTypeFull: + return true + } + return false } // The system used to collect packet captures. -type PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem string +type PCAPNewParamsBodySystem string const ( - PCAPNewParamsMagicVisibilityPCAPsRequestFullSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem = "magic-transit" + PCAPNewParamsBodySystemMagicTransit PCAPNewParamsBodySystem = "magic-transit" ) -func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem) IsKnown() bool { +func (r PCAPNewParamsBodySystem) IsKnown() bool { switch r { - case PCAPNewParamsMagicVisibilityPCAPsRequestFullSystemMagicTransit: + case PCAPNewParamsBodySystemMagicTransit: return true } return false @@ -1122,16 +1174,16 @@ func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullSystem) IsKnown() bool { // The type of packet capture. `Simple` captures sampled packets, and `full` // captures entire payloads and non-sampled packets. -type PCAPNewParamsMagicVisibilityPCAPsRequestFullType string +type PCAPNewParamsBodyType string const ( - PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeSimple PCAPNewParamsMagicVisibilityPCAPsRequestFullType = "simple" - PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeFull PCAPNewParamsMagicVisibilityPCAPsRequestFullType = "full" + PCAPNewParamsBodyTypeSimple PCAPNewParamsBodyType = "simple" + PCAPNewParamsBodyTypeFull PCAPNewParamsBodyType = "full" ) -func (r PCAPNewParamsMagicVisibilityPCAPsRequestFullType) IsKnown() bool { +func (r PCAPNewParamsBodyType) IsKnown() bool { switch r { - case PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeSimple, PCAPNewParamsMagicVisibilityPCAPsRequestFullTypeFull: + case PCAPNewParamsBodyTypeSimple, PCAPNewParamsBodyTypeFull: return true } return false diff --git a/pcaps/pcap_test.go b/pcaps/pcap_test.go index b8bdb023ee4..d67b4f2e140 100644 --- a/pcaps/pcap_test.go +++ b/pcaps/pcap_test.go @@ -28,19 +28,21 @@ func TestPCAPNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, 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.PCAPFilterParam{ - 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), - }), + _, err := client.PCAPs.New(context.TODO(), pcaps.PCAPNewParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Body: pcaps.PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimple{ + FilterV1: cloudflare.F(pcaps.PCAPFilterParam{ + 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), + System: cloudflare.F(pcaps.PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleSystemMagicTransit), + TimeLimit: cloudflare.F(300.000000), + Type: cloudflare.F(pcaps.PCAPNewParamsBodyMagicVisibilityPCAPsRequestSimpleTypeSimple), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/plans/aliases.go b/plans/aliases.go index 0b8d9a13bc6..516c6a1c461 100644 --- a/plans/aliases.go +++ b/plans/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/queues/aliases.go b/queues/aliases.go index 13d9b160f0f..6c541bb8f07 100644 --- a/queues/aliases.go +++ b/queues/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/queues/consumer.go b/queues/consumer.go index 5e331fcb93c..de81817af2c 100644 --- a/queues/consumer.go +++ b/queues/consumer.go @@ -254,8 +254,8 @@ func (r consumerGetResponseJSON) RawJSON() string { type ConsumerNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConsumerNewParams) MarshalJSON() (data []byte, err error) { @@ -350,8 +350,8 @@ func (r consumerNewResponseEnvelopeResultInfoJSON) RawJSON() string { type ConsumerUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConsumerUpdateParams) MarshalJSON() (data []byte, err error) { @@ -446,8 +446,8 @@ func (r consumerUpdateResponseEnvelopeResultInfoJSON) RawJSON() string { type ConsumerDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ConsumerDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/queues/consumer_test.go b/queues/consumer_test.go index 2fd2d60400a..f53c3fca042 100644 --- a/queues/consumer_test.go +++ b/queues/consumer_test.go @@ -33,7 +33,7 @@ func TestConsumerNew(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.ConsumerNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "dead_letter_queue": "example-dlq", "environment": "production", "script_name": "example-consumer", @@ -42,7 +42,7 @@ func TestConsumerNew(t *testing.T) { "max_retries": int64(3), "max_wait_time_ms": int64(5000), }, - }), + }, }, ) if err != nil { @@ -74,14 +74,14 @@ func TestConsumerUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.ConsumerUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "dead_letter_queue": "updated-example-dlq", "environment": "production", "script_name": "example-consumer", "settings": map[string]interface{}{ "batch_size": int64(100), }, - }), + }, }, ) if err != nil { @@ -113,7 +113,7 @@ func TestConsumerDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.ConsumerDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/queues/queue.go b/queues/queue.go index b1840d65762..32729c0fed1 100644 --- a/queues/queue.go +++ b/queues/queue.go @@ -264,8 +264,8 @@ func (r queueGetResponseJSON) RawJSON() string { type QueueNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r QueueNewParams) MarshalJSON() (data []byte, err error) { @@ -358,8 +358,8 @@ func (r queueNewResponseEnvelopeResultInfoJSON) RawJSON() string { type QueueUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r QueueUpdateParams) MarshalJSON() (data []byte, err error) { @@ -457,8 +457,8 @@ type QueueListParams struct { type QueueDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r QueueDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/queues/queue_test.go b/queues/queue_test.go index 52e855678f9..3cf77ee8818 100644 --- a/queues/queue_test.go +++ b/queues/queue_test.go @@ -30,9 +30,9 @@ func TestQueueNew(t *testing.T) { ) _, err := client.Queues.New(context.TODO(), queues.QueueNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "queue_name": "example-queue", - }), + }, }) if err != nil { var apierr *cloudflare.Error @@ -62,9 +62,9 @@ func TestQueueUpdate(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.QueueUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{ + Body: map[string]interface{}{ "queue_name": "renamed-example-queue", - }), + }, }, ) if err != nil { @@ -121,7 +121,7 @@ func TestQueueDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.QueueDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/r2/aliases.go b/r2/aliases.go index 0250a750ddf..c081b8ec90b 100644 --- a/r2/aliases.go +++ b/r2/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/r2/sippy.go b/r2/sippy.go index 907bf002b7e..747a71e64ce 100644 --- a/r2/sippy.go +++ b/r2/sippy.go @@ -35,7 +35,7 @@ func NewSippyService(opts ...option.RequestOption) (r *SippyService) { func (r *SippyService) Update(ctx context.Context, bucketName string, params SippyUpdateParams, opts ...option.RequestOption) (res *Sippy, err error) { opts = append(r.Options[:], opts...) var env SippyUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/r2/buckets/%s/sippy", params.getAccountID(), bucketName) + path := fmt.Sprintf("accounts/%s/r2/buckets/%s/sippy", params.AccountID, bucketName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -218,37 +218,48 @@ func (r SippyDeleteResponseEnabled) IsKnown() bool { return false } -// This interface is a union satisfied by one of the following: -// [SippyUpdateParamsR2EnableSippyAws], [SippyUpdateParamsR2EnableSippyGcs]. -type SippyUpdateParams interface { - ImplementsSippyUpdateParams() +type SippyUpdateParams struct { + // Account ID + AccountID param.Field[string] `path:"account_id,required"` + Body SippyUpdateParamsBodyUnion `json:"body,required"` +} - getAccountID() param.Field[string] +func (r SippyUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) } -type SippyUpdateParamsR2EnableSippyAws struct { - // Account ID - 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"` +type SippyUpdateParamsBody struct { + Destination param.Field[interface{}] `json:"destination,required"` + Source param.Field[interface{}] `json:"source,required"` } -func (r SippyUpdateParamsR2EnableSippyAws) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r SippyUpdateParamsR2EnableSippyAws) getAccountID() param.Field[string] { - return r.AccountID +func (r SippyUpdateParamsBody) implementsR2SippyUpdateParamsBodyUnion() {} + +// Satisfied by [r2.SippyUpdateParamsBodyR2EnableSippyAws], +// [r2.SippyUpdateParamsBodyR2EnableSippyGcs], [SippyUpdateParamsBody]. +type SippyUpdateParamsBodyUnion interface { + implementsR2SippyUpdateParamsBodyUnion() } -func (SippyUpdateParamsR2EnableSippyAws) ImplementsSippyUpdateParams() { +type SippyUpdateParamsBodyR2EnableSippyAws struct { + // R2 bucket to copy objects to + Destination param.Field[SippyUpdateParamsBodyR2EnableSippyAwsDestination] `json:"destination"` + // AWS S3 bucket to copy objects from + Source param.Field[SippyUpdateParamsBodyR2EnableSippyAwsSource] `json:"source"` +} +func (r SippyUpdateParamsBodyR2EnableSippyAws) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } +func (r SippyUpdateParamsBodyR2EnableSippyAws) implementsR2SippyUpdateParamsBodyUnion() {} + // R2 bucket to copy objects to -type SippyUpdateParamsR2EnableSippyAwsDestination struct { +type SippyUpdateParamsBodyR2EnableSippyAwsDestination 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). @@ -266,64 +277,56 @@ type SippyUpdateParamsR2EnableSippyAwsDestination struct { SecretAccessKey param.Field[string] `json:"secretAccessKey"` } -func (r SippyUpdateParamsR2EnableSippyAwsDestination) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsBodyR2EnableSippyAwsDestination) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // AWS S3 bucket to copy objects from -type SippyUpdateParamsR2EnableSippyAwsSource struct { +type SippyUpdateParamsBodyR2EnableSippyAwsSource 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"` + Bucket param.Field[string] `json:"bucket"` + Provider param.Field[SippyUpdateParamsBodyR2EnableSippyAwsSourceProvider] `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) { +func (r SippyUpdateParamsBodyR2EnableSippyAwsSource) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SippyUpdateParamsR2EnableSippyAwsSourceProvider string +type SippyUpdateParamsBodyR2EnableSippyAwsSourceProvider string const ( - SippyUpdateParamsR2EnableSippyAwsSourceProviderAws SippyUpdateParamsR2EnableSippyAwsSourceProvider = "aws" + SippyUpdateParamsBodyR2EnableSippyAwsSourceProviderAws SippyUpdateParamsBodyR2EnableSippyAwsSourceProvider = "aws" ) -func (r SippyUpdateParamsR2EnableSippyAwsSourceProvider) IsKnown() bool { +func (r SippyUpdateParamsBodyR2EnableSippyAwsSourceProvider) IsKnown() bool { switch r { - case SippyUpdateParamsR2EnableSippyAwsSourceProviderAws: + case SippyUpdateParamsBodyR2EnableSippyAwsSourceProviderAws: return true } return false } -type SippyUpdateParamsR2EnableSippyGcs struct { - // Account ID - AccountID param.Field[string] `path:"account_id,required"` +type SippyUpdateParamsBodyR2EnableSippyGcs struct { // R2 bucket to copy objects to - Destination param.Field[SippyUpdateParamsR2EnableSippyGcsDestination] `json:"destination"` + Destination param.Field[SippyUpdateParamsBodyR2EnableSippyGcsDestination] `json:"destination"` // GCS bucket to copy objects from - Source param.Field[SippyUpdateParamsR2EnableSippyGcsSource] `json:"source"` + Source param.Field[SippyUpdateParamsBodyR2EnableSippyGcsSource] `json:"source"` } -func (r SippyUpdateParamsR2EnableSippyGcs) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsBodyR2EnableSippyGcs) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r SippyUpdateParamsR2EnableSippyGcs) getAccountID() param.Field[string] { - return r.AccountID -} - -func (SippyUpdateParamsR2EnableSippyGcs) ImplementsSippyUpdateParams() { - -} +func (r SippyUpdateParamsBodyR2EnableSippyGcs) implementsR2SippyUpdateParamsBodyUnion() {} // R2 bucket to copy objects to -type SippyUpdateParamsR2EnableSippyGcsDestination struct { +type SippyUpdateParamsBodyR2EnableSippyGcsDestination 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). @@ -341,34 +344,34 @@ type SippyUpdateParamsR2EnableSippyGcsDestination struct { SecretAccessKey param.Field[string] `json:"secretAccessKey"` } -func (r SippyUpdateParamsR2EnableSippyGcsDestination) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsBodyR2EnableSippyGcsDestination) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // GCS bucket to copy objects from -type SippyUpdateParamsR2EnableSippyGcsSource struct { +type SippyUpdateParamsBodyR2EnableSippyGcsSource 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[SippyUpdateParamsR2EnableSippyGcsSourceProvider] `json:"provider"` + PrivateKey param.Field[string] `json:"privateKey"` + Provider param.Field[SippyUpdateParamsBodyR2EnableSippyGcsSourceProvider] `json:"provider"` } -func (r SippyUpdateParamsR2EnableSippyGcsSource) MarshalJSON() (data []byte, err error) { +func (r SippyUpdateParamsBodyR2EnableSippyGcsSource) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SippyUpdateParamsR2EnableSippyGcsSourceProvider string +type SippyUpdateParamsBodyR2EnableSippyGcsSourceProvider string const ( - SippyUpdateParamsR2EnableSippyGcsSourceProviderGcs SippyUpdateParamsR2EnableSippyGcsSourceProvider = "gcs" + SippyUpdateParamsBodyR2EnableSippyGcsSourceProviderGcs SippyUpdateParamsBodyR2EnableSippyGcsSourceProvider = "gcs" ) -func (r SippyUpdateParamsR2EnableSippyGcsSourceProvider) IsKnown() bool { +func (r SippyUpdateParamsBodyR2EnableSippyGcsSourceProvider) IsKnown() bool { switch r { - case SippyUpdateParamsR2EnableSippyGcsSourceProviderGcs: + case SippyUpdateParamsBodyR2EnableSippyGcsSourceProviderGcs: return true } return false diff --git a/r2/sippy_test.go b/r2/sippy_test.go index a17371a757e..b6b699e22e9 100644 --- a/r2/sippy_test.go +++ b/r2/sippy_test.go @@ -31,20 +31,22 @@ func TestSippyUpdateWithOptionalParams(t *testing.T) { _, err := client.R2.Sippy.Update( context.TODO(), "example-bucket", - r2.SippyUpdateParamsR2EnableSippyAws{ + r2.SippyUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Destination: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsDestination{ - AccessKeyID: cloudflare.F("string"), - Provider: cloudflare.F(r2.ProviderR2), - SecretAccessKey: cloudflare.F("string"), - }), - Source: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsSource{ - AccessKeyID: cloudflare.F("string"), - Bucket: cloudflare.F("string"), - Provider: cloudflare.F(r2.SippyUpdateParamsR2EnableSippyAwsSourceProviderAws), - Region: cloudflare.F("string"), - SecretAccessKey: cloudflare.F("string"), - }), + Body: r2.SippyUpdateParamsBodyR2EnableSippyAws{ + Destination: cloudflare.F(r2.SippyUpdateParamsBodyR2EnableSippyAwsDestination{ + AccessKeyID: cloudflare.F("string"), + Provider: cloudflare.F(r2.ProviderR2), + SecretAccessKey: cloudflare.F("string"), + }), + Source: cloudflare.F(r2.SippyUpdateParamsBodyR2EnableSippyAwsSource{ + AccessKeyID: cloudflare.F("string"), + Bucket: cloudflare.F("string"), + Provider: cloudflare.F(r2.SippyUpdateParamsBodyR2EnableSippyAwsSourceProviderAws), + Region: cloudflare.F("string"), + SecretAccessKey: cloudflare.F("string"), + }), + }, }, ) if err != nil { diff --git a/radar/aliases.go b/radar/aliases.go index 40dd9cdd58d..b0ff62c8695 100644 --- a/radar/aliases.go +++ b/radar/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/rate_limits/aliases.go b/rate_limits/aliases.go index c6188f15816..874f86e75c5 100644 --- a/rate_limits/aliases.go +++ b/rate_limits/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/rate_limits/ratelimit.go b/rate_limits/ratelimit.go index ad33ed3918d..d86ea8a7ed1 100644 --- a/rate_limits/ratelimit.go +++ b/rate_limits/ratelimit.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // RateLimitService contains methods and other services that help with interacting @@ -36,7 +38,7 @@ func NewRateLimitService(opts ...option.RequestOption) (r *RateLimitService) { // Creates a new rate limit for a zone. Refer to the object definition for a list // of required attributes. -func (r *RateLimitService) New(ctx context.Context, zoneIdentifier string, body RateLimitNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *RateLimitService) New(ctx context.Context, zoneIdentifier string, body RateLimitNewParams, opts ...option.RequestOption) (res *RateLimitNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RateLimitNewResponseEnvelope path := fmt.Sprintf("zones/%s/rate_limits", zoneIdentifier) @@ -85,7 +87,7 @@ func (r *RateLimitService) Delete(ctx context.Context, zoneIdentifier string, id } // Updates an existing rate limit. -func (r *RateLimitService) Edit(ctx context.Context, zoneIdentifier string, id string, body RateLimitEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *RateLimitService) Edit(ctx context.Context, zoneIdentifier string, id string, body RateLimitEditParams, opts ...option.RequestOption) (res *RateLimitEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RateLimitEditResponseEnvelope path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) @@ -98,7 +100,7 @@ func (r *RateLimitService) Edit(ctx context.Context, zoneIdentifier string, id s } // Fetches the details of a rate limit. -func (r *RateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *RateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *RateLimitGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RateLimitGetResponseEnvelope path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) @@ -457,6 +459,23 @@ func (r rateLimitMatchResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [rate_limits.RateLimitNewResponseUnknown] or +// [shared.UnionString]. +type RateLimitNewResponseUnion interface { + ImplementsRateLimitsRateLimitNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RateLimitNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type RateLimitDeleteResponse struct { // The unique identifier of the rate limit. ID string `json:"id"` @@ -479,8 +498,42 @@ func (r rateLimitDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [rate_limits.RateLimitEditResponseUnknown] or +// [shared.UnionString]. +type RateLimitEditResponseUnion interface { + ImplementsRateLimitsRateLimitEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RateLimitEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [rate_limits.RateLimitGetResponseUnknown] or +// [shared.UnionString]. +type RateLimitGetResponseUnion interface { + ImplementsRateLimitsRateLimitGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*RateLimitGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type RateLimitNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RateLimitNewParams) MarshalJSON() (data []byte, err error) { @@ -488,9 +541,9 @@ func (r RateLimitNewParams) MarshalJSON() (data []byte, err error) { } type RateLimitNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result RateLimitNewResponseUnion `json:"result,required"` // Whether the API call was successful Success RateLimitNewResponseEnvelopeSuccess `json:"success,required"` JSON rateLimitNewResponseEnvelopeJSON `json:"-"` @@ -547,7 +600,7 @@ func (r RateLimitListParams) URLQuery() (v url.Values) { } type RateLimitDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RateLimitDeleteParams) MarshalJSON() (data []byte, err error) { @@ -598,7 +651,7 @@ func (r RateLimitDeleteResponseEnvelopeSuccess) IsKnown() bool { } type RateLimitEditParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r RateLimitEditParams) MarshalJSON() (data []byte, err error) { @@ -606,9 +659,9 @@ func (r RateLimitEditParams) MarshalJSON() (data []byte, err error) { } type RateLimitEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result RateLimitEditResponseUnion `json:"result,required"` // Whether the API call was successful Success RateLimitEditResponseEnvelopeSuccess `json:"success,required"` JSON rateLimitEditResponseEnvelopeJSON `json:"-"` @@ -649,9 +702,9 @@ func (r RateLimitEditResponseEnvelopeSuccess) IsKnown() bool { } type RateLimitGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result RateLimitGetResponseUnion `json:"result,required"` // Whether the API call was successful Success RateLimitGetResponseEnvelopeSuccess `json:"success,required"` JSON rateLimitGetResponseEnvelopeJSON `json:"-"` diff --git a/rate_limits/ratelimit_test.go b/rate_limits/ratelimit_test.go index 184d3390782..596ab863a01 100644 --- a/rate_limits/ratelimit_test.go +++ b/rate_limits/ratelimit_test.go @@ -32,7 +32,7 @@ func TestRateLimitNew(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", rate_limits.RateLimitNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -94,7 +94,7 @@ func TestRateLimitDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", rate_limits.RateLimitDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -125,7 +125,7 @@ func TestRateLimitEdit(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", rate_limits.RateLimitEditParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/rate_plans/aliases.go b/rate_plans/aliases.go index 6fc85d19edc..c6d3df7874d 100644 --- a/rate_plans/aliases.go +++ b/rate_plans/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/registrar/aliases.go b/registrar/aliases.go index 857663be68c..4a4ee4098f6 100644 --- a/registrar/aliases.go +++ b/registrar/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/request_tracers/aliases.go b/request_tracers/aliases.go index caf14fe1b9d..33965d5e5cb 100644 --- a/request_tracers/aliases.go +++ b/request_tracers/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/rules/aliases.go b/rules/aliases.go index 3fb6c89aae1..bd874a76e8f 100644 --- a/rules/aliases.go +++ b/rules/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/rules/list.go b/rules/list.go index c900404b61c..656bb6f5642 100644 --- a/rules/list.go +++ b/rules/list.go @@ -441,8 +441,8 @@ type ListListParams struct { type ListDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ListDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/rules/list_test.go b/rules/list_test.go index 9d88211fd5d..9273ae14fba 100644 --- a/rules/list_test.go +++ b/rules/list_test.go @@ -119,7 +119,7 @@ func TestListDelete(t *testing.T) { "2c0fc9fa937b11eaa1b71c4d701ab86e", rules.ListDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/rules/listitem.go b/rules/listitem.go index ca9f3b0216d..5f751d06a57 100644 --- a/rules/listitem.go +++ b/rules/listitem.go @@ -249,8 +249,8 @@ func init() { type ListItemNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]ListItemNewParamsBody] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []ListItemNewParamsBody `json:"body,required"` } func (r ListItemNewParams) MarshalJSON() (data []byte, err error) { @@ -321,8 +321,8 @@ func (r ListItemNewResponseEnvelopeSuccess) IsKnown() bool { type ListItemUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]ListItemUpdateParamsBody] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []ListItemUpdateParamsBody `json:"body,required"` } func (r ListItemUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/rules/listitem_test.go b/rules/listitem_test.go index cb22c68bf5a..f7e0ccdb4d4 100644 --- a/rules/listitem_test.go +++ b/rules/listitem_test.go @@ -33,7 +33,7 @@ func TestListItemNew(t *testing.T) { "2c0fc9fa937b11eaa1b71c4d701ab86e", rules.ListItemNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]rules.ListItemNewParamsBody{{ + Body: []rules.ListItemNewParamsBody{{ ASN: cloudflare.F(int64(5567)), Comment: cloudflare.F("Private IP address"), Hostname: cloudflare.F(rules.HostnameParam{ @@ -81,7 +81,7 @@ func TestListItemNew(t *testing.T) { SubpathMatching: cloudflare.F(true), TargetURL: cloudflare.F("https://archlinux.org/"), }), - }}), + }}, }, ) if err != nil { @@ -112,7 +112,7 @@ func TestListItemUpdate(t *testing.T) { "2c0fc9fa937b11eaa1b71c4d701ab86e", rules.ListItemUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]rules.ListItemUpdateParamsBody{{ + Body: []rules.ListItemUpdateParamsBody{{ ASN: cloudflare.F(int64(5567)), Comment: cloudflare.F("Private IP address"), Hostname: cloudflare.F(rules.HostnameParam{ @@ -160,7 +160,7 @@ func TestListItemUpdate(t *testing.T) { SubpathMatching: cloudflare.F(true), TargetURL: cloudflare.F("https://archlinux.org/"), }), - }}), + }}, }, ) if err != nil { diff --git a/rulesets/aliases.go b/rulesets/aliases.go index 0c58e26315b..ca8fa314a30 100644 --- a/rulesets/aliases.go +++ b/rulesets/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/rulesets/phase.go b/rulesets/phase.go index 6c0bb7e0234..c1987a9bb59 100644 --- a/rulesets/phase.go +++ b/rulesets/phase.go @@ -12,7 +12,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -196,7 +195,7 @@ type PhaseUpdateResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -405,7 +404,7 @@ type PhaseGetResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -571,7 +570,7 @@ type PhaseUpdateParamsRule struct { // The unique ID of the rule. ID param.Field[string] `json:"id"` // An object configuring the rule's logging behavior. - Logging param.Field[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } diff --git a/rulesets/phase_test.go b/rulesets/phase_test.go index dcf226f42c6..8a722986c54 100644 --- a/rulesets/phase_test.go +++ b/rulesets/phase_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/rulesets" @@ -46,7 +45,7 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -63,7 +62,7 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -80,7 +79,7 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), diff --git a/rulesets/phaseversion.go b/rulesets/phaseversion.go index 85bdc4cfc40..713643bfd15 100644 --- a/rulesets/phaseversion.go +++ b/rulesets/phaseversion.go @@ -13,7 +13,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -205,7 +204,7 @@ type PhaseVersionGetResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. diff --git a/rulesets/rule.go b/rulesets/rule.go index 3555d0d4bcb..6143b9b92aa 100644 --- a/rulesets/rule.go +++ b/rulesets/rule.go @@ -12,7 +12,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -41,12 +40,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.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/rulesets/%s/rules", accountOrZone, accountOrZoneID, rulesetID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -85,12 +84,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.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/rulesets/%s/rules/%s", accountOrZone, accountOrZoneID, rulesetID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) @@ -121,7 +120,7 @@ type BlockRule struct { // The expression defining which traffic will match the rule. Expression string `json:"expression"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` JSON blockRuleJSON `json:"-"` @@ -255,7 +254,7 @@ type BlockRuleParam struct { // 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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } @@ -314,7 +313,7 @@ type ExecuteRule struct { // The expression defining which traffic will match the rule. Expression string `json:"expression"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` JSON executeRuleJSON `json:"-"` @@ -609,7 +608,7 @@ type ExecuteRuleParam struct { // 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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } @@ -724,7 +723,7 @@ type LogRule struct { // The expression defining which traffic will match the rule. Expression string `json:"expression"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` JSON logRuleJSON `json:"-"` @@ -806,7 +805,7 @@ type LogRuleParam struct { // 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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } @@ -821,6 +820,38 @@ func (r LogRuleParam) implementsRulesetsRulesetUpdateParamsRuleUnion() {} func (r LogRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} +// An object configuring the rule's logging behavior. +type Logging struct { + // Whether to generate a log when the rule matches. + Enabled bool `json:"enabled,required"` + JSON loggingJSON `json:"-"` +} + +// loggingJSON contains the JSON metadata for the struct [Logging] +type loggingJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Logging) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r loggingJSON) RawJSON() string { + return r.raw +} + +// An object configuring the rule's logging behavior. +type LoggingParam struct { + // Whether to generate a log when the rule matches. + Enabled param.Field[bool] `json:"enabled,required"` +} + +func (r LoggingParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type SkipRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` @@ -841,7 +872,7 @@ type SkipRule struct { // The expression defining which traffic will match the rule. Expression string `json:"expression"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` JSON skipRuleJSON `json:"-"` @@ -1036,7 +1067,7 @@ type SkipRuleParam struct { // 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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } @@ -1187,7 +1218,7 @@ type RuleNewResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -1396,7 +1427,7 @@ type RuleDeleteResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -1605,7 +1636,7 @@ type RuleEditResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -1699,504 +1730,258 @@ func (r RuleEditResponseRulesAction) IsKnown() bool { return false } -// This interface is a union satisfied by one of the following: -// [RuleNewParamsBlockRule], [RuleNewParamsExecuteRule], [RuleNewParamsLogRule], -// [RuleNewParamsSkipRule]. -type RuleNewParams interface { - ImplementsRuleNewParams() - - getAccountID() param.Field[string] - - getZoneID() param.Field[string] -} - -type RuleNewParamsBlockRule struct { +type RuleNewParams 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[RuleNewParamsBlockRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleNewParamsBlockRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` + // An object configuring where the rule will be placed. + Position param.Field[RuleNewParamsPositionUnion] `json:"position"` } -func (r RuleNewParamsBlockRule) MarshalJSON() (data []byte, err error) { +func (r RuleNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleNewParamsBlockRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleNewParamsBlockRule) getZoneID() param.Field[string] { - return r.ZoneID +// An object configuring where the rule will be placed. +type RuleNewParamsPosition 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 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"` + // An index at which to place the rule, where index 1 is the first rule. + Index param.Field[float64] `json:"index"` } -func (RuleNewParamsBlockRule) ImplementsRuleNewParams() { - +func (r RuleNewParamsPosition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The action to perform when the rule matches. -type RuleNewParamsBlockRuleAction string - -const ( - RuleNewParamsBlockRuleActionBlock RuleNewParamsBlockRuleAction = "block" -) +func (r RuleNewParamsPosition) implementsRulesetsRuleNewParamsPositionUnion() {} -func (r RuleNewParamsBlockRuleAction) IsKnown() bool { - switch r { - case RuleNewParamsBlockRuleActionBlock: - return true - } - return false +// An object configuring where the rule will be placed. +// +// Satisfied by [rulesets.RuleNewParamsPositionBeforePosition], +// [rulesets.RuleNewParamsPositionAfterPosition], +// [rulesets.RuleNewParamsPositionIndexPosition], [RuleNewParamsPosition]. +type RuleNewParamsPositionUnion interface { + implementsRulesetsRuleNewParamsPositionUnion() } -// The parameters configuring the rule's action. -type RuleNewParamsBlockRuleActionParameters struct { - // The response to show when the block is applied. - Response param.Field[RuleNewParamsBlockRuleActionParametersResponse] `json:"response"` +// 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"` } -func (r RuleNewParamsBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsPositionBeforePosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The response to show when the block is applied. -type RuleNewParamsBlockRuleActionParametersResponse 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 RuleNewParamsPositionBeforePosition) implementsRulesetsRuleNewParamsPositionUnion() {} + +// 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"` } -func (r RuleNewParamsBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsPositionAfterPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type RuleNewParamsExecuteRule 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[RuleNewParamsExecuteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleNewParamsExecuteRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` +func (r RuleNewParamsPositionAfterPosition) implementsRulesetsRuleNewParamsPositionUnion() {} + +// 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 RuleNewParamsExecuteRule) MarshalJSON() (data []byte, err error) { +func (r RuleNewParamsPositionIndexPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleNewParamsExecuteRule) getAccountID() param.Field[string] { - return r.AccountID -} +func (r RuleNewParamsPositionIndexPosition) implementsRulesetsRuleNewParamsPositionUnion() {} -func (r RuleNewParamsExecuteRule) getZoneID() param.Field[string] { - return r.ZoneID +// A response object. +type RuleNewResponseEnvelope struct { + // A list of error messages. + Errors []RuleNewResponseEnvelopeErrors `json:"errors,required"` + // A list of warning messages. + Messages []RuleNewResponseEnvelopeMessages `json:"messages,required"` + // A ruleset object. + Result RuleNewResponse `json:"result,required"` + // Whether the API call was successful. + Success RuleNewResponseEnvelopeSuccess `json:"success,required"` + JSON ruleNewResponseEnvelopeJSON `json:"-"` } -func (RuleNewParamsExecuteRule) ImplementsRuleNewParams() { - +// ruleNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [RuleNewResponseEnvelope] +type ruleNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// The action to perform when the rule matches. -type RuleNewParamsExecuteRuleAction string - -const ( - RuleNewParamsExecuteRuleActionExecute RuleNewParamsExecuteRuleAction = "execute" -) +func (r *RuleNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r RuleNewParamsExecuteRuleAction) IsKnown() bool { - switch r { - case RuleNewParamsExecuteRuleActionExecute: - return true - } - return false +func (r ruleNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// The parameters configuring the rule's action. -type RuleNewParamsExecuteRuleActionParameters 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[RuleNewParamsExecuteRuleActionParametersMatchedData] `json:"matched_data"` - // A set of overrides to apply to the target ruleset. - Overrides param.Field[RuleNewParamsExecuteRuleActionParametersOverrides] `json:"overrides"` +// A message. +type RuleNewResponseEnvelopeErrors struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source RuleNewResponseEnvelopeErrorsSource `json:"source"` + JSON ruleNewResponseEnvelopeErrorsJSON `json:"-"` } -func (r RuleNewParamsExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// ruleNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct +// [RuleNewResponseEnvelopeErrors] +type ruleNewResponseEnvelopeErrorsJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// The configuration to use for matched data logging. -type RuleNewParamsExecuteRuleActionParametersMatchedData struct { - // The public key to encrypt matched data logs with. - PublicKey param.Field[string] `json:"public_key,required"` +func (r *RuleNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RuleNewParamsExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r ruleNewResponseEnvelopeErrorsJSON) RawJSON() string { + return r.raw } -// A set of overrides to apply to the target ruleset. -type RuleNewParamsExecuteRuleActionParametersOverrides 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[[]RuleNewParamsExecuteRuleActionParametersOverridesCategory] `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[[]RuleNewParamsExecuteRuleActionParametersOverridesRule] `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[RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel] `json:"sensitivity_level"` +// The source of this message. +type RuleNewResponseEnvelopeErrorsSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON ruleNewResponseEnvelopeErrorsSourceJSON `json:"-"` } -func (r RuleNewParamsExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// ruleNewResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the +// struct [RuleNewResponseEnvelopeErrorsSource] +type ruleNewResponseEnvelopeErrorsSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// A category-level override -type RuleNewParamsExecuteRuleActionParametersOverridesCategory 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[RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel] `json:"sensitivity_level"` +func (r *RuleNewResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r RuleNewParamsExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r ruleNewResponseEnvelopeErrorsSourceJSON) RawJSON() string { + return r.raw } -// The sensitivity level to use for rules in the category. -type RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel string +// A message. +type RuleNewResponseEnvelopeMessages struct { + // A text description of this message. + Message string `json:"message,required"` + // A unique code for this message. + Code int64 `json:"code"` + // The source of this message. + Source RuleNewResponseEnvelopeMessagesSource `json:"source"` + JSON ruleNewResponseEnvelopeMessagesJSON `json:"-"` +} -const ( - RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "default" - RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "medium" - RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "low" - RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "eoff" -) +// ruleNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct +// [RuleNewResponseEnvelopeMessages] +type ruleNewResponseEnvelopeMessagesJSON struct { + Message apijson.Field + Code apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel) IsKnown() bool { - switch r { - case RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault, RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium, RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow, RuleNewParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff: - return true - } - return false +func (r *RuleNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -// A rule-level override -type RuleNewParamsExecuteRuleActionParametersOverridesRule 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[RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel] `json:"sensitivity_level"` +func (r ruleNewResponseEnvelopeMessagesJSON) RawJSON() string { + return r.raw } -func (r RuleNewParamsExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// The source of this message. +type RuleNewResponseEnvelopeMessagesSource struct { + // A JSON pointer to the field that is the source of the message. + Pointer string `json:"pointer,required"` + JSON ruleNewResponseEnvelopeMessagesSourceJSON `json:"-"` } -// The sensitivity level to use for the rule. -type RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel string +// ruleNewResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the +// struct [RuleNewResponseEnvelopeMessagesSource] +type ruleNewResponseEnvelopeMessagesSourceJSON struct { + Pointer apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -const ( - RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "default" - RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "medium" - RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "low" - RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "eoff" -) +func (r *RuleNewResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel) IsKnown() bool { - switch r { - case RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault, RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium, RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow, RuleNewParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff: - return true - } - return false +func (r ruleNewResponseEnvelopeMessagesSourceJSON) RawJSON() string { + return r.raw } -// 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 RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel string +// Whether the API call was successful. +type RuleNewResponseEnvelopeSuccess bool const ( - RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelDefault RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel = "default" - RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelMedium RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel = "medium" - RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelLow RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel = "low" - RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelEoff RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel = "eoff" + RuleNewResponseEnvelopeSuccessTrue RuleNewResponseEnvelopeSuccess = true ) -func (r RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevel) IsKnown() bool { +func (r RuleNewResponseEnvelopeSuccess) IsKnown() bool { switch r { - case RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelDefault, RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelMedium, RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelLow, RuleNewParamsExecuteRuleActionParametersOverridesSensitivityLevelEoff: + case RuleNewResponseEnvelopeSuccessTrue: return true } return false } -type RuleNewParamsLogRule struct { +type RuleDeleteParams 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[RuleNewParamsLogRuleAction] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleNewParamsLogRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RuleNewParamsLogRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleNewParamsLogRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleNewParamsLogRule) ImplementsRuleNewParams() { - -} - -// The action to perform when the rule matches. -type RuleNewParamsLogRuleAction string - -const ( - RuleNewParamsLogRuleActionLog RuleNewParamsLogRuleAction = "log" -) - -func (r RuleNewParamsLogRuleAction) IsKnown() bool { - switch r { - case RuleNewParamsLogRuleActionLog: - return true - } - return false -} - -type RuleNewParamsSkipRule 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[RuleNewParamsSkipRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleNewParamsSkipRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleNewParamsSkipRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RuleNewParamsSkipRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleNewParamsSkipRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleNewParamsSkipRule) ImplementsRuleNewParams() { - -} - -// The action to perform when the rule matches. -type RuleNewParamsSkipRuleAction string - -const ( - RuleNewParamsSkipRuleActionSkip RuleNewParamsSkipRuleAction = "skip" -) - -func (r RuleNewParamsSkipRuleAction) IsKnown() bool { - switch r { - case RuleNewParamsSkipRuleActionSkip: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleNewParamsSkipRuleActionParameters struct { - // A list of phases to skip the execution of. This option is incompatible with the - // ruleset and rulesets options. - Phases param.Field[[]RuleNewParamsSkipRuleActionParametersPhase] `json:"phases"` - // A list of legacy security products to skip the execution of. - Products param.Field[[]RuleNewParamsSkipRuleActionParametersProduct] `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[RuleNewParamsSkipRuleActionParametersRuleset] `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 RuleNewParamsSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A phase to skip the execution of. -type RuleNewParamsSkipRuleActionParametersPhase string - -const ( - RuleNewParamsSkipRuleActionParametersPhaseDDoSL4 RuleNewParamsSkipRuleActionParametersPhase = "ddos_l4" - RuleNewParamsSkipRuleActionParametersPhaseDDoSL7 RuleNewParamsSkipRuleActionParametersPhase = "ddos_l7" - RuleNewParamsSkipRuleActionParametersPhaseHTTPConfigSettings RuleNewParamsSkipRuleActionParametersPhase = "http_config_settings" - RuleNewParamsSkipRuleActionParametersPhaseHTTPCustomErrors RuleNewParamsSkipRuleActionParametersPhase = "http_custom_errors" - RuleNewParamsSkipRuleActionParametersPhaseHTTPLogCustomFields RuleNewParamsSkipRuleActionParametersPhase = "http_log_custom_fields" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRatelimit RuleNewParamsSkipRuleActionParametersPhase = "http_ratelimit" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestCacheSettings RuleNewParamsSkipRuleActionParametersPhase = "http_request_cache_settings" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect RuleNewParamsSkipRuleActionParametersPhase = "http_request_dynamic_redirect" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom RuleNewParamsSkipRuleActionParametersPhase = "http_request_firewall_custom" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged RuleNewParamsSkipRuleActionParametersPhase = "http_request_firewall_managed" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestLateTransform RuleNewParamsSkipRuleActionParametersPhase = "http_request_late_transform" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestOrigin RuleNewParamsSkipRuleActionParametersPhase = "http_request_origin" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestRedirect RuleNewParamsSkipRuleActionParametersPhase = "http_request_redirect" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSanitize RuleNewParamsSkipRuleActionParametersPhase = "http_request_sanitize" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSbfm RuleNewParamsSkipRuleActionParametersPhase = "http_request_sbfm" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration RuleNewParamsSkipRuleActionParametersPhase = "http_request_select_configuration" - RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestTransform RuleNewParamsSkipRuleActionParametersPhase = "http_request_transform" - RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseCompression RuleNewParamsSkipRuleActionParametersPhase = "http_response_compression" - RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged RuleNewParamsSkipRuleActionParametersPhase = "http_response_firewall_managed" - RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform RuleNewParamsSkipRuleActionParametersPhase = "http_response_headers_transform" - RuleNewParamsSkipRuleActionParametersPhaseMagicTransit RuleNewParamsSkipRuleActionParametersPhase = "magic_transit" - RuleNewParamsSkipRuleActionParametersPhaseMagicTransitIDsManaged RuleNewParamsSkipRuleActionParametersPhase = "magic_transit_ids_managed" - RuleNewParamsSkipRuleActionParametersPhaseMagicTransitManaged RuleNewParamsSkipRuleActionParametersPhase = "magic_transit_managed" -) - -func (r RuleNewParamsSkipRuleActionParametersPhase) IsKnown() bool { - switch r { - case RuleNewParamsSkipRuleActionParametersPhaseDDoSL4, RuleNewParamsSkipRuleActionParametersPhaseDDoSL7, RuleNewParamsSkipRuleActionParametersPhaseHTTPConfigSettings, RuleNewParamsSkipRuleActionParametersPhaseHTTPCustomErrors, RuleNewParamsSkipRuleActionParametersPhaseHTTPLogCustomFields, RuleNewParamsSkipRuleActionParametersPhaseHTTPRatelimit, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestCacheSettings, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestLateTransform, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestOrigin, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestRedirect, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSanitize, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSbfm, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, RuleNewParamsSkipRuleActionParametersPhaseHTTPRequestTransform, RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseCompression, RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged, RuleNewParamsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform, RuleNewParamsSkipRuleActionParametersPhaseMagicTransit, RuleNewParamsSkipRuleActionParametersPhaseMagicTransitIDsManaged, RuleNewParamsSkipRuleActionParametersPhaseMagicTransitManaged: - return true - } - return false -} - -// The name of a legacy security product to skip the execution of. -type RuleNewParamsSkipRuleActionParametersProduct string - -const ( - RuleNewParamsSkipRuleActionParametersProductBic RuleNewParamsSkipRuleActionParametersProduct = "bic" - RuleNewParamsSkipRuleActionParametersProductHot RuleNewParamsSkipRuleActionParametersProduct = "hot" - RuleNewParamsSkipRuleActionParametersProductRateLimit RuleNewParamsSkipRuleActionParametersProduct = "rateLimit" - RuleNewParamsSkipRuleActionParametersProductSecurityLevel RuleNewParamsSkipRuleActionParametersProduct = "securityLevel" - RuleNewParamsSkipRuleActionParametersProductUABlock RuleNewParamsSkipRuleActionParametersProduct = "uaBlock" - RuleNewParamsSkipRuleActionParametersProductWAF RuleNewParamsSkipRuleActionParametersProduct = "waf" - RuleNewParamsSkipRuleActionParametersProductZoneLockdown RuleNewParamsSkipRuleActionParametersProduct = "zoneLockdown" -) - -func (r RuleNewParamsSkipRuleActionParametersProduct) IsKnown() bool { - switch r { - case RuleNewParamsSkipRuleActionParametersProductBic, RuleNewParamsSkipRuleActionParametersProductHot, RuleNewParamsSkipRuleActionParametersProductRateLimit, RuleNewParamsSkipRuleActionParametersProductSecurityLevel, RuleNewParamsSkipRuleActionParametersProductUABlock, RuleNewParamsSkipRuleActionParametersProductWAF, RuleNewParamsSkipRuleActionParametersProductZoneLockdown: - return true - } - return false -} - -// A ruleset to skip the execution of. This option is incompatible with the -// rulesets, rules and phases options. -type RuleNewParamsSkipRuleActionParametersRuleset string - -const ( - RuleNewParamsSkipRuleActionParametersRulesetCurrent RuleNewParamsSkipRuleActionParametersRuleset = "current" -) - -func (r RuleNewParamsSkipRuleActionParametersRuleset) IsKnown() bool { - switch r { - case RuleNewParamsSkipRuleActionParametersRulesetCurrent: - return true - } - return false } // A response object. -type RuleNewResponseEnvelope struct { +type RuleDeleteResponseEnvelope struct { // A list of error messages. - Errors []RuleNewResponseEnvelopeErrors `json:"errors,required"` + Errors []RuleDeleteResponseEnvelopeErrors `json:"errors,required"` // A list of warning messages. - Messages []RuleNewResponseEnvelopeMessages `json:"messages,required"` + Messages []RuleDeleteResponseEnvelopeMessages `json:"messages,required"` // A ruleset object. - Result RuleNewResponse `json:"result,required"` + Result RuleDeleteResponse `json:"result,required"` // Whether the API call was successful. - Success RuleNewResponseEnvelopeSuccess `json:"success,required"` - JSON ruleNewResponseEnvelopeJSON `json:"-"` + Success RuleDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON ruleDeleteResponseEnvelopeJSON `json:"-"` } -// ruleNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [RuleNewResponseEnvelope] -type ruleNewResponseEnvelopeJSON struct { +// ruleDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [RuleDeleteResponseEnvelope] +type ruleDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -2205,28 +1990,28 @@ type ruleNewResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseEnvelopeJSON) RawJSON() string { +func (r ruleDeleteResponseEnvelopeJSON) RawJSON() string { return r.raw } // A message. -type RuleNewResponseEnvelopeErrors struct { +type RuleDeleteResponseEnvelopeErrors struct { // A text description of this message. Message string `json:"message,required"` // A unique code for this message. Code int64 `json:"code"` // The source of this message. - Source RuleNewResponseEnvelopeErrorsSource `json:"source"` - JSON ruleNewResponseEnvelopeErrorsJSON `json:"-"` + Source RuleDeleteResponseEnvelopeErrorsSource `json:"source"` + JSON ruleDeleteResponseEnvelopeErrorsJSON `json:"-"` } -// ruleNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [RuleNewResponseEnvelopeErrors] -type ruleNewResponseEnvelopeErrorsJSON struct { +// ruleDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the struct +// [RuleDeleteResponseEnvelopeErrors] +type ruleDeleteResponseEnvelopeErrorsJSON struct { Message apijson.Field Code apijson.Field Source apijson.Field @@ -2234,51 +2019,51 @@ type ruleNewResponseEnvelopeErrorsJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseEnvelopeErrorsJSON) RawJSON() string { +func (r ruleDeleteResponseEnvelopeErrorsJSON) RawJSON() string { return r.raw } // The source of this message. -type RuleNewResponseEnvelopeErrorsSource struct { +type RuleDeleteResponseEnvelopeErrorsSource struct { // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON ruleNewResponseEnvelopeErrorsSourceJSON `json:"-"` + Pointer string `json:"pointer,required"` + JSON ruleDeleteResponseEnvelopeErrorsSourceJSON `json:"-"` } -// ruleNewResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the -// struct [RuleNewResponseEnvelopeErrorsSource] -type ruleNewResponseEnvelopeErrorsSourceJSON struct { +// ruleDeleteResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the +// struct [RuleDeleteResponseEnvelopeErrorsSource] +type ruleDeleteResponseEnvelopeErrorsSourceJSON struct { Pointer apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseEnvelopeErrorsSourceJSON) RawJSON() string { +func (r ruleDeleteResponseEnvelopeErrorsSourceJSON) RawJSON() string { return r.raw } // A message. -type RuleNewResponseEnvelopeMessages struct { +type RuleDeleteResponseEnvelopeMessages struct { // A text description of this message. Message string `json:"message,required"` // A unique code for this message. Code int64 `json:"code"` // The source of this message. - Source RuleNewResponseEnvelopeMessagesSource `json:"source"` - JSON ruleNewResponseEnvelopeMessagesJSON `json:"-"` + Source RuleDeleteResponseEnvelopeMessagesSource `json:"source"` + JSON ruleDeleteResponseEnvelopeMessagesJSON `json:"-"` } -// ruleNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct -// [RuleNewResponseEnvelopeMessages] -type ruleNewResponseEnvelopeMessagesJSON struct { +// ruleDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the struct +// [RuleDeleteResponseEnvelopeMessages] +type ruleDeleteResponseEnvelopeMessagesJSON struct { Message apijson.Field Code apijson.Field Source apijson.Field @@ -2286,691 +2071,129 @@ type ruleNewResponseEnvelopeMessagesJSON struct { ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseEnvelopeMessagesJSON) RawJSON() string { +func (r ruleDeleteResponseEnvelopeMessagesJSON) RawJSON() string { return r.raw } // The source of this message. -type RuleNewResponseEnvelopeMessagesSource struct { +type RuleDeleteResponseEnvelopeMessagesSource struct { // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON ruleNewResponseEnvelopeMessagesSourceJSON `json:"-"` + Pointer string `json:"pointer,required"` + JSON ruleDeleteResponseEnvelopeMessagesSourceJSON `json:"-"` } -// ruleNewResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the -// struct [RuleNewResponseEnvelopeMessagesSource] -type ruleNewResponseEnvelopeMessagesSourceJSON struct { +// ruleDeleteResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the +// struct [RuleDeleteResponseEnvelopeMessagesSource] +type ruleDeleteResponseEnvelopeMessagesSourceJSON struct { Pointer apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RuleNewResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { +func (r *RuleDeleteResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r ruleNewResponseEnvelopeMessagesSourceJSON) RawJSON() string { +func (r ruleDeleteResponseEnvelopeMessagesSourceJSON) RawJSON() string { return r.raw } // Whether the API call was successful. -type RuleNewResponseEnvelopeSuccess bool +type RuleDeleteResponseEnvelopeSuccess bool const ( - RuleNewResponseEnvelopeSuccessTrue RuleNewResponseEnvelopeSuccess = true + RuleDeleteResponseEnvelopeSuccessTrue RuleDeleteResponseEnvelopeSuccess = true ) -func (r RuleNewResponseEnvelopeSuccess) IsKnown() bool { +func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { switch r { - case RuleNewResponseEnvelopeSuccessTrue: + case RuleDeleteResponseEnvelopeSuccessTrue: return true } return false } -type RuleDeleteParams struct { +type RuleEditParams 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[RuleEditParamsPositionUnion] `json:"position"` } -// A response object. -type RuleDeleteResponseEnvelope struct { - // A list of error messages. - Errors []RuleDeleteResponseEnvelopeErrors `json:"errors,required"` - // A list of warning messages. - Messages []RuleDeleteResponseEnvelopeMessages `json:"messages,required"` - // A ruleset object. - Result RuleDeleteResponse `json:"result,required"` - // Whether the API call was successful. - Success RuleDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON ruleDeleteResponseEnvelopeJSON `json:"-"` +func (r RuleEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// ruleDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [RuleDeleteResponseEnvelope] -type ruleDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field +// An object configuring where the rule will be placed. +type RuleEditParamsPosition 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 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"` + // An index at which to place the rule, where index 1 is the first rule. + Index param.Field[float64] `json:"index"` } -func (r *RuleDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r RuleEditParamsPosition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r ruleDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw +func (r RuleEditParamsPosition) implementsRulesetsRuleEditParamsPositionUnion() {} + +// An object configuring where the rule will be placed. +// +// Satisfied by [rulesets.RuleEditParamsPositionBeforePosition], +// [rulesets.RuleEditParamsPositionAfterPosition], +// [rulesets.RuleEditParamsPositionIndexPosition], [RuleEditParamsPosition]. +type RuleEditParamsPositionUnion interface { + implementsRulesetsRuleEditParamsPositionUnion() } -// A message. -type RuleDeleteResponseEnvelopeErrors struct { - // A text description of this message. - Message string `json:"message,required"` - // A unique code for this message. - Code int64 `json:"code"` - // The source of this message. - Source RuleDeleteResponseEnvelopeErrorsSource `json:"source"` - JSON ruleDeleteResponseEnvelopeErrorsJSON `json:"-"` +// 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"` } -// ruleDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [RuleDeleteResponseEnvelopeErrors] -type ruleDeleteResponseEnvelopeErrorsJSON struct { - Message apijson.Field - Code apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseEnvelopeErrorsJSON) RawJSON() string { - return r.raw -} - -// The source of this message. -type RuleDeleteResponseEnvelopeErrorsSource struct { - // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON ruleDeleteResponseEnvelopeErrorsSourceJSON `json:"-"` -} - -// ruleDeleteResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the -// struct [RuleDeleteResponseEnvelopeErrorsSource] -type ruleDeleteResponseEnvelopeErrorsSourceJSON struct { - Pointer apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseEnvelopeErrorsSourceJSON) RawJSON() string { - return r.raw -} - -// A message. -type RuleDeleteResponseEnvelopeMessages struct { - // A text description of this message. - Message string `json:"message,required"` - // A unique code for this message. - Code int64 `json:"code"` - // The source of this message. - Source RuleDeleteResponseEnvelopeMessagesSource `json:"source"` - JSON ruleDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// ruleDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the struct -// [RuleDeleteResponseEnvelopeMessages] -type ruleDeleteResponseEnvelopeMessagesJSON struct { - Message apijson.Field - Code apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseEnvelopeMessagesJSON) RawJSON() string { - return r.raw -} - -// The source of this message. -type RuleDeleteResponseEnvelopeMessagesSource struct { - // A JSON pointer to the field that is the source of the message. - Pointer string `json:"pointer,required"` - JSON ruleDeleteResponseEnvelopeMessagesSourceJSON `json:"-"` -} - -// ruleDeleteResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the -// struct [RuleDeleteResponseEnvelopeMessagesSource] -type ruleDeleteResponseEnvelopeMessagesSourceJSON struct { - Pointer apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RuleDeleteResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r ruleDeleteResponseEnvelopeMessagesSourceJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful. -type RuleDeleteResponseEnvelopeSuccess bool - -const ( - RuleDeleteResponseEnvelopeSuccessTrue RuleDeleteResponseEnvelopeSuccess = true -) - -func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RuleDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - -// This interface is a union satisfied by one of the following: -// [RuleEditParamsBlockRule], [RuleEditParamsExecuteRule], [RuleEditParamsLogRule], -// [RuleEditParamsSkipRule]. -type RuleEditParams interface { - ImplementsRuleEditParams() - - getAccountID() param.Field[string] - - getZoneID() param.Field[string] -} - -type RuleEditParamsBlockRule 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[RuleEditParamsBlockRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleEditParamsBlockRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleEditParamsBlockRule) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsPositionBeforePosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RuleEditParamsBlockRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleEditParamsBlockRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleEditParamsBlockRule) ImplementsRuleEditParams() { +func (r RuleEditParamsPositionBeforePosition) implementsRulesetsRuleEditParamsPositionUnion() {} +// 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"` } -// The action to perform when the rule matches. -type RuleEditParamsBlockRuleAction string - -const ( - RuleEditParamsBlockRuleActionBlock RuleEditParamsBlockRuleAction = "block" -) - -func (r RuleEditParamsBlockRuleAction) IsKnown() bool { - switch r { - case RuleEditParamsBlockRuleActionBlock: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditParamsBlockRuleActionParameters struct { - // The response to show when the block is applied. - Response param.Field[RuleEditParamsBlockRuleActionParametersResponse] `json:"response"` -} - -func (r RuleEditParamsBlockRuleActionParameters) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsPositionAfterPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The response to show when the block is applied. -type RuleEditParamsBlockRuleActionParametersResponse 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 RuleEditParamsPositionAfterPosition) implementsRulesetsRuleEditParamsPositionUnion() {} -func (r RuleEditParamsBlockRuleActionParametersResponse) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// 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"` } -type RuleEditParamsExecuteRule 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[RuleEditParamsExecuteRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleEditParamsExecuteRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleEditParamsExecuteRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RuleEditParamsExecuteRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleEditParamsExecuteRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleEditParamsExecuteRule) ImplementsRuleEditParams() { - -} - -// The action to perform when the rule matches. -type RuleEditParamsExecuteRuleAction string - -const ( - RuleEditParamsExecuteRuleActionExecute RuleEditParamsExecuteRuleAction = "execute" -) - -func (r RuleEditParamsExecuteRuleAction) IsKnown() bool { - switch r { - case RuleEditParamsExecuteRuleActionExecute: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditParamsExecuteRuleActionParameters 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[RuleEditParamsExecuteRuleActionParametersMatchedData] `json:"matched_data"` - // A set of overrides to apply to the target ruleset. - Overrides param.Field[RuleEditParamsExecuteRuleActionParametersOverrides] `json:"overrides"` -} - -func (r RuleEditParamsExecuteRuleActionParameters) MarshalJSON() (data []byte, err error) { +func (r RuleEditParamsPositionIndexPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The configuration to use for matched data logging. -type RuleEditParamsExecuteRuleActionParametersMatchedData struct { - // The public key to encrypt matched data logs with. - PublicKey param.Field[string] `json:"public_key,required"` -} - -func (r RuleEditParamsExecuteRuleActionParametersMatchedData) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A set of overrides to apply to the target ruleset. -type RuleEditParamsExecuteRuleActionParametersOverrides 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[[]RuleEditParamsExecuteRuleActionParametersOverridesCategory] `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[[]RuleEditParamsExecuteRuleActionParametersOverridesRule] `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[RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel] `json:"sensitivity_level"` -} - -func (r RuleEditParamsExecuteRuleActionParametersOverrides) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A category-level override -type RuleEditParamsExecuteRuleActionParametersOverridesCategory 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[RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel] `json:"sensitivity_level"` -} - -func (r RuleEditParamsExecuteRuleActionParametersOverridesCategory) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The sensitivity level to use for rules in the category. -type RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel string - -const ( - RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "default" - RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "medium" - RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "low" - RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel = "eoff" -) - -func (r RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevel) IsKnown() bool { - switch r { - case RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelDefault, RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelMedium, RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelLow, RuleEditParamsExecuteRuleActionParametersOverridesCategoriesSensitivityLevelEoff: - return true - } - return false -} - -// A rule-level override -type RuleEditParamsExecuteRuleActionParametersOverridesRule 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[RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel] `json:"sensitivity_level"` -} - -func (r RuleEditParamsExecuteRuleActionParametersOverridesRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The sensitivity level to use for the rule. -type RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel string - -const ( - RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "default" - RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "medium" - RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "low" - RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel = "eoff" -) - -func (r RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevel) IsKnown() bool { - switch r { - case RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelDefault, RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelMedium, RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelLow, RuleEditParamsExecuteRuleActionParametersOverridesRulesSensitivityLevelEoff: - 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 RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel string - -const ( - RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelDefault RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel = "default" - RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelMedium RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel = "medium" - RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelLow RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel = "low" - RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelEoff RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel = "eoff" -) - -func (r RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevel) IsKnown() bool { - switch r { - case RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelDefault, RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelMedium, RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelLow, RuleEditParamsExecuteRuleActionParametersOverridesSensitivityLevelEoff: - return true - } - return false -} - -type RuleEditParamsLogRule 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[RuleEditParamsLogRuleAction] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleEditParamsLogRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RuleEditParamsLogRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleEditParamsLogRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleEditParamsLogRule) ImplementsRuleEditParams() { - -} - -// The action to perform when the rule matches. -type RuleEditParamsLogRuleAction string - -const ( - RuleEditParamsLogRuleActionLog RuleEditParamsLogRuleAction = "log" -) - -func (r RuleEditParamsLogRuleAction) IsKnown() bool { - switch r { - case RuleEditParamsLogRuleActionLog: - return true - } - return false -} - -type RuleEditParamsSkipRule 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[RuleEditParamsSkipRuleAction] `json:"action"` - // The parameters configuring the rule's action. - ActionParameters param.Field[RuleEditParamsSkipRuleActionParameters] `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[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` - // The reference of the rule (the rule ID by default). - Ref param.Field[string] `json:"ref"` -} - -func (r RuleEditParamsSkipRule) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RuleEditParamsSkipRule) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r RuleEditParamsSkipRule) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (RuleEditParamsSkipRule) ImplementsRuleEditParams() { - -} - -// The action to perform when the rule matches. -type RuleEditParamsSkipRuleAction string - -const ( - RuleEditParamsSkipRuleActionSkip RuleEditParamsSkipRuleAction = "skip" -) - -func (r RuleEditParamsSkipRuleAction) IsKnown() bool { - switch r { - case RuleEditParamsSkipRuleActionSkip: - return true - } - return false -} - -// The parameters configuring the rule's action. -type RuleEditParamsSkipRuleActionParameters struct { - // A list of phases to skip the execution of. This option is incompatible with the - // ruleset and rulesets options. - Phases param.Field[[]RuleEditParamsSkipRuleActionParametersPhase] `json:"phases"` - // A list of legacy security products to skip the execution of. - Products param.Field[[]RuleEditParamsSkipRuleActionParametersProduct] `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[RuleEditParamsSkipRuleActionParametersRuleset] `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 RuleEditParamsSkipRuleActionParameters) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A phase to skip the execution of. -type RuleEditParamsSkipRuleActionParametersPhase string - -const ( - RuleEditParamsSkipRuleActionParametersPhaseDDoSL4 RuleEditParamsSkipRuleActionParametersPhase = "ddos_l4" - RuleEditParamsSkipRuleActionParametersPhaseDDoSL7 RuleEditParamsSkipRuleActionParametersPhase = "ddos_l7" - RuleEditParamsSkipRuleActionParametersPhaseHTTPConfigSettings RuleEditParamsSkipRuleActionParametersPhase = "http_config_settings" - RuleEditParamsSkipRuleActionParametersPhaseHTTPCustomErrors RuleEditParamsSkipRuleActionParametersPhase = "http_custom_errors" - RuleEditParamsSkipRuleActionParametersPhaseHTTPLogCustomFields RuleEditParamsSkipRuleActionParametersPhase = "http_log_custom_fields" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRatelimit RuleEditParamsSkipRuleActionParametersPhase = "http_ratelimit" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestCacheSettings RuleEditParamsSkipRuleActionParametersPhase = "http_request_cache_settings" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect RuleEditParamsSkipRuleActionParametersPhase = "http_request_dynamic_redirect" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom RuleEditParamsSkipRuleActionParametersPhase = "http_request_firewall_custom" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged RuleEditParamsSkipRuleActionParametersPhase = "http_request_firewall_managed" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestLateTransform RuleEditParamsSkipRuleActionParametersPhase = "http_request_late_transform" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestOrigin RuleEditParamsSkipRuleActionParametersPhase = "http_request_origin" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestRedirect RuleEditParamsSkipRuleActionParametersPhase = "http_request_redirect" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSanitize RuleEditParamsSkipRuleActionParametersPhase = "http_request_sanitize" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSbfm RuleEditParamsSkipRuleActionParametersPhase = "http_request_sbfm" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration RuleEditParamsSkipRuleActionParametersPhase = "http_request_select_configuration" - RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestTransform RuleEditParamsSkipRuleActionParametersPhase = "http_request_transform" - RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseCompression RuleEditParamsSkipRuleActionParametersPhase = "http_response_compression" - RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged RuleEditParamsSkipRuleActionParametersPhase = "http_response_firewall_managed" - RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform RuleEditParamsSkipRuleActionParametersPhase = "http_response_headers_transform" - RuleEditParamsSkipRuleActionParametersPhaseMagicTransit RuleEditParamsSkipRuleActionParametersPhase = "magic_transit" - RuleEditParamsSkipRuleActionParametersPhaseMagicTransitIDsManaged RuleEditParamsSkipRuleActionParametersPhase = "magic_transit_ids_managed" - RuleEditParamsSkipRuleActionParametersPhaseMagicTransitManaged RuleEditParamsSkipRuleActionParametersPhase = "magic_transit_managed" -) - -func (r RuleEditParamsSkipRuleActionParametersPhase) IsKnown() bool { - switch r { - case RuleEditParamsSkipRuleActionParametersPhaseDDoSL4, RuleEditParamsSkipRuleActionParametersPhaseDDoSL7, RuleEditParamsSkipRuleActionParametersPhaseHTTPConfigSettings, RuleEditParamsSkipRuleActionParametersPhaseHTTPCustomErrors, RuleEditParamsSkipRuleActionParametersPhaseHTTPLogCustomFields, RuleEditParamsSkipRuleActionParametersPhaseHTTPRatelimit, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestCacheSettings, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestFirewallCustom, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestFirewallManaged, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestLateTransform, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestOrigin, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestRedirect, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSanitize, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSbfm, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, RuleEditParamsSkipRuleActionParametersPhaseHTTPRequestTransform, RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseCompression, RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseFirewallManaged, RuleEditParamsSkipRuleActionParametersPhaseHTTPResponseHeadersTransform, RuleEditParamsSkipRuleActionParametersPhaseMagicTransit, RuleEditParamsSkipRuleActionParametersPhaseMagicTransitIDsManaged, RuleEditParamsSkipRuleActionParametersPhaseMagicTransitManaged: - return true - } - return false -} - -// The name of a legacy security product to skip the execution of. -type RuleEditParamsSkipRuleActionParametersProduct string - -const ( - RuleEditParamsSkipRuleActionParametersProductBic RuleEditParamsSkipRuleActionParametersProduct = "bic" - RuleEditParamsSkipRuleActionParametersProductHot RuleEditParamsSkipRuleActionParametersProduct = "hot" - RuleEditParamsSkipRuleActionParametersProductRateLimit RuleEditParamsSkipRuleActionParametersProduct = "rateLimit" - RuleEditParamsSkipRuleActionParametersProductSecurityLevel RuleEditParamsSkipRuleActionParametersProduct = "securityLevel" - RuleEditParamsSkipRuleActionParametersProductUABlock RuleEditParamsSkipRuleActionParametersProduct = "uaBlock" - RuleEditParamsSkipRuleActionParametersProductWAF RuleEditParamsSkipRuleActionParametersProduct = "waf" - RuleEditParamsSkipRuleActionParametersProductZoneLockdown RuleEditParamsSkipRuleActionParametersProduct = "zoneLockdown" -) - -func (r RuleEditParamsSkipRuleActionParametersProduct) IsKnown() bool { - switch r { - case RuleEditParamsSkipRuleActionParametersProductBic, RuleEditParamsSkipRuleActionParametersProductHot, RuleEditParamsSkipRuleActionParametersProductRateLimit, RuleEditParamsSkipRuleActionParametersProductSecurityLevel, RuleEditParamsSkipRuleActionParametersProductUABlock, RuleEditParamsSkipRuleActionParametersProductWAF, RuleEditParamsSkipRuleActionParametersProductZoneLockdown: - return true - } - return false -} - -// A ruleset to skip the execution of. This option is incompatible with the -// rulesets, rules and phases options. -type RuleEditParamsSkipRuleActionParametersRuleset string - -const ( - RuleEditParamsSkipRuleActionParametersRulesetCurrent RuleEditParamsSkipRuleActionParametersRuleset = "current" -) - -func (r RuleEditParamsSkipRuleActionParametersRuleset) IsKnown() bool { - switch r { - case RuleEditParamsSkipRuleActionParametersRulesetCurrent: - return true - } - return false -} +func (r RuleEditParamsPositionIndexPosition) implementsRulesetsRuleEditParamsPositionUnion() {} // A response object. type RuleEditResponseEnvelope struct { diff --git a/rulesets/rule_test.go b/rulesets/rule_test.go index 06e5ab56795..d50048511c2 100644 --- a/rulesets/rule_test.go +++ b/rulesets/rule_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/rulesets" @@ -32,25 +31,12 @@ func TestRuleNewWithOptionalParams(t *testing.T) { _, err := client.Rulesets.Rules.New( context.TODO(), "2f2feab2026849078ba485f918791bdc", - rulesets.RuleNewParamsBlockRule{ + rulesets.RuleNewParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Action: cloudflare.F(rulesets.RuleNewParamsBlockRuleActionBlock), - ActionParameters: cloudflare.F(rulesets.RuleNewParamsBlockRuleActionParameters{ - Response: cloudflare.F(rulesets.RuleNewParamsBlockRuleActionParametersResponse{ - Content: cloudflare.F("{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}"), - ContentType: cloudflare.F("application/json"), - StatusCode: cloudflare.F(int64(400)), - }), + Position: cloudflare.F[rulesets.RuleNewParamsPositionUnion](rulesets.RuleNewParamsPositionBeforePosition{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), }), - 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(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ - Enabled: cloudflare.F(true), - }), - Ref: cloudflare.F("my_ref"), }, ) if err != nil { @@ -112,25 +98,12 @@ func TestRuleEditWithOptionalParams(t *testing.T) { context.TODO(), "2f2feab2026849078ba485f918791bdc", "3a03d665bac047339bb530ecb439a90d", - rulesets.RuleEditParamsBlockRule{ + rulesets.RuleEditParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Action: cloudflare.F(rulesets.RuleEditParamsBlockRuleActionBlock), - ActionParameters: cloudflare.F(rulesets.RuleEditParamsBlockRuleActionParameters{ - Response: cloudflare.F(rulesets.RuleEditParamsBlockRuleActionParametersResponse{ - 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(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ - Enabled: cloudflare.F(true), + Position: cloudflare.F[rulesets.RuleEditParamsPositionUnion](rulesets.RuleEditParamsPositionBeforePosition{ + Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), }), - Ref: cloudflare.F("my_ref"), }, ) if err != nil { diff --git a/rulesets/ruleset.go b/rulesets/ruleset.go index ed89a3ef906..6026da31fe4 100644 --- a/rulesets/ruleset.go +++ b/rulesets/ruleset.go @@ -13,7 +13,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -367,7 +366,7 @@ type RulesetNewResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -576,7 +575,7 @@ type RulesetUpdateResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -785,7 +784,7 @@ type RulesetGetResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. @@ -969,7 +968,7 @@ type RulesetNewParamsRule struct { // The unique ID of the rule. ID param.Field[string] `json:"id"` // An object configuring the rule's logging behavior. - Logging param.Field[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } @@ -1190,7 +1189,7 @@ type RulesetUpdateParamsRule struct { // The unique ID of the rule. ID param.Field[string] `json:"id"` // An object configuring the rule's logging behavior. - Logging param.Field[shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam] `json:"logging"` + Logging param.Field[LoggingParam] `json:"logging"` // The reference of the rule (the rule ID by default). Ref param.Field[string] `json:"ref"` } diff --git a/rulesets/ruleset_test.go b/rulesets/ruleset_test.go index aab84b378d6..56bc36baf44 100644 --- a/rulesets/ruleset_test.go +++ b/rulesets/ruleset_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/rulesets" @@ -46,7 +45,7 @@ func TestRulesetNewWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -63,7 +62,7 @@ func TestRulesetNewWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -80,7 +79,7 @@ func TestRulesetNewWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -129,7 +128,7 @@ func TestRulesetUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -146,7 +145,7 @@ func TestRulesetUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), @@ -163,7 +162,7 @@ func TestRulesetUpdateWithOptionalParams(t *testing.T) { Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src ne 1.1.1.1"), ID: cloudflare.F("3a03d665bac047339bb530ecb439a90d"), - Logging: cloudflare.F(shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam{ + Logging: cloudflare.F(rulesets.LoggingParam{ Enabled: cloudflare.F(true), }), Ref: cloudflare.F("my_ref"), diff --git a/rulesets/version.go b/rulesets/version.go index f3f25ce985a..ec98eff348a 100644 --- a/rulesets/version.go +++ b/rulesets/version.go @@ -13,7 +13,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -224,7 +223,7 @@ type VersionGetResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. diff --git a/rulesets/versionbytag.go b/rulesets/versionbytag.go index b18f97eeb8e..f88cc18ea3f 100644 --- a/rulesets/versionbytag.go +++ b/rulesets/versionbytag.go @@ -12,7 +12,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/tidwall/gjson" ) @@ -163,7 +162,7 @@ type VersionByTagGetResponseRule struct { // The timestamp of when the rule was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // An object configuring the rule's logging behavior. - Logging shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c `json:"logging"` + Logging Logging `json:"logging"` // The reference of the rule (the rule ID by default). Ref string `json:"ref"` // The version of the rule. diff --git a/rum/aliases.go b/rum/aliases.go index c16839e89f8..c5ab0f6d4fa 100644 --- a/rum/aliases.go +++ b/rum/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/secondary_dns/acl.go b/secondary_dns/acl.go index cfac1b7b419..cce73998052 100644 --- a/secondary_dns/acl.go +++ b/secondary_dns/acl.go @@ -137,6 +137,21 @@ func (r aclJSON) RawJSON() string { return r.raw } +type ACLParam struct { + // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will + // be applied for the entire account. The IP range is used to allow additional + // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from + // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for + // IPv6 respectively. + IPRange param.Field[string] `json:"ip_range,required"` + // The name of the acl. + Name param.Field[string] `json:"name,required"` +} + +func (r ACLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type ACLDeleteResponse struct { ID string `json:"id"` JSON aclDeleteResponseJSON `json:"-"` @@ -159,8 +174,8 @@ func (r aclDeleteResponseJSON) RawJSON() string { } type ACLNewParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ACLNewParams) MarshalJSON() (data []byte, err error) { @@ -212,18 +227,11 @@ func (r ACLNewResponseEnvelopeSuccess) IsKnown() bool { type ACLUpdateParams struct { AccountID param.Field[string] `path:"account_id,required"` - // Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will - // be applied for the entire account. The IP range is used to allow additional - // NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from - // for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for - // IPv6 respectively. - IPRange param.Field[string] `json:"ip_range,required"` - // The name of the acl. - Name param.Field[string] `json:"name,required"` + ACL ACLParam `json:"acl,required"` } func (r ACLUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.ACL) } type ACLUpdateResponseEnvelope struct { @@ -274,8 +282,8 @@ type ACLListParams struct { } type ACLDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ACLDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/acl_test.go b/secondary_dns/acl_test.go index 5b1c8705b47..c63989f7f30 100644 --- a/secondary_dns/acl_test.go +++ b/secondary_dns/acl_test.go @@ -30,7 +30,7 @@ func TestACLNew(t *testing.T) { ) _, err := client.SecondaryDNS.ACLs.New(context.TODO(), secondary_dns.ACLNewParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -60,8 +60,10 @@ func TestACLUpdate(t *testing.T) { "23ff594956f20c2a721606e94745a8aa", secondary_dns.ACLUpdateParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - IPRange: cloudflare.F("192.0.2.53/28"), - Name: cloudflare.F("my-acl-1"), + ACL: secondary_dns.ACLParam{ + IPRange: cloudflare.F("192.0.2.53/28"), + Name: cloudflare.F("my-acl-1"), + }, }, ) if err != nil { @@ -118,7 +120,7 @@ func TestACLDelete(t *testing.T) { "23ff594956f20c2a721606e94745a8aa", secondary_dns.ACLDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/secondary_dns/aliases.go b/secondary_dns/aliases.go index bf7a9080c7b..fc777073188 100644 --- a/secondary_dns/aliases.go +++ b/secondary_dns/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/secondary_dns/forceaxfr.go b/secondary_dns/forceaxfr.go index 53c34e9a5e6..49d3dd13ce4 100644 --- a/secondary_dns/forceaxfr.go +++ b/secondary_dns/forceaxfr.go @@ -47,8 +47,8 @@ func (r *ForceAXFRService) New(ctx context.Context, params ForceAXFRNewParams, o type ForceAXFR = string type ForceAXFRNewParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r ForceAXFRNewParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/forceaxfr_test.go b/secondary_dns/forceaxfr_test.go index 5863b58da23..ca75a7e43bc 100644 --- a/secondary_dns/forceaxfr_test.go +++ b/secondary_dns/forceaxfr_test.go @@ -30,7 +30,7 @@ func TestForceAXFRNew(t *testing.T) { ) _, err := client.SecondaryDNS.ForceAXFR.New(context.TODO(), secondary_dns.ForceAXFRNewParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/secondary_dns/incoming.go b/secondary_dns/incoming.go index 1b16f6ce41f..f7afdfb69ff 100644 --- a/secondary_dns/incoming.go +++ b/secondary_dns/incoming.go @@ -350,8 +350,8 @@ func (r IncomingUpdateResponseEnvelopeSuccess) IsKnown() bool { } type IncomingDeleteParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r IncomingDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/incoming_test.go b/secondary_dns/incoming_test.go index e5e743ee038..14759a57c91 100644 --- a/secondary_dns/incoming_test.go +++ b/secondary_dns/incoming_test.go @@ -88,7 +88,7 @@ func TestIncomingDelete(t *testing.T) { ) _, err := client.SecondaryDNS.Incoming.Delete(context.TODO(), secondary_dns.IncomingDeleteParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/secondary_dns/outgoing.go b/secondary_dns/outgoing.go index ed61f65e058..8c8857b2789 100644 --- a/secondary_dns/outgoing.go +++ b/secondary_dns/outgoing.go @@ -378,8 +378,8 @@ func (r OutgoingUpdateResponseEnvelopeSuccess) IsKnown() bool { } type OutgoingDeleteParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r OutgoingDeleteParams) MarshalJSON() (data []byte, err error) { @@ -430,8 +430,8 @@ func (r OutgoingDeleteResponseEnvelopeSuccess) IsKnown() bool { } type OutgoingDisableParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r OutgoingDisableParams) MarshalJSON() (data []byte, err error) { @@ -483,8 +483,8 @@ func (r OutgoingDisableResponseEnvelopeSuccess) IsKnown() bool { } type OutgoingEnableParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r OutgoingEnableParams) MarshalJSON() (data []byte, err error) { @@ -536,8 +536,8 @@ func (r OutgoingEnableResponseEnvelopeSuccess) IsKnown() bool { } type OutgoingForceNotifyParams struct { - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r OutgoingForceNotifyParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/outgoing_test.go b/secondary_dns/outgoing_test.go index 4e7c551a3f5..b8354c90450 100644 --- a/secondary_dns/outgoing_test.go +++ b/secondary_dns/outgoing_test.go @@ -86,7 +86,7 @@ func TestOutgoingDelete(t *testing.T) { ) _, err := client.SecondaryDNS.Outgoing.Delete(context.TODO(), secondary_dns.OutgoingDeleteParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -113,7 +113,7 @@ func TestOutgoingDisable(t *testing.T) { ) _, err := client.SecondaryDNS.Outgoing.Disable(context.TODO(), secondary_dns.OutgoingDisableParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -140,7 +140,7 @@ func TestOutgoingEnable(t *testing.T) { ) _, err := client.SecondaryDNS.Outgoing.Enable(context.TODO(), secondary_dns.OutgoingEnableParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -167,7 +167,7 @@ func TestOutgoingForceNotify(t *testing.T) { ) _, err := client.SecondaryDNS.Outgoing.ForceNotify(context.TODO(), secondary_dns.OutgoingForceNotifyParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/secondary_dns/peer.go b/secondary_dns/peer.go index 7e2e40eb559..4f17401a1d1 100644 --- a/secondary_dns/peer.go +++ b/secondary_dns/peer.go @@ -148,6 +148,29 @@ func (r peerJSON) RawJSON() string { return r.raw } +type PeerParam struct { + // The name of the peer. + Name param.Field[string] `json:"name,required"` + // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone + // this peer is linked to. For primary zones this IP defines the IP of the + // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary + // zones this IP defines the IP of the primary nameserver Cloudflare will send + // AXFR/IXFR requests to. + IP param.Field[string] `json:"ip"` + // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary + // zones. + IxfrEnable param.Field[bool] `json:"ixfr_enable"` + // DNS port of primary or secondary nameserver, depending on what zone this peer is + // linked to. + Port param.Field[float64] `json:"port"` + // TSIG authentication will be used for zone transfer if configured. + TSIGID param.Field[string] `json:"tsig_id"` +} + +func (r PeerParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type PeerDeleteResponse struct { ID string `json:"id"` JSON peerDeleteResponseJSON `json:"-"` @@ -170,8 +193,8 @@ func (r peerDeleteResponseJSON) RawJSON() string { } type PeerNewParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r PeerNewParams) MarshalJSON() (data []byte, err error) { @@ -223,26 +246,11 @@ func (r PeerNewResponseEnvelopeSuccess) IsKnown() bool { type PeerUpdateParams struct { AccountID param.Field[string] `path:"account_id,required"` - // The name of the peer. - Name param.Field[string] `json:"name,required"` - // IPv4/IPv6 address of primary or secondary nameserver, depending on what zone - // this peer is linked to. For primary zones this IP defines the IP of the - // secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary - // zones this IP defines the IP of the primary nameserver Cloudflare will send - // AXFR/IXFR requests to. - IP param.Field[string] `json:"ip"` - // Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary - // zones. - IxfrEnable param.Field[bool] `json:"ixfr_enable"` - // DNS port of primary or secondary nameserver, depending on what zone this peer is - // linked to. - Port param.Field[float64] `json:"port"` - // TSIG authentication will be used for zone transfer if configured. - TSIGID param.Field[string] `json:"tsig_id"` + Peer PeerParam `json:"peer,required"` } func (r PeerUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.Peer) } type PeerUpdateResponseEnvelope struct { @@ -293,8 +301,8 @@ type PeerListParams struct { } type PeerDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r PeerDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/peer_test.go b/secondary_dns/peer_test.go index 398a7245455..0142a0d7aef 100644 --- a/secondary_dns/peer_test.go +++ b/secondary_dns/peer_test.go @@ -30,7 +30,7 @@ func TestPeerNew(t *testing.T) { ) _, err := client.SecondaryDNS.Peers.New(context.TODO(), secondary_dns.PeerNewParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -59,12 +59,14 @@ func TestPeerUpdateWithOptionalParams(t *testing.T) { context.TODO(), "23ff594956f20c2a721606e94745a8aa", secondary_dns.PeerUpdateParams{ - AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Name: cloudflare.F("my-peer-1"), - IP: cloudflare.F("192.0.2.53"), - IxfrEnable: cloudflare.F(false), - Port: cloudflare.F(53.000000), - TSIGID: cloudflare.F("69cd1e104af3e6ed3cb344f263fd0d5a"), + AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), + Peer: secondary_dns.PeerParam{ + IP: cloudflare.F("192.0.2.53"), + IxfrEnable: cloudflare.F(false), + Name: cloudflare.F("my-peer-1"), + Port: cloudflare.F(53.000000), + TSIGID: cloudflare.F("69cd1e104af3e6ed3cb344f263fd0d5a"), + }, }, ) if err != nil { @@ -121,7 +123,7 @@ func TestPeerDelete(t *testing.T) { "23ff594956f20c2a721606e94745a8aa", secondary_dns.PeerDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/secondary_dns/tsig.go b/secondary_dns/tsig.go index 5a8ec1e2936..3ef653747fb 100644 --- a/secondary_dns/tsig.go +++ b/secondary_dns/tsig.go @@ -136,6 +136,19 @@ func (r tsigJSON) RawJSON() string { return r.raw } +type TSIGParam struct { + // TSIG algorithm. + Algo param.Field[string] `json:"algo,required"` + // TSIG key name. + Name param.Field[string] `json:"name,required"` + // TSIG secret. + Secret param.Field[string] `json:"secret,required"` +} + +func (r TSIGParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type TSIGDeleteResponse struct { ID string `json:"id"` JSON tsigDeleteResponseJSON `json:"-"` @@ -159,16 +172,11 @@ func (r tsigDeleteResponseJSON) RawJSON() string { type TSIGNewParams struct { AccountID param.Field[string] `path:"account_id,required"` - // TSIG algorithm. - Algo param.Field[string] `json:"algo,required"` - // TSIG key name. - Name param.Field[string] `json:"name,required"` - // TSIG secret. - Secret param.Field[string] `json:"secret,required"` + TSIG TSIGParam `json:"tsig,required"` } func (r TSIGNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.TSIG) } type TSIGNewResponseEnvelope struct { @@ -216,16 +224,11 @@ func (r TSIGNewResponseEnvelopeSuccess) IsKnown() bool { type TSIGUpdateParams struct { AccountID param.Field[string] `path:"account_id,required"` - // TSIG algorithm. - Algo param.Field[string] `json:"algo,required"` - // TSIG key name. - Name param.Field[string] `json:"name,required"` - // TSIG secret. - Secret param.Field[string] `json:"secret,required"` + TSIG TSIGParam `json:"tsig,required"` } func (r TSIGUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.TSIG) } type TSIGUpdateResponseEnvelope struct { @@ -276,8 +279,8 @@ type TSIGListParams struct { } type TSIGDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r TSIGDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/secondary_dns/tsig_test.go b/secondary_dns/tsig_test.go index 65988318c90..a3777afb610 100644 --- a/secondary_dns/tsig_test.go +++ b/secondary_dns/tsig_test.go @@ -30,9 +30,11 @@ func TestTSIGNew(t *testing.T) { ) _, err := client.SecondaryDNS.TSIGs.New(context.TODO(), secondary_dns.TSIGNewParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Algo: cloudflare.F("hmac-sha512."), - Name: cloudflare.F("tsig.customer.cf."), - Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + TSIG: secondary_dns.TSIGParam{ + Algo: cloudflare.F("hmac-sha512."), + Name: cloudflare.F("tsig.customer.cf."), + Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + }, }) if err != nil { var apierr *cloudflare.Error @@ -62,9 +64,11 @@ func TestTSIGUpdate(t *testing.T) { "69cd1e104af3e6ed3cb344f263fd0d5a", secondary_dns.TSIGUpdateParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Algo: cloudflare.F("hmac-sha512."), - Name: cloudflare.F("tsig.customer.cf."), - Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + TSIG: secondary_dns.TSIGParam{ + Algo: cloudflare.F("hmac-sha512."), + Name: cloudflare.F("tsig.customer.cf."), + Secret: cloudflare.F("caf79a7804b04337c9c66ccd7bef9190a1e1679b5dd03d8aa10f7ad45e1a9dab92b417896c15d4d007c7c14194538d2a5d0feffdecc5a7f0e1c570cfa700837c"), + }, }, ) if err != nil { @@ -121,7 +125,7 @@ func TestTSIGDelete(t *testing.T) { "69cd1e104af3e6ed3cb344f263fd0d5a", secondary_dns.TSIGDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/snippets/aliases.go b/snippets/aliases.go index f5225492923..c2a336f6536 100644 --- a/snippets/aliases.go +++ b/snippets/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/spectrum/aliases.go b/spectrum/aliases.go index e3e8d5b2490..de6522f7e77 100644 --- a/spectrum/aliases.go +++ b/spectrum/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/spectrum/app.go b/spectrum/app.go index 6eed39c56bb..7bc29137044 100644 --- a/spectrum/app.go +++ b/spectrum/app.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,6 +17,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // AppService contains methods and other services that help with interacting with @@ -100,7 +102,7 @@ func (r *AppService) Delete(ctx context.Context, zone string, appID string, body } // Gets the application configuration of a specific application inside a zone. -func (r *AppService) Get(ctx context.Context, zone string, appID string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AppService) Get(ctx context.Context, zone string, appID string, opts ...option.RequestOption) (res *AppGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AppGetResponseEnvelope path := fmt.Sprintf("zones/%s/spectrum/apps/%s", zone, appID) @@ -399,6 +401,22 @@ func (r appDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [spectrum.AppGetResponseUnknown] or [shared.UnionString]. +type AppGetResponseUnion interface { + ImplementsSpectrumAppGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AppGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AppNewParams struct { // The name and type of DNS record for the Spectrum application. DNS param.Field[DNSParam] `json:"dns,required"` @@ -744,7 +762,7 @@ func (r AppListParamsOrder) IsKnown() bool { } type AppDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r AppDeleteParams) MarshalJSON() (data []byte, err error) { @@ -795,9 +813,9 @@ func (r AppDeleteResponseEnvelopeSuccess) IsKnown() bool { } type AppGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AppGetResponseUnion `json:"result,required"` // Whether the API call was successful Success AppGetResponseEnvelopeSuccess `json:"success,required"` JSON appGetResponseEnvelopeJSON `json:"-"` diff --git a/spectrum/app_test.go b/spectrum/app_test.go index 43539d1fbca..ed334b07c38 100644 --- a/spectrum/app_test.go +++ b/spectrum/app_test.go @@ -166,7 +166,7 @@ func TestAppDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "ea95132c15732412d22c1476fa83f27a", spectrum.AppDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/speed/aliases.go b/speed/aliases.go index 9d233d5f515..3e2d262f34f 100644 --- a/speed/aliases.go +++ b/speed/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/ssl/aliases.go b/ssl/aliases.go index be0213bff2e..1043520850f 100644 --- a/ssl/aliases.go +++ b/ssl/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/ssl/analyze.go b/ssl/analyze.go index d906866df8f..a75c6056413 100644 --- a/ssl/analyze.go +++ b/ssl/analyze.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/custom_hostnames" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // AnalyzeService contains methods and other services that help with interacting @@ -34,7 +36,7 @@ func NewAnalyzeService(opts ...option.RequestOption) (r *AnalyzeService) { // Returns the set of hostnames, the signature algorithm, and the expiration date // of the certificate. -func (r *AnalyzeService) New(ctx context.Context, params AnalyzeNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AnalyzeService) New(ctx context.Context, params AnalyzeNewParams, opts ...option.RequestOption) (res *AnalyzeNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AnalyzeNewResponseEnvelope path := fmt.Sprintf("zones/%s/ssl/analyze", params.ZoneID) @@ -46,6 +48,22 @@ func (r *AnalyzeService) New(ctx context.Context, params AnalyzeNewParams, opts return } +// Union satisfied by [ssl.AnalyzeNewResponseUnknown] or [shared.UnionString]. +type AnalyzeNewResponseUnion interface { + ImplementsSSLAnalyzeNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AnalyzeNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AnalyzeNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -53,7 +71,7 @@ type AnalyzeNewParams struct { // even by clients using outdated or unusual trust stores. An optimal bundle uses // the shortest chain and newest intermediates. And the force bundle verifies the // chain, but does not otherwise modify it. - BundleMethod param.Field[custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1] `json:"bundle_method"` + BundleMethod param.Field[custom_hostnames.BundleMethod] `json:"bundle_method"` // The zone's SSL certificate or certificate and the intermediate(s). Certificate param.Field[string] `json:"certificate"` } @@ -63,9 +81,9 @@ func (r AnalyzeNewParams) MarshalJSON() (data []byte, err error) { } type AnalyzeNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AnalyzeNewResponseUnion `json:"result,required"` // Whether the API call was successful Success AnalyzeNewResponseEnvelopeSuccess `json:"success,required"` JSON analyzeNewResponseEnvelopeJSON `json:"-"` diff --git a/ssl/analyze_test.go b/ssl/analyze_test.go index f035f05da86..85029b4549b 100644 --- a/ssl/analyze_test.go +++ b/ssl/analyze_test.go @@ -31,7 +31,7 @@ func TestAnalyzeNewWithOptionalParams(t *testing.T) { ) _, err := client.SSL.Analyze.New(context.TODO(), ssl.AnalyzeNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - BundleMethod: cloudflare.F(custom_hostnames.UnnamedSchemaRef16aca57bde2963201c7e6e895436c1c1Ubiquitous), + BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), Certificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n"), }) if err != nil { diff --git a/ssl/certificatepack.go b/ssl/certificatepack.go index eeb592c63e6..ce48fca68fc 100644 --- a/ssl/certificatepack.go +++ b/ssl/certificatepack.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // CertificatePackService contains methods and other services that help with @@ -91,7 +93,7 @@ func (r *CertificatePackService) Edit(ctx context.Context, certificatePackID str } // For a given zone, get a certificate pack. -func (r *CertificatePackService) Get(ctx context.Context, certificatePackID string, query CertificatePackGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *CertificatePackService) Get(ctx context.Context, certificatePackID string, query CertificatePackGetParams, opts ...option.RequestOption) (res *CertificatePackGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env CertificatePackGetResponseEnvelope path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", query.ZoneID, certificatePackID) @@ -281,6 +283,23 @@ func (r CertificatePackEditResponseValidityDays) IsKnown() bool { return false } +// Union satisfied by [ssl.CertificatePackGetResponseUnknown] or +// [shared.UnionString]. +type CertificatePackGetResponseUnion interface { + ImplementsSSLCertificatePackGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*CertificatePackGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type CertificatePackListParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -314,8 +333,8 @@ func (r CertificatePackListParamsStatus) IsKnown() bool { type CertificatePackDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r CertificatePackDeleteParams) MarshalJSON() (data []byte, err error) { @@ -367,8 +386,8 @@ func (r CertificatePackDeleteResponseEnvelopeSuccess) IsKnown() bool { type CertificatePackEditParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r CertificatePackEditParams) MarshalJSON() (data []byte, err error) { @@ -424,9 +443,9 @@ type CertificatePackGetParams struct { } type CertificatePackGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CertificatePackGetResponseUnion `json:"result,required"` // Whether the API call was successful Success CertificatePackGetResponseEnvelopeSuccess `json:"success,required"` JSON certificatePackGetResponseEnvelopeJSON `json:"-"` diff --git a/ssl/certificatepack_test.go b/ssl/certificatepack_test.go index 57e3d16a35b..b4b22045431 100644 --- a/ssl/certificatepack_test.go +++ b/ssl/certificatepack_test.go @@ -60,7 +60,7 @@ func TestCertificatePackDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", ssl.CertificatePackDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -91,7 +91,7 @@ func TestCertificatePackEdit(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", ssl.CertificatePackEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/ssl/universalsetting.go b/ssl/universalsetting.go index ddaabe07e9d..680b55681c8 100644 --- a/ssl/universalsetting.go +++ b/ssl/universalsetting.go @@ -104,9 +104,7 @@ func (r universalSSLSettingsJSON) RawJSON() string { return r.raw } -type UniversalSettingEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` +type UniversalSSLSettingsParam struct { // Disabling Universal SSL removes any currently active Universal SSL certificates // for your zone from the edge and prevents any future Universal SSL certificates // from being ordered. If there are no advanced certificates or custom certificates @@ -135,10 +133,20 @@ type UniversalSettingEditParams struct { Enabled param.Field[bool] `json:"enabled"` } -func (r UniversalSettingEditParams) MarshalJSON() (data []byte, err error) { +func (r UniversalSSLSettingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +type UniversalSettingEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + UniversalSSLSettings UniversalSSLSettingsParam `json:"universal_ssl_settings,required"` +} + +func (r UniversalSettingEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.UniversalSSLSettings) +} + type UniversalSettingEditResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/ssl/universalsetting_test.go b/ssl/universalsetting_test.go index 9497bac7a29..75145922e9d 100644 --- a/ssl/universalsetting_test.go +++ b/ssl/universalsetting_test.go @@ -29,8 +29,10 @@ func TestUniversalSettingEditWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.SSL.Universal.Settings.Edit(context.TODO(), ssl.UniversalSettingEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Enabled: cloudflare.F(true), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + UniversalSSLSettings: ssl.UniversalSSLSettingsParam{ + Enabled: cloudflare.F(true), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/storage/aliases.go b/storage/aliases.go index 4d11466ac89..c437bee2072 100644 --- a/storage/aliases.go +++ b/storage/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/stream/aliases.go b/stream/aliases.go index e4e99e514b3..17dcb9e921b 100644 --- a/stream/aliases.go +++ b/stream/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/stream/caption.go b/stream/caption.go index 805b1b34639..405ce9d065f 100644 --- a/stream/caption.go +++ b/stream/caption.go @@ -35,7 +35,7 @@ func NewCaptionService(opts ...option.RequestOption) (r *CaptionService) { // Uploads the caption or subtitle file to the endpoint for a specific BCP47 // language. One caption or subtitle file per language is allowed. -func (r *CaptionService) Update(ctx context.Context, identifier string, language string, params CaptionUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *CaptionService) Update(ctx context.Context, identifier string, language string, params CaptionUpdateParams, opts ...option.RequestOption) (res *CaptionUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env CaptionUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", params.AccountID, identifier, language) @@ -97,6 +97,23 @@ func (r captionJSON) RawJSON() string { return r.raw } +// Union satisfied by [stream.CaptionUpdateResponseUnknown] or +// [shared.UnionString]. +type CaptionUpdateResponseUnion interface { + ImplementsStreamCaptionUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*CaptionUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + // Union satisfied by [stream.CaptionDeleteResponseUnknown], // [stream.CaptionDeleteResponseArray] or [shared.UnionString]. type CaptionDeleteResponseUnion interface { @@ -134,9 +151,9 @@ func (r CaptionUpdateParams) MarshalJSON() (data []byte, err error) { } type CaptionUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result CaptionUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success CaptionUpdateResponseEnvelopeSuccess `json:"success,required"` JSON captionUpdateResponseEnvelopeJSON `json:"-"` @@ -178,8 +195,8 @@ func (r CaptionUpdateResponseEnvelopeSuccess) IsKnown() bool { type CaptionDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r CaptionDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/stream/caption_test.go b/stream/caption_test.go index 429b4f5830e..4d28e941c82 100644 --- a/stream/caption_test.go +++ b/stream/caption_test.go @@ -66,7 +66,7 @@ func TestCaptionDelete(t *testing.T) { "tr", stream.CaptionDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/download.go b/stream/download.go index c22f5afb9bc..52a1f07af4c 100644 --- a/stream/download.go +++ b/stream/download.go @@ -34,7 +34,7 @@ func NewDownloadService(opts ...option.RequestOption) (r *DownloadService) { } // Creates a download for a video when a video is ready to view. -func (r *DownloadService) New(ctx context.Context, identifier string, params DownloadNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DownloadService) New(ctx context.Context, identifier string, params DownloadNewParams, opts ...option.RequestOption) (res *DownloadNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DownloadNewResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/%s/downloads", params.AccountID, identifier) @@ -60,7 +60,7 @@ func (r *DownloadService) Delete(ctx context.Context, identifier string, body Do } // Lists the downloads created for a video. -func (r *DownloadService) Get(ctx context.Context, identifier string, query DownloadGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DownloadService) Get(ctx context.Context, identifier string, query DownloadGetParams, opts ...option.RequestOption) (res *DownloadGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DownloadGetResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/%s/downloads", query.AccountID, identifier) @@ -72,6 +72,22 @@ func (r *DownloadService) Get(ctx context.Context, identifier string, query Down return } +// Union satisfied by [stream.DownloadNewResponseUnknown] or [shared.UnionString]. +type DownloadNewResponseUnion interface { + ImplementsStreamDownloadNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DownloadNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + // Union satisfied by [stream.DownloadDeleteResponseUnknown] or // [shared.UnionString]. type DownloadDeleteResponseUnion interface { @@ -89,10 +105,26 @@ func init() { ) } +// Union satisfied by [stream.DownloadGetResponseUnknown] or [shared.UnionString]. +type DownloadGetResponseUnion interface { + ImplementsStreamDownloadGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DownloadGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DownloadNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DownloadNewParams) MarshalJSON() (data []byte, err error) { @@ -100,9 +132,9 @@ func (r DownloadNewParams) MarshalJSON() (data []byte, err error) { } type DownloadNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DownloadNewResponseUnion `json:"result,required"` // Whether the API call was successful Success DownloadNewResponseEnvelopeSuccess `json:"success,required"` JSON downloadNewResponseEnvelopeJSON `json:"-"` @@ -196,9 +228,9 @@ type DownloadGetParams struct { } type DownloadGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DownloadGetResponseUnion `json:"result,required"` // Whether the API call was successful Success DownloadGetResponseEnvelopeSuccess `json:"success,required"` JSON downloadGetResponseEnvelopeJSON `json:"-"` diff --git a/stream/download_test.go b/stream/download_test.go index 25abfed33ff..692636defb4 100644 --- a/stream/download_test.go +++ b/stream/download_test.go @@ -33,7 +33,7 @@ func TestDownloadNew(t *testing.T) { "ea95132c15732412d22c1476fa83f27a", stream.DownloadNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/key.go b/stream/key.go index 65d15d036fb..9d102619412 100644 --- a/stream/key.go +++ b/stream/key.go @@ -147,8 +147,8 @@ func (r keyGetResponseJSON) RawJSON() string { type KeyNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r KeyNewParams) MarshalJSON() (data []byte, err error) { @@ -200,8 +200,8 @@ func (r KeyNewResponseEnvelopeSuccess) IsKnown() bool { type KeyDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r KeyDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/stream/key_test.go b/stream/key_test.go index 22faa3529b9..b644d70ddf7 100644 --- a/stream/key_test.go +++ b/stream/key_test.go @@ -30,7 +30,7 @@ func TestKeyNew(t *testing.T) { ) _, err := client.Stream.Keys.New(context.TODO(), stream.KeyNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -60,7 +60,7 @@ func TestKeyDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", stream.KeyDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/liveinput.go b/stream/liveinput.go index 2b832363edf..86df99d447a 100644 --- a/stream/liveinput.go +++ b/stream/liveinput.go @@ -751,8 +751,8 @@ func (r LiveInputListResponseEnvelopeSuccess) IsKnown() bool { type LiveInputDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r LiveInputDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/stream/liveinput_test.go b/stream/liveinput_test.go index 1e69887ab5f..60c0c11215a 100644 --- a/stream/liveinput_test.go +++ b/stream/liveinput_test.go @@ -138,7 +138,7 @@ func TestLiveInputDelete(t *testing.T) { "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/liveinputoutput.go b/stream/liveinputoutput.go index 8f10eb76bcb..761b298237b 100644 --- a/stream/liveinputoutput.go +++ b/stream/liveinputoutput.go @@ -254,8 +254,8 @@ type LiveInputOutputListParams struct { type LiveInputOutputDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r LiveInputOutputDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/stream/liveinputoutput_test.go b/stream/liveinputoutput_test.go index 810a7a13b98..91f851fb5ee 100644 --- a/stream/liveinputoutput_test.go +++ b/stream/liveinputoutput_test.go @@ -129,7 +129,7 @@ func TestLiveInputOutputDelete(t *testing.T) { "baea4d9c515887b80289d5c33cf01145", stream.LiveInputOutputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/stream.go b/stream/stream.go index 1a645e12326..2febc298439 100644 --- a/stream/stream.go +++ b/stream/stream.go @@ -340,8 +340,8 @@ func (r VideoStatusState) IsKnown() bool { type StreamNewParams struct { // The account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` // Specifies the TUS protocol version. This value must be included in every upload // request. Notes: The only supported version of TUS protocol is 1.0.0. TusResumable param.Field[StreamNewParamsTusResumable] `header:"Tus-Resumable,required"` @@ -429,8 +429,8 @@ func (r StreamListParamsStatus) IsKnown() bool { type StreamDeleteParams struct { // The account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r StreamDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/stream/stream_test.go b/stream/stream_test.go index 2aa87b4a2f1..5cffd011340 100644 --- a/stream/stream_test.go +++ b/stream/stream_test.go @@ -31,7 +31,7 @@ func TestStreamNewWithOptionalParams(t *testing.T) { ) err := client.Stream.New(context.TODO(), stream.StreamNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, TusResumable: cloudflare.F(stream.StreamNewParamsTusResumable1_0_0), UploadLength: cloudflare.F(int64(0)), UploadCreator: cloudflare.F("creator-id_abcde12345"), @@ -99,7 +99,7 @@ func TestStreamDelete(t *testing.T) { "ea95132c15732412d22c1476fa83f27a", stream.StreamDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/watermark.go b/stream/watermark.go index 30a6bd9f41f..59bb2a8f174 100644 --- a/stream/watermark.go +++ b/stream/watermark.go @@ -37,7 +37,7 @@ func NewWatermarkService(opts ...option.RequestOption) (r *WatermarkService) { // Creates watermark profiles using a single `HTTP POST multipart/form-data` // request. -func (r *WatermarkService) New(ctx context.Context, params WatermarkNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WatermarkService) New(ctx context.Context, params WatermarkNewParams, opts ...option.RequestOption) (res *WatermarkNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WatermarkNewResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/watermarks", params.AccountID) @@ -86,7 +86,7 @@ func (r *WatermarkService) Delete(ctx context.Context, identifier string, params } // Retrieves details for a single watermark profile. -func (r *WatermarkService) Get(ctx context.Context, identifier string, query WatermarkGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WatermarkService) Get(ctx context.Context, identifier string, query WatermarkGetParams, opts ...option.RequestOption) (res *WatermarkGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WatermarkGetResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/watermarks/%s", query.AccountID, identifier) @@ -159,6 +159,22 @@ func (r watermaksJSON) RawJSON() string { return r.raw } +// Union satisfied by [stream.WatermarkNewResponseUnknown] or [shared.UnionString]. +type WatermarkNewResponseUnion interface { + ImplementsStreamWatermarkNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WatermarkNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + // Union satisfied by [stream.WatermarkDeleteResponseUnknown] or // [shared.UnionString]. type WatermarkDeleteResponseUnion interface { @@ -176,6 +192,22 @@ func init() { ) } +// Union satisfied by [stream.WatermarkGetResponseUnknown] or [shared.UnionString]. +type WatermarkGetResponseUnion interface { + ImplementsStreamWatermarkGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WatermarkGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type WatermarkNewParams struct { // The account identifier tag. AccountID param.Field[string] `path:"account_id,required"` @@ -207,9 +239,9 @@ func (r WatermarkNewParams) MarshalJSON() (data []byte, err error) { } type WatermarkNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WatermarkNewResponseUnion `json:"result,required"` // Whether the API call was successful Success WatermarkNewResponseEnvelopeSuccess `json:"success,required"` JSON watermarkNewResponseEnvelopeJSON `json:"-"` @@ -256,8 +288,8 @@ type WatermarkListParams struct { type WatermarkDeleteParams struct { // The account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r WatermarkDeleteParams) MarshalJSON() (data []byte, err error) { @@ -313,9 +345,9 @@ type WatermarkGetParams struct { } type WatermarkGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WatermarkGetResponseUnion `json:"result,required"` // Whether the API call was successful Success WatermarkGetResponseEnvelopeSuccess `json:"success,required"` JSON watermarkGetResponseEnvelopeJSON `json:"-"` diff --git a/stream/watermark_test.go b/stream/watermark_test.go index 87d5e68f3a4..325aa80c310 100644 --- a/stream/watermark_test.go +++ b/stream/watermark_test.go @@ -91,7 +91,7 @@ func TestWatermarkDelete(t *testing.T) { "ea95132c15732412d22c1476fa83f27a", stream.WatermarkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/webhook.go b/stream/webhook.go index 754bd659bfd..f1b8b55eff5 100644 --- a/stream/webhook.go +++ b/stream/webhook.go @@ -34,7 +34,7 @@ func NewWebhookService(opts ...option.RequestOption) (r *WebhookService) { } // Creates a webhook notification. -func (r *WebhookService) Update(ctx context.Context, params WebhookUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WebhookService) Update(ctx context.Context, params WebhookUpdateParams, opts ...option.RequestOption) (res *WebhookUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WebhookUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/webhook", params.AccountID) @@ -60,7 +60,7 @@ func (r *WebhookService) Delete(ctx context.Context, params WebhookDeleteParams, } // Retrieves a list of webhooks. -func (r *WebhookService) Get(ctx context.Context, query WebhookGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *WebhookService) Get(ctx context.Context, query WebhookGetParams, opts ...option.RequestOption) (res *WebhookGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WebhookGetResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/webhook", query.AccountID) @@ -72,6 +72,23 @@ func (r *WebhookService) Get(ctx context.Context, query WebhookGetParams, opts . return } +// Union satisfied by [stream.WebhookUpdateResponseUnknown] or +// [shared.UnionString]. +type WebhookUpdateResponseUnion interface { + ImplementsStreamWebhookUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WebhookUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + // Union satisfied by [stream.WebhookDeleteResponseUnknown] or // [shared.UnionString]. type WebhookDeleteResponseUnion interface { @@ -89,6 +106,22 @@ func init() { ) } +// Union satisfied by [stream.WebhookGetResponseUnknown] or [shared.UnionString]. +type WebhookGetResponseUnion interface { + ImplementsStreamWebhookGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*WebhookGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type WebhookUpdateParams struct { // The account identifier tag. AccountID param.Field[string] `path:"account_id,required"` @@ -101,9 +134,9 @@ func (r WebhookUpdateParams) MarshalJSON() (data []byte, err error) { } type WebhookUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WebhookUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success WebhookUpdateResponseEnvelopeSuccess `json:"success,required"` JSON webhookUpdateResponseEnvelopeJSON `json:"-"` @@ -145,8 +178,8 @@ func (r WebhookUpdateResponseEnvelopeSuccess) IsKnown() bool { type WebhookDeleteParams struct { // The account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r WebhookDeleteParams) MarshalJSON() (data []byte, err error) { @@ -202,9 +235,9 @@ type WebhookGetParams struct { } type WebhookGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WebhookGetResponseUnion `json:"result,required"` // Whether the API call was successful Success WebhookGetResponseEnvelopeSuccess `json:"success,required"` JSON webhookGetResponseEnvelopeJSON `json:"-"` diff --git a/stream/webhook_test.go b/stream/webhook_test.go index c404316b226..2f7d92d5bd1 100644 --- a/stream/webhook_test.go +++ b/stream/webhook_test.go @@ -57,7 +57,7 @@ func TestWebhookDelete(t *testing.T) { ) _, err := client.Stream.Webhooks.Delete(context.TODO(), stream.WebhookDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error diff --git a/subscriptions/aliases.go b/subscriptions/aliases.go index 30ce065bee2..4eac768d19c 100644 --- a/subscriptions/aliases.go +++ b/subscriptions/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/subscriptions/subscription.go b/subscriptions/subscription.go index d6838e7497d..ab4eda87083 100644 --- a/subscriptions/subscription.go +++ b/subscriptions/subscription.go @@ -6,14 +6,15 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/user" + "github.com/tidwall/gjson" ) // SubscriptionService contains methods and other services that help with @@ -35,7 +36,7 @@ func NewSubscriptionService(opts ...option.RequestOption) (r *SubscriptionServic } // Create a zone subscription, either plan or add-ons. -func (r *SubscriptionService) New(ctx context.Context, identifier string, body SubscriptionNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) New(ctx context.Context, identifier string, body SubscriptionNewParams, opts ...option.RequestOption) (res *SubscriptionNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionNewResponseEnvelope path := fmt.Sprintf("zones/%s/subscription", identifier) @@ -48,7 +49,7 @@ func (r *SubscriptionService) New(ctx context.Context, identifier string, body S } // Updates an account subscription. -func (r *SubscriptionService) Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body SubscriptionUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body SubscriptionUpdateParams, opts ...option.RequestOption) (res *SubscriptionUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/subscriptions/%s", accountIdentifier, subscriptionIdentifier) @@ -97,7 +98,7 @@ func (r *SubscriptionService) Delete(ctx context.Context, accountIdentifier stri } // Lists zone subscription details. -func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *SubscriptionGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionGetResponseEnvelope path := fmt.Sprintf("zones/%s/subscription", identifier) @@ -109,6 +110,40 @@ func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts . return } +// Union satisfied by [subscriptions.SubscriptionNewResponseUnknown] or +// [shared.UnionString]. +type SubscriptionNewResponseUnion interface { + ImplementsSubscriptionsSubscriptionNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [subscriptions.SubscriptionUpdateResponseUnknown] or +// [shared.UnionString]. +type SubscriptionUpdateResponseUnion interface { + ImplementsSubscriptionsSubscriptionUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type SubscriptionDeleteResponse struct { // Subscription identifier tag. SubscriptionID string `json:"subscription_id"` @@ -131,99 +166,35 @@ func (r subscriptionDeleteResponseJSON) RawJSON() string { return r.raw } -type SubscriptionNewParams struct { - App param.Field[SubscriptionNewParamsApp] `json:"app"` - // The list of add-ons subscribed to. - ComponentValues param.Field[[]SubscriptionNewParamsComponentValue] `json:"component_values"` - // How often the subscription is renewed automatically. - Frequency param.Field[SubscriptionNewParamsFrequency] `json:"frequency"` - // The rate plan applied to the subscription. - RatePlan param.Field[SubscriptionNewParamsRatePlan] `json:"rate_plan"` - // A simple zone object. May have null properties if not a zone subscription. - Zone param.Field[SubscriptionNewParamsZone] `json:"zone"` -} - -func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SubscriptionNewParamsApp struct { - // app install id. - InstallID param.Field[string] `json:"install_id"` -} - -func (r SubscriptionNewParamsApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A component value for a subscription. -type SubscriptionNewParamsComponentValue struct { - // The default amount assigned. - Default param.Field[float64] `json:"default"` - // The name of the component value. - Name param.Field[string] `json:"name"` - // The unit price for the component value. - Price param.Field[float64] `json:"price"` - // The amount of the component value assigned. - Value param.Field[float64] `json:"value"` -} - -func (r SubscriptionNewParamsComponentValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// How often the subscription is renewed automatically. -type SubscriptionNewParamsFrequency string - -const ( - SubscriptionNewParamsFrequencyWeekly SubscriptionNewParamsFrequency = "weekly" - SubscriptionNewParamsFrequencyMonthly SubscriptionNewParamsFrequency = "monthly" - SubscriptionNewParamsFrequencyQuarterly SubscriptionNewParamsFrequency = "quarterly" - SubscriptionNewParamsFrequencyYearly SubscriptionNewParamsFrequency = "yearly" -) - -func (r SubscriptionNewParamsFrequency) IsKnown() bool { - switch r { - case SubscriptionNewParamsFrequencyWeekly, SubscriptionNewParamsFrequencyMonthly, SubscriptionNewParamsFrequencyQuarterly, SubscriptionNewParamsFrequencyYearly: - return true - } - return false -} - -// The rate plan applied to the subscription. -type SubscriptionNewParamsRatePlan struct { - // The ID of the rate plan. - ID param.Field[string] `json:"id"` - // The currency applied to the rate plan subscription. - Currency param.Field[string] `json:"currency"` - // Whether this rate plan is managed externally from Cloudflare. - ExternallyManaged param.Field[bool] `json:"externally_managed"` - // Whether a rate plan is enterprise-based (or newly adopted term contract). - IsContract param.Field[bool] `json:"is_contract"` - // The full name of the rate plan. - PublicName param.Field[string] `json:"public_name"` - // The scope that this rate plan applies to. - Scope param.Field[string] `json:"scope"` - // The list of sets this rate plan applies to. - Sets param.Field[[]string] `json:"sets"` +// Union satisfied by [subscriptions.SubscriptionGetResponseUnknown] or +// [shared.UnionString]. +type SubscriptionGetResponseUnion interface { + ImplementsSubscriptionsSubscriptionGetResponseUnion() } -func (r SubscriptionNewParamsRatePlan) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) } -// A simple zone object. May have null properties if not a zone subscription. -type SubscriptionNewParamsZone struct { +type SubscriptionNewParams struct { + Subscription user.SubscriptionParam `json:"subscription,required"` } -func (r SubscriptionNewParamsZone) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Subscription) } type SubscriptionNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionNewResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionNewResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionNewResponseEnvelopeJSON `json:"-"` @@ -264,98 +235,17 @@ func (r SubscriptionNewResponseEnvelopeSuccess) IsKnown() bool { } type SubscriptionUpdateParams struct { - App param.Field[SubscriptionUpdateParamsApp] `json:"app"` - // The list of add-ons subscribed to. - ComponentValues param.Field[[]SubscriptionUpdateParamsComponentValue] `json:"component_values"` - // How often the subscription is renewed automatically. - Frequency param.Field[SubscriptionUpdateParamsFrequency] `json:"frequency"` - // The rate plan applied to the subscription. - RatePlan param.Field[SubscriptionUpdateParamsRatePlan] `json:"rate_plan"` - // A simple zone object. May have null properties if not a zone subscription. - Zone param.Field[SubscriptionUpdateParamsZone] `json:"zone"` + Subscription user.SubscriptionParam `json:"subscription,required"` } func (r SubscriptionUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SubscriptionUpdateParamsApp struct { - // app install id. - InstallID param.Field[string] `json:"install_id"` -} - -func (r SubscriptionUpdateParamsApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A component value for a subscription. -type SubscriptionUpdateParamsComponentValue struct { - // The default amount assigned. - Default param.Field[float64] `json:"default"` - // The name of the component value. - Name param.Field[string] `json:"name"` - // The unit price for the component value. - Price param.Field[float64] `json:"price"` - // The amount of the component value assigned. - Value param.Field[float64] `json:"value"` -} - -func (r SubscriptionUpdateParamsComponentValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// How often the subscription is renewed automatically. -type SubscriptionUpdateParamsFrequency string - -const ( - SubscriptionUpdateParamsFrequencyWeekly SubscriptionUpdateParamsFrequency = "weekly" - SubscriptionUpdateParamsFrequencyMonthly SubscriptionUpdateParamsFrequency = "monthly" - SubscriptionUpdateParamsFrequencyQuarterly SubscriptionUpdateParamsFrequency = "quarterly" - SubscriptionUpdateParamsFrequencyYearly SubscriptionUpdateParamsFrequency = "yearly" -) - -func (r SubscriptionUpdateParamsFrequency) IsKnown() bool { - switch r { - case SubscriptionUpdateParamsFrequencyWeekly, SubscriptionUpdateParamsFrequencyMonthly, SubscriptionUpdateParamsFrequencyQuarterly, SubscriptionUpdateParamsFrequencyYearly: - return true - } - return false -} - -// The rate plan applied to the subscription. -type SubscriptionUpdateParamsRatePlan struct { - // The ID of the rate plan. - ID param.Field[string] `json:"id"` - // The currency applied to the rate plan subscription. - Currency param.Field[string] `json:"currency"` - // Whether this rate plan is managed externally from Cloudflare. - ExternallyManaged param.Field[bool] `json:"externally_managed"` - // Whether a rate plan is enterprise-based (or newly adopted term contract). - IsContract param.Field[bool] `json:"is_contract"` - // The full name of the rate plan. - PublicName param.Field[string] `json:"public_name"` - // The scope that this rate plan applies to. - Scope param.Field[string] `json:"scope"` - // The list of sets this rate plan applies to. - Sets param.Field[[]string] `json:"sets"` -} - -func (r SubscriptionUpdateParamsRatePlan) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A simple zone object. May have null properties if not a zone subscription. -type SubscriptionUpdateParamsZone struct { -} - -func (r SubscriptionUpdateParamsZone) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.Subscription) } type SubscriptionUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionUpdateResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionUpdateResponseEnvelopeJSON `json:"-"` @@ -396,7 +286,7 @@ func (r SubscriptionUpdateResponseEnvelopeSuccess) IsKnown() bool { } type SubscriptionDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r SubscriptionDeleteParams) MarshalJSON() (data []byte, err error) { @@ -447,9 +337,9 @@ func (r SubscriptionDeleteResponseEnvelopeSuccess) IsKnown() bool { } type SubscriptionGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionGetResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionGetResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionGetResponseEnvelopeJSON `json:"-"` diff --git a/subscriptions/subscription_test.go b/subscriptions/subscription_test.go index ae616f4758d..2800dc7832f 100644 --- a/subscriptions/subscription_test.go +++ b/subscriptions/subscription_test.go @@ -12,6 +12,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/subscriptions" + "github.com/cloudflare/cloudflare-go/v2/user" ) func TestSubscriptionNewWithOptionalParams(t *testing.T) { @@ -32,36 +33,38 @@ func TestSubscriptionNewWithOptionalParams(t *testing.T) { context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2", subscriptions.SubscriptionNewParams{ - App: cloudflare.F(subscriptions.SubscriptionNewParamsApp{ - InstallID: cloudflare.F("string"), - }), - ComponentValues: cloudflare.F([]subscriptions.SubscriptionNewParamsComponentValue{{ - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }}), - Frequency: cloudflare.F(subscriptions.SubscriptionNewParamsFrequencyMonthly), - RatePlan: cloudflare.F(subscriptions.SubscriptionNewParamsRatePlan{ - Currency: cloudflare.F("USD"), - ExternallyManaged: cloudflare.F(false), - ID: cloudflare.F("free"), - IsContract: cloudflare.F(false), - PublicName: cloudflare.F("Business Plan"), - Scope: cloudflare.F("zone"), - Sets: cloudflare.F([]string{"string", "string", "string"}), - }), - Zone: cloudflare.F(subscriptions.SubscriptionNewParamsZone{}), + Subscription: user.SubscriptionParam{ + App: cloudflare.F(user.SubscriptionAppParam{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]user.SubscriptionComponentValueParam{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(user.SubscriptionFrequencyMonthly), + RatePlan: cloudflare.F(user.SubscriptionRatePlanParam{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(user.SubscriptionZoneParam{}), + }, }, ) if err != nil { @@ -92,36 +95,38 @@ func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "506e3185e9c882d175a2d0cb0093d9f2", subscriptions.SubscriptionUpdateParams{ - App: cloudflare.F(subscriptions.SubscriptionUpdateParamsApp{ - InstallID: cloudflare.F("string"), - }), - ComponentValues: cloudflare.F([]subscriptions.SubscriptionUpdateParamsComponentValue{{ - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }}), - Frequency: cloudflare.F(subscriptions.SubscriptionUpdateParamsFrequencyMonthly), - RatePlan: cloudflare.F(subscriptions.SubscriptionUpdateParamsRatePlan{ - Currency: cloudflare.F("USD"), - ExternallyManaged: cloudflare.F(false), - ID: cloudflare.F("free"), - IsContract: cloudflare.F(false), - PublicName: cloudflare.F("Business Plan"), - Scope: cloudflare.F("zone"), - Sets: cloudflare.F([]string{"string", "string", "string"}), - }), - Zone: cloudflare.F(subscriptions.SubscriptionUpdateParamsZone{}), + Subscription: user.SubscriptionParam{ + App: cloudflare.F(user.SubscriptionAppParam{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]user.SubscriptionComponentValueParam{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(user.SubscriptionFrequencyMonthly), + RatePlan: cloudflare.F(user.SubscriptionRatePlanParam{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(user.SubscriptionZoneParam{}), + }, }, ) if err != nil { @@ -176,7 +181,7 @@ func TestSubscriptionDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "506e3185e9c882d175a2d0cb0093d9f2", subscriptions.SubscriptionDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/url_normalization/aliases.go b/url_normalization/aliases.go index 2b6f7cb238d..a43eb9270b3 100644 --- a/url_normalization/aliases.go +++ b/url_normalization/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/url_scanner/aliases.go b/url_scanner/aliases.go index 973bab46f81..ae451a96761 100644 --- a/url_scanner/aliases.go +++ b/url_scanner/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/user/aliases.go b/user/aliases.go index 4374f5e851e..6068023e55c 100644 --- a/user/aliases.go +++ b/user/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/user/billingprofile.go b/user/billingprofile.go index 3eb7ba1d591..c5df0865879 100644 --- a/user/billingprofile.go +++ b/user/billingprofile.go @@ -5,11 +5,13 @@ package user import ( "context" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // BillingProfileService contains methods and other services that help with @@ -31,7 +33,7 @@ func NewBillingProfileService(opts ...option.RequestOption) (r *BillingProfileSe } // Accesses your billing profile object. -func (r *BillingProfileService) Get(ctx context.Context, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *BillingProfileService) Get(ctx context.Context, opts ...option.RequestOption) (res *BillingProfileGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env BillingProfileGetResponseEnvelope path := "user/billing/profile" @@ -43,10 +45,27 @@ func (r *BillingProfileService) Get(ctx context.Context, opts ...option.RequestO return } +// Union satisfied by [user.BillingProfileGetResponseUnknown] or +// [shared.UnionString]. +type BillingProfileGetResponseUnion interface { + ImplementsUserBillingProfileGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*BillingProfileGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type BillingProfileGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result BillingProfileGetResponseUnion `json:"result,required"` // Whether the API call was successful Success BillingProfileGetResponseEnvelopeSuccess `json:"success,required"` JSON billingProfileGetResponseEnvelopeJSON `json:"-"` diff --git a/user/invite.go b/user/invite.go index b9c284dc4f1..cf1e87e2abf 100644 --- a/user/invite.go +++ b/user/invite.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // InviteService contains methods and other services that help with interacting @@ -57,7 +59,7 @@ func (r *InviteService) ListAutoPaging(ctx context.Context, opts ...option.Reque } // Responds to an invitation. -func (r *InviteService) Edit(ctx context.Context, inviteID string, body InviteEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *InviteService) Edit(ctx context.Context, inviteID string, body InviteEditParams, opts ...option.RequestOption) (res *InviteEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env InviteEditResponseEnvelope path := fmt.Sprintf("user/invites/%s", inviteID) @@ -70,7 +72,7 @@ func (r *InviteService) Edit(ctx context.Context, inviteID string, body InviteEd } // Gets the details of an invitation. -func (r *InviteService) Get(ctx context.Context, inviteID string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *InviteService) Get(ctx context.Context, inviteID string, opts ...option.RequestOption) (res *InviteGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env InviteGetResponseEnvelope path := fmt.Sprintf("user/invites/%s", inviteID) @@ -178,6 +180,38 @@ func (r InviteStatus) IsKnown() bool { return false } +// Union satisfied by [user.InviteEditResponseUnknown] or [shared.UnionString]. +type InviteEditResponseUnion interface { + ImplementsUserInviteEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*InviteEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [user.InviteGetResponseUnknown] or [shared.UnionString]. +type InviteGetResponseUnion interface { + ImplementsUserInviteGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*InviteGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type InviteEditParams struct { // Status of your response to the invitation (rejected or accepted). Status param.Field[InviteEditParamsStatus] `json:"status,required"` @@ -204,9 +238,9 @@ func (r InviteEditParamsStatus) IsKnown() bool { } type InviteEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result InviteEditResponseUnion `json:"result,required"` // Whether the API call was successful Success InviteEditResponseEnvelopeSuccess `json:"success,required"` JSON inviteEditResponseEnvelopeJSON `json:"-"` @@ -247,9 +281,9 @@ func (r InviteEditResponseEnvelopeSuccess) IsKnown() bool { } type InviteGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result InviteGetResponseUnion `json:"result,required"` // Whether the API call was successful Success InviteGetResponseEnvelopeSuccess `json:"success,required"` JSON inviteGetResponseEnvelopeJSON `json:"-"` diff --git a/user/organization.go b/user/organization.go index ae66f52ea2f..f138274c304 100644 --- a/user/organization.go +++ b/user/organization.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" @@ -15,6 +16,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // OrganizationService contains methods and other services that help with @@ -67,7 +69,7 @@ func (r *OrganizationService) Delete(ctx context.Context, organizationID string, } // Gets a specific organization the user is associated with. -func (r *OrganizationService) Get(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *OrganizationService) Get(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *OrganizationGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OrganizationGetResponseEnvelope path := fmt.Sprintf("user/organizations/%s", organizationID) @@ -150,6 +152,23 @@ func (r organizationDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [user.OrganizationGetResponseUnknown] or +// [shared.UnionString]. +type OrganizationGetResponseUnion interface { + ImplementsUserOrganizationGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*OrganizationGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type OrganizationListParams struct { // Direction to order organizations. Direction param.Field[OrganizationListParamsDirection] `query:"direction"` @@ -241,7 +260,7 @@ func (r OrganizationListParamsStatus) IsKnown() bool { } type OrganizationDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r OrganizationDeleteParams) MarshalJSON() (data []byte, err error) { @@ -249,9 +268,9 @@ func (r OrganizationDeleteParams) MarshalJSON() (data []byte, err error) { } type OrganizationGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result OrganizationGetResponseUnion `json:"result,required"` // Whether the API call was successful Success OrganizationGetResponseEnvelopeSuccess `json:"success,required"` JSON organizationGetResponseEnvelopeJSON `json:"-"` diff --git a/user/organization_test.go b/user/organization_test.go index 77359763d1d..bb3adc45ea2 100644 --- a/user/organization_test.go +++ b/user/organization_test.go @@ -64,7 +64,7 @@ func TestOrganizationDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", user.OrganizationDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/user/subscription.go b/user/subscription.go index 7e09f005618..d21935a5f17 100644 --- a/user/subscription.go +++ b/user/subscription.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // SubscriptionService contains methods and other services that help with @@ -34,7 +36,7 @@ func NewSubscriptionService(opts ...option.RequestOption) (r *SubscriptionServic } // Updates a user's subscriptions. -func (r *SubscriptionService) Update(ctx context.Context, identifier string, body SubscriptionUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) Update(ctx context.Context, identifier string, body SubscriptionUpdateParams, opts ...option.RequestOption) (res *SubscriptionUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionUpdateResponseEnvelope path := fmt.Sprintf("user/subscriptions/%s", identifier) @@ -55,7 +57,7 @@ func (r *SubscriptionService) Delete(ctx context.Context, identifier string, bod } // Updates zone subscriptions, either plan or add-ons. -func (r *SubscriptionService) Edit(ctx context.Context, identifier string, body SubscriptionEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) Edit(ctx context.Context, identifier string, body SubscriptionEditParams, opts ...option.RequestOption) (res *SubscriptionEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionEditResponseEnvelope path := fmt.Sprintf("zones/%s/subscription", identifier) @@ -290,55 +292,33 @@ func (r subscriptionZoneJSON) RawJSON() string { return r.raw } -type SubscriptionDeleteResponse struct { - // Subscription identifier tag. - SubscriptionID string `json:"subscription_id"` - JSON subscriptionDeleteResponseJSON `json:"-"` -} - -// subscriptionDeleteResponseJSON contains the JSON metadata for the struct -// [SubscriptionDeleteResponse] -type subscriptionDeleteResponseJSON struct { - SubscriptionID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SubscriptionDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r subscriptionDeleteResponseJSON) RawJSON() string { - return r.raw -} - -type SubscriptionUpdateParams struct { - App param.Field[SubscriptionUpdateParamsApp] `json:"app"` +type SubscriptionParam struct { + App param.Field[SubscriptionAppParam] `json:"app"` // The list of add-ons subscribed to. - ComponentValues param.Field[[]SubscriptionUpdateParamsComponentValue] `json:"component_values"` + ComponentValues param.Field[[]SubscriptionComponentValueParam] `json:"component_values"` // How often the subscription is renewed automatically. - Frequency param.Field[SubscriptionUpdateParamsFrequency] `json:"frequency"` + Frequency param.Field[SubscriptionFrequency] `json:"frequency"` // The rate plan applied to the subscription. - RatePlan param.Field[SubscriptionUpdateParamsRatePlan] `json:"rate_plan"` + RatePlan param.Field[SubscriptionRatePlanParam] `json:"rate_plan"` // A simple zone object. May have null properties if not a zone subscription. - Zone param.Field[SubscriptionUpdateParamsZone] `json:"zone"` + Zone param.Field[SubscriptionZoneParam] `json:"zone"` } -func (r SubscriptionUpdateParams) MarshalJSON() (data []byte, err error) { +func (r SubscriptionParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type SubscriptionUpdateParamsApp struct { +type SubscriptionAppParam struct { // app install id. InstallID param.Field[string] `json:"install_id"` } -func (r SubscriptionUpdateParamsApp) MarshalJSON() (data []byte, err error) { +func (r SubscriptionAppParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // A component value for a subscription. -type SubscriptionUpdateParamsComponentValue struct { +type SubscriptionComponentValueParam struct { // The default amount assigned. Default param.Field[float64] `json:"default"` // The name of the component value. @@ -349,30 +329,12 @@ type SubscriptionUpdateParamsComponentValue struct { Value param.Field[float64] `json:"value"` } -func (r SubscriptionUpdateParamsComponentValue) MarshalJSON() (data []byte, err error) { +func (r SubscriptionComponentValueParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// How often the subscription is renewed automatically. -type SubscriptionUpdateParamsFrequency string - -const ( - SubscriptionUpdateParamsFrequencyWeekly SubscriptionUpdateParamsFrequency = "weekly" - SubscriptionUpdateParamsFrequencyMonthly SubscriptionUpdateParamsFrequency = "monthly" - SubscriptionUpdateParamsFrequencyQuarterly SubscriptionUpdateParamsFrequency = "quarterly" - SubscriptionUpdateParamsFrequencyYearly SubscriptionUpdateParamsFrequency = "yearly" -) - -func (r SubscriptionUpdateParamsFrequency) IsKnown() bool { - switch r { - case SubscriptionUpdateParamsFrequencyWeekly, SubscriptionUpdateParamsFrequencyMonthly, SubscriptionUpdateParamsFrequencyQuarterly, SubscriptionUpdateParamsFrequencyYearly: - return true - } - return false -} - // The rate plan applied to the subscription. -type SubscriptionUpdateParamsRatePlan struct { +type SubscriptionRatePlanParam struct { // The ID of the rate plan. ID param.Field[string] `json:"id"` // The currency applied to the rate plan subscription. @@ -389,22 +351,86 @@ type SubscriptionUpdateParamsRatePlan struct { Sets param.Field[[]string] `json:"sets"` } -func (r SubscriptionUpdateParamsRatePlan) MarshalJSON() (data []byte, err error) { +func (r SubscriptionRatePlanParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // A simple zone object. May have null properties if not a zone subscription. -type SubscriptionUpdateParamsZone struct { +type SubscriptionZoneParam struct { } -func (r SubscriptionUpdateParamsZone) MarshalJSON() (data []byte, err error) { +func (r SubscriptionZoneParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Union satisfied by [user.SubscriptionUpdateResponseUnknown] or +// [shared.UnionString]. +type SubscriptionUpdateResponseUnion interface { + ImplementsUserSubscriptionUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type SubscriptionDeleteResponse struct { + // Subscription identifier tag. + SubscriptionID string `json:"subscription_id"` + JSON subscriptionDeleteResponseJSON `json:"-"` +} + +// subscriptionDeleteResponseJSON contains the JSON metadata for the struct +// [SubscriptionDeleteResponse] +type subscriptionDeleteResponseJSON struct { + SubscriptionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SubscriptionDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r subscriptionDeleteResponseJSON) RawJSON() string { + return r.raw +} + +// Union satisfied by [user.SubscriptionEditResponseUnknown] or +// [shared.UnionString]. +type SubscriptionEditResponseUnion interface { + ImplementsUserSubscriptionEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type SubscriptionUpdateParams struct { + Subscription SubscriptionParam `json:"subscription,required"` +} + +func (r SubscriptionUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Subscription) +} + type SubscriptionUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionUpdateResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionUpdateResponseEnvelopeJSON `json:"-"` @@ -445,7 +471,7 @@ func (r SubscriptionUpdateResponseEnvelopeSuccess) IsKnown() bool { } type SubscriptionDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r SubscriptionDeleteParams) MarshalJSON() (data []byte, err error) { @@ -453,98 +479,17 @@ func (r SubscriptionDeleteParams) MarshalJSON() (data []byte, err error) { } type SubscriptionEditParams struct { - App param.Field[SubscriptionEditParamsApp] `json:"app"` - // The list of add-ons subscribed to. - ComponentValues param.Field[[]SubscriptionEditParamsComponentValue] `json:"component_values"` - // How often the subscription is renewed automatically. - Frequency param.Field[SubscriptionEditParamsFrequency] `json:"frequency"` - // The rate plan applied to the subscription. - RatePlan param.Field[SubscriptionEditParamsRatePlan] `json:"rate_plan"` - // A simple zone object. May have null properties if not a zone subscription. - Zone param.Field[SubscriptionEditParamsZone] `json:"zone"` + Subscription SubscriptionParam `json:"subscription,required"` } func (r SubscriptionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SubscriptionEditParamsApp struct { - // app install id. - InstallID param.Field[string] `json:"install_id"` -} - -func (r SubscriptionEditParamsApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A component value for a subscription. -type SubscriptionEditParamsComponentValue struct { - // The default amount assigned. - Default param.Field[float64] `json:"default"` - // The name of the component value. - Name param.Field[string] `json:"name"` - // The unit price for the component value. - Price param.Field[float64] `json:"price"` - // The amount of the component value assigned. - Value param.Field[float64] `json:"value"` -} - -func (r SubscriptionEditParamsComponentValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// How often the subscription is renewed automatically. -type SubscriptionEditParamsFrequency string - -const ( - SubscriptionEditParamsFrequencyWeekly SubscriptionEditParamsFrequency = "weekly" - SubscriptionEditParamsFrequencyMonthly SubscriptionEditParamsFrequency = "monthly" - SubscriptionEditParamsFrequencyQuarterly SubscriptionEditParamsFrequency = "quarterly" - SubscriptionEditParamsFrequencyYearly SubscriptionEditParamsFrequency = "yearly" -) - -func (r SubscriptionEditParamsFrequency) IsKnown() bool { - switch r { - case SubscriptionEditParamsFrequencyWeekly, SubscriptionEditParamsFrequencyMonthly, SubscriptionEditParamsFrequencyQuarterly, SubscriptionEditParamsFrequencyYearly: - return true - } - return false -} - -// The rate plan applied to the subscription. -type SubscriptionEditParamsRatePlan struct { - // The ID of the rate plan. - ID param.Field[string] `json:"id"` - // The currency applied to the rate plan subscription. - Currency param.Field[string] `json:"currency"` - // Whether this rate plan is managed externally from Cloudflare. - ExternallyManaged param.Field[bool] `json:"externally_managed"` - // Whether a rate plan is enterprise-based (or newly adopted term contract). - IsContract param.Field[bool] `json:"is_contract"` - // The full name of the rate plan. - PublicName param.Field[string] `json:"public_name"` - // The scope that this rate plan applies to. - Scope param.Field[string] `json:"scope"` - // The list of sets this rate plan applies to. - Sets param.Field[[]string] `json:"sets"` -} - -func (r SubscriptionEditParamsRatePlan) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A simple zone object. May have null properties if not a zone subscription. -type SubscriptionEditParamsZone struct { -} - -func (r SubscriptionEditParamsZone) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.Subscription) } type SubscriptionEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionEditResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionEditResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionEditResponseEnvelopeJSON `json:"-"` diff --git a/user/subscription_test.go b/user/subscription_test.go index 38ad7266cd7..dec72110cec 100644 --- a/user/subscription_test.go +++ b/user/subscription_test.go @@ -32,36 +32,38 @@ func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2", user.SubscriptionUpdateParams{ - App: cloudflare.F(user.SubscriptionUpdateParamsApp{ - InstallID: cloudflare.F("string"), - }), - ComponentValues: cloudflare.F([]user.SubscriptionUpdateParamsComponentValue{{ - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }}), - Frequency: cloudflare.F(user.SubscriptionUpdateParamsFrequencyMonthly), - RatePlan: cloudflare.F(user.SubscriptionUpdateParamsRatePlan{ - Currency: cloudflare.F("USD"), - ExternallyManaged: cloudflare.F(false), - ID: cloudflare.F("free"), - IsContract: cloudflare.F(false), - PublicName: cloudflare.F("Business Plan"), - Scope: cloudflare.F("zone"), - Sets: cloudflare.F([]string{"string", "string", "string"}), - }), - Zone: cloudflare.F(user.SubscriptionUpdateParamsZone{}), + Subscription: user.SubscriptionParam{ + App: cloudflare.F(user.SubscriptionAppParam{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]user.SubscriptionComponentValueParam{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(user.SubscriptionFrequencyMonthly), + RatePlan: cloudflare.F(user.SubscriptionRatePlanParam{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(user.SubscriptionZoneParam{}), + }, }, ) if err != nil { @@ -91,7 +93,7 @@ func TestSubscriptionDelete(t *testing.T) { context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2", user.SubscriptionDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -121,36 +123,38 @@ func TestSubscriptionEditWithOptionalParams(t *testing.T) { context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2", user.SubscriptionEditParams{ - App: cloudflare.F(user.SubscriptionEditParamsApp{ - InstallID: cloudflare.F("string"), - }), - ComponentValues: cloudflare.F([]user.SubscriptionEditParamsComponentValue{{ - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }}), - Frequency: cloudflare.F(user.SubscriptionEditParamsFrequencyMonthly), - RatePlan: cloudflare.F(user.SubscriptionEditParamsRatePlan{ - Currency: cloudflare.F("USD"), - ExternallyManaged: cloudflare.F(false), - ID: cloudflare.F("free"), - IsContract: cloudflare.F(false), - PublicName: cloudflare.F("Business Plan"), - Scope: cloudflare.F("zone"), - Sets: cloudflare.F([]string{"string", "string", "string"}), - }), - Zone: cloudflare.F(user.SubscriptionEditParamsZone{}), + Subscription: user.SubscriptionParam{ + App: cloudflare.F(user.SubscriptionAppParam{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]user.SubscriptionComponentValueParam{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(user.SubscriptionFrequencyMonthly), + RatePlan: cloudflare.F(user.SubscriptionRatePlanParam{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(user.SubscriptionZoneParam{}), + }, }, ) if err != nil { diff --git a/user/token.go b/user/token.go index 280d7ffc710..19d51f9ac28 100644 --- a/user/token.go +++ b/user/token.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -16,6 +17,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // TokenService contains methods and other services that help with interacting with @@ -53,7 +55,7 @@ func (r *TokenService) New(ctx context.Context, body TokenNewParams, opts ...opt } // Update an existing token. -func (r *TokenService) Update(ctx context.Context, tokenID interface{}, body TokenUpdateParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *TokenService) Update(ctx context.Context, tokenID interface{}, body TokenUpdateParams, opts ...option.RequestOption) (res *TokenUpdateResponseUnion, err error) { opts = append(r.Options[:], opts...) var env TokenUpdateResponseEnvelope path := fmt.Sprintf("user/tokens/%v", tokenID) @@ -102,7 +104,7 @@ func (r *TokenService) Delete(ctx context.Context, tokenID interface{}, body Tok } // Get information about a specific token. -func (r *TokenService) Get(ctx context.Context, tokenID interface{}, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *TokenService) Get(ctx context.Context, tokenID interface{}, opts ...option.RequestOption) (res *TokenGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env TokenGetResponseEnvelope path := fmt.Sprintf("user/tokens/%v", tokenID) @@ -246,6 +248,22 @@ func (r tokenNewResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [user.TokenUpdateResponseUnknown] or [shared.UnionString]. +type TokenUpdateResponseUnion interface { + ImplementsUserTokenUpdateResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*TokenUpdateResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type TokenListResponse = interface{} type TokenDeleteResponse struct { @@ -270,6 +288,22 @@ func (r tokenDeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [user.TokenGetResponseUnknown] or [shared.UnionString]. +type TokenGetResponseUnion interface { + ImplementsUserTokenGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*TokenGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type TokenVerifyResponse struct { // Token identifier tag. ID string `json:"id,required"` @@ -458,9 +492,9 @@ func (r TokenUpdateParamsConditionRequestIP) MarshalJSON() (data []byte, err err } type TokenUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TokenUpdateResponseUnion `json:"result,required"` // Whether the API call was successful Success TokenUpdateResponseEnvelopeSuccess `json:"success,required"` JSON tokenUpdateResponseEnvelopeJSON `json:"-"` @@ -534,7 +568,7 @@ func (r TokenListParamsDirection) IsKnown() bool { } type TokenDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r TokenDeleteParams) MarshalJSON() (data []byte, err error) { @@ -585,9 +619,9 @@ func (r TokenDeleteResponseEnvelopeSuccess) IsKnown() bool { } type TokenGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TokenGetResponseUnion `json:"result,required"` // Whether the API call was successful Success TokenGetResponseEnvelopeSuccess `json:"success,required"` JSON tokenGetResponseEnvelopeJSON `json:"-"` diff --git a/user/token_test.go b/user/token_test.go index c9335b398d6..d26f36e8010 100644 --- a/user/token_test.go +++ b/user/token_test.go @@ -178,7 +178,7 @@ func TestTokenDelete(t *testing.T) { context.TODO(), map[string]interface{}{}, user.TokenDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/user/tokenvalue.go b/user/tokenvalue.go index e663559f43f..5b599a4c7e3 100644 --- a/user/tokenvalue.go +++ b/user/tokenvalue.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" @@ -47,7 +46,7 @@ func (r *TokenValueService) Update(ctx context.Context, tokenID interface{}, bod type Value = string type TokenValueUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r TokenValueUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/user/tokenvalue_test.go b/user/tokenvalue_test.go index 12746b958c0..1aa17c69a0d 100644 --- a/user/tokenvalue_test.go +++ b/user/tokenvalue_test.go @@ -32,7 +32,7 @@ func TestTokenValueUpdate(t *testing.T) { context.TODO(), map[string]interface{}{}, user.TokenValueUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/user/user.go b/user/user.go index 43afddd4a89..6fdc60fb555 100644 --- a/user/user.go +++ b/user/user.go @@ -5,12 +5,14 @@ package user import ( "context" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // UserService contains methods and other services that help with interacting with @@ -43,7 +45,7 @@ func NewUserService(opts ...option.RequestOption) (r *UserService) { } // Edit part of your user details. -func (r *UserService) Edit(ctx context.Context, body UserEditParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *UserService) Edit(ctx context.Context, body UserEditParams, opts ...option.RequestOption) (res *UserEditResponseUnion, err error) { opts = append(r.Options[:], opts...) var env UserEditResponseEnvelope path := "user" @@ -56,7 +58,7 @@ func (r *UserService) Edit(ctx context.Context, body UserEditParams, opts ...opt } // User Details -func (r *UserService) Get(ctx context.Context, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *UserService) Get(ctx context.Context, opts ...option.RequestOption) (res *UserGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env UserGetResponseEnvelope path := "user" @@ -68,6 +70,38 @@ func (r *UserService) Get(ctx context.Context, opts ...option.RequestOption) (re return } +// Union satisfied by [user.UserEditResponseUnknown] or [shared.UnionString]. +type UserEditResponseUnion interface { + ImplementsUserUserEditResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*UserEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [user.UserGetResponseUnknown] or [shared.UnionString]. +type UserGetResponseUnion interface { + ImplementsUserUserGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*UserGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type UserEditParams struct { // The country in which the user lives. Country param.Field[string] `json:"country"` @@ -86,9 +120,9 @@ func (r UserEditParams) MarshalJSON() (data []byte, err error) { } type UserEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result UserEditResponseUnion `json:"result,required"` // Whether the API call was successful Success UserEditResponseEnvelopeSuccess `json:"success,required"` JSON userEditResponseEnvelopeJSON `json:"-"` @@ -129,9 +163,9 @@ func (r UserEditResponseEnvelopeSuccess) IsKnown() bool { } type UserGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result UserGetResponseUnion `json:"result,required"` // Whether the API call was successful Success UserGetResponseEnvelopeSuccess `json:"success,required"` JSON userGetResponseEnvelopeJSON `json:"-"` diff --git a/vectorize/aliases.go b/vectorize/aliases.go index be37df75cd7..a682ee20024 100644 --- a/vectorize/aliases.go +++ b/vectorize/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/vectorize/index.go b/vectorize/index.go index da5d1a6d819..45990d230e5 100644 --- a/vectorize/index.go +++ b/vectorize/index.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // IndexService contains methods and other services that help with interacting with @@ -82,7 +84,7 @@ func (r *IndexService) ListAutoPaging(ctx context.Context, accountIdentifier str } // Deletes the specified Vectorize Index. -func (r *IndexService) Delete(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *IndexService) Delete(ctx context.Context, accountIdentifier string, indexName string, opts ...option.RequestOption) (res *IndexDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env IndexDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/vectorize/indexes/%s", accountIdentifier, indexName) @@ -386,6 +388,23 @@ func (r indexUpsertJSON) RawJSON() string { return r.raw } +// Union satisfied by [vectorize.IndexDeleteResponseUnknown] or +// [shared.UnionString]. +type IndexDeleteResponseUnion interface { + ImplementsVectorizeIndexDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*IndexDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type IndexGetByIDsResponse = interface{} type IndexNewParams struct { @@ -587,9 +606,9 @@ func (r IndexUpdateResponseEnvelopeSuccess) IsKnown() bool { } type IndexDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result IndexDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success IndexDeleteResponseEnvelopeSuccess `json:"success,required"` JSON indexDeleteResponseEnvelopeJSON `json:"-"` @@ -778,7 +797,7 @@ func (r IndexGetByIDsResponseEnvelopeSuccess) IsKnown() bool { } type IndexInsertParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r IndexInsertParams) MarshalJSON() (data []byte, err error) { @@ -887,7 +906,7 @@ func (r IndexQueryResponseEnvelopeSuccess) IsKnown() bool { } type IndexUpsertParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r IndexUpsertParams) MarshalJSON() (data []byte, err error) { diff --git a/vectorize/index_test.go b/vectorize/index_test.go index 95c2179c7d3..2a47549e5d3 100644 --- a/vectorize/index_test.go +++ b/vectorize/index_test.go @@ -240,7 +240,7 @@ func TestIndexInsert(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "example-index", vectorize.IndexInsertParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -305,7 +305,7 @@ func TestIndexUpsert(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "example-index", vectorize.IndexUpsertParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/waiting_rooms/aliases.go b/waiting_rooms/aliases.go index 7ac5abaa525..b7998a3bb7d 100644 --- a/waiting_rooms/aliases.go +++ b/waiting_rooms/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/waiting_rooms/event.go b/waiting_rooms/event.go index 37a101301db..f027268d866 100644 --- a/waiting_rooms/event.go +++ b/waiting_rooms/event.go @@ -232,56 +232,12 @@ func (r eventDeleteResponseJSON) RawJSON() string { type EventNewParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // An ISO 8601 timestamp that marks the end of the event. - EventEndTime param.Field[string] `json:"event_end_time,required"` - // An ISO 8601 timestamp that marks the start of the event. At this time, queued - // users will be processed with the event's configuration. The start time must be - // at least one minute before `event_end_time`. - EventStartTime param.Field[string] `json:"event_start_time,required"` - // A unique name to identify the event. Only alphanumeric characters, hyphens and - // underscores are allowed. - Name param.Field[string] `json:"name,required"` - // If set, the event will override the waiting room's `custom_page_html` property - // while it is active. If null, the event will inherit it. - CustomPageHTML param.Field[string] `json:"custom_page_html"` - // A note that you can use to add more details about the event. - Description param.Field[string] `json:"description"` - // If set, the event will override the waiting room's `disable_session_renewal` - // property while it is active. If null, the event will inherit it. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` - // If set, the event will override the waiting room's `new_users_per_minute` - // property while it is active. If null, the event will inherit it. This can only - // be set if the event's `total_active_users` property is also set. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` - // An ISO 8601 timestamp that marks when to begin queueing all users before the - // event starts. The prequeue must start at least five minutes before - // `event_start_time`. - PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` - // If set, the event will override the waiting room's `queueing_method` property - // while it is active. If null, the event will inherit it. - QueueingMethod param.Field[string] `json:"queueing_method"` - // If set, the event will override the waiting room's `session_duration` property - // while it is active. If null, the event will inherit it. - SessionDuration param.Field[int64] `json:"session_duration"` - // If enabled, users in the prequeue will be shuffled randomly at the - // `event_start_time`. Requires that `prequeue_start_time` is not null. This is - // useful for situations when many users will join the event prequeue at the same - // time and you want to shuffle them to ensure fairness. Naturally, it makes the - // most sense to enable this feature when the `queueing_method` during the event - // respects ordering such as **fifo**, or else the shuffling may be unnecessary. - ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` - // Suspends or allows an event. If set to `true`, the event is ignored and traffic - // will be handled based on the waiting room configuration. - Suspended param.Field[bool] `json:"suspended"` - // If set, the event will override the waiting room's `total_active_users` property - // while it is active. If null, the event will inherit it. This can only be set if - // the event's `new_users_per_minute` property is also set. - TotalActiveUsers param.Field[int64] `json:"total_active_users"` + ZoneID param.Field[string] `path:"zone_id,required"` + EventQuery EventQueryParam `json:"event_query,required"` } func (r EventNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.EventQuery) } type EventNewResponseEnvelope struct { @@ -313,56 +269,12 @@ func (r eventNewResponseEnvelopeJSON) RawJSON() string { type EventUpdateParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // An ISO 8601 timestamp that marks the end of the event. - EventEndTime param.Field[string] `json:"event_end_time,required"` - // An ISO 8601 timestamp that marks the start of the event. At this time, queued - // users will be processed with the event's configuration. The start time must be - // at least one minute before `event_end_time`. - EventStartTime param.Field[string] `json:"event_start_time,required"` - // A unique name to identify the event. Only alphanumeric characters, hyphens and - // underscores are allowed. - Name param.Field[string] `json:"name,required"` - // If set, the event will override the waiting room's `custom_page_html` property - // while it is active. If null, the event will inherit it. - CustomPageHTML param.Field[string] `json:"custom_page_html"` - // A note that you can use to add more details about the event. - Description param.Field[string] `json:"description"` - // If set, the event will override the waiting room's `disable_session_renewal` - // property while it is active. If null, the event will inherit it. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` - // If set, the event will override the waiting room's `new_users_per_minute` - // property while it is active. If null, the event will inherit it. This can only - // be set if the event's `total_active_users` property is also set. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` - // An ISO 8601 timestamp that marks when to begin queueing all users before the - // event starts. The prequeue must start at least five minutes before - // `event_start_time`. - PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` - // If set, the event will override the waiting room's `queueing_method` property - // while it is active. If null, the event will inherit it. - QueueingMethod param.Field[string] `json:"queueing_method"` - // If set, the event will override the waiting room's `session_duration` property - // while it is active. If null, the event will inherit it. - SessionDuration param.Field[int64] `json:"session_duration"` - // If enabled, users in the prequeue will be shuffled randomly at the - // `event_start_time`. Requires that `prequeue_start_time` is not null. This is - // useful for situations when many users will join the event prequeue at the same - // time and you want to shuffle them to ensure fairness. Naturally, it makes the - // most sense to enable this feature when the `queueing_method` during the event - // respects ordering such as **fifo**, or else the shuffling may be unnecessary. - ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` - // Suspends or allows an event. If set to `true`, the event is ignored and traffic - // will be handled based on the waiting room configuration. - Suspended param.Field[bool] `json:"suspended"` - // If set, the event will override the waiting room's `total_active_users` property - // while it is active. If null, the event will inherit it. This can only be set if - // the event's `new_users_per_minute` property is also set. - TotalActiveUsers param.Field[int64] `json:"total_active_users"` + ZoneID param.Field[string] `path:"zone_id,required"` + EventQuery EventQueryParam `json:"event_query,required"` } func (r EventUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.EventQuery) } type EventUpdateResponseEnvelope struct { @@ -399,8 +311,8 @@ type EventListParams struct { type EventDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r EventDeleteParams) MarshalJSON() (data []byte, err error) { @@ -436,56 +348,12 @@ func (r eventDeleteResponseEnvelopeJSON) RawJSON() string { type EventEditParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // An ISO 8601 timestamp that marks the end of the event. - EventEndTime param.Field[string] `json:"event_end_time,required"` - // An ISO 8601 timestamp that marks the start of the event. At this time, queued - // users will be processed with the event's configuration. The start time must be - // at least one minute before `event_end_time`. - EventStartTime param.Field[string] `json:"event_start_time,required"` - // A unique name to identify the event. Only alphanumeric characters, hyphens and - // underscores are allowed. - Name param.Field[string] `json:"name,required"` - // If set, the event will override the waiting room's `custom_page_html` property - // while it is active. If null, the event will inherit it. - CustomPageHTML param.Field[string] `json:"custom_page_html"` - // A note that you can use to add more details about the event. - Description param.Field[string] `json:"description"` - // If set, the event will override the waiting room's `disable_session_renewal` - // property while it is active. If null, the event will inherit it. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` - // If set, the event will override the waiting room's `new_users_per_minute` - // property while it is active. If null, the event will inherit it. This can only - // be set if the event's `total_active_users` property is also set. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` - // An ISO 8601 timestamp that marks when to begin queueing all users before the - // event starts. The prequeue must start at least five minutes before - // `event_start_time`. - PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` - // If set, the event will override the waiting room's `queueing_method` property - // while it is active. If null, the event will inherit it. - QueueingMethod param.Field[string] `json:"queueing_method"` - // If set, the event will override the waiting room's `session_duration` property - // while it is active. If null, the event will inherit it. - SessionDuration param.Field[int64] `json:"session_duration"` - // If enabled, users in the prequeue will be shuffled randomly at the - // `event_start_time`. Requires that `prequeue_start_time` is not null. This is - // useful for situations when many users will join the event prequeue at the same - // time and you want to shuffle them to ensure fairness. Naturally, it makes the - // most sense to enable this feature when the `queueing_method` during the event - // respects ordering such as **fifo**, or else the shuffling may be unnecessary. - ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` - // Suspends or allows an event. If set to `true`, the event is ignored and traffic - // will be handled based on the waiting room configuration. - Suspended param.Field[bool] `json:"suspended"` - // If set, the event will override the waiting room's `total_active_users` property - // while it is active. If null, the event will inherit it. This can only be set if - // the event's `new_users_per_minute` property is also set. - TotalActiveUsers param.Field[int64] `json:"total_active_users"` + ZoneID param.Field[string] `path:"zone_id,required"` + EventQuery EventQueryParam `json:"event_query,required"` } func (r EventEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.EventQuery) } type EventEditResponseEnvelope struct { diff --git a/waiting_rooms/event_test.go b/waiting_rooms/event_test.go index 026ac528008..45cdf0c770b 100644 --- a/waiting_rooms/event_test.go +++ b/waiting_rooms/event_test.go @@ -32,20 +32,22 @@ func TestEventNewWithOptionalParams(t *testing.T) { context.TODO(), "699d98642c564d2e855e9661899b7252", waiting_rooms.EventNewParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), - EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), - Name: cloudflare.F("production_webinar_event"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), - Description: cloudflare.F("Production event - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(true), - NewUsersPerMinute: cloudflare.F(int64(200)), - PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), - QueueingMethod: cloudflare.F("random"), - SessionDuration: cloudflare.F(int64(1)), - ShuffleAtEventStart: cloudflare.F(true), - Suspended: cloudflare.F(true), - TotalActiveUsers: cloudflare.F(int64(200)), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + EventQuery: waiting_rooms.EventQueryParam{ + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }, ) if err != nil { @@ -76,20 +78,22 @@ func TestEventUpdateWithOptionalParams(t *testing.T) { "699d98642c564d2e855e9661899b7252", "25756b2dfe6e378a06b033b670413757", waiting_rooms.EventUpdateParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), - EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), - Name: cloudflare.F("production_webinar_event"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), - Description: cloudflare.F("Production event - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(true), - NewUsersPerMinute: cloudflare.F(int64(200)), - PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), - QueueingMethod: cloudflare.F("random"), - SessionDuration: cloudflare.F(int64(1)), - ShuffleAtEventStart: cloudflare.F(true), - Suspended: cloudflare.F(true), - TotalActiveUsers: cloudflare.F(int64(200)), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + EventQuery: waiting_rooms.EventQueryParam{ + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }, ) if err != nil { @@ -151,7 +155,7 @@ func TestEventDelete(t *testing.T) { "25756b2dfe6e378a06b033b670413757", waiting_rooms.EventDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -182,20 +186,22 @@ func TestEventEditWithOptionalParams(t *testing.T) { "699d98642c564d2e855e9661899b7252", "25756b2dfe6e378a06b033b670413757", waiting_rooms.EventEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), - EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), - Name: cloudflare.F("production_webinar_event"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), - Description: cloudflare.F("Production event - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(true), - NewUsersPerMinute: cloudflare.F(int64(200)), - PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), - QueueingMethod: cloudflare.F("random"), - SessionDuration: cloudflare.F(int64(1)), - ShuffleAtEventStart: cloudflare.F(true), - Suspended: cloudflare.F(true), - TotalActiveUsers: cloudflare.F(int64(200)), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + EventQuery: waiting_rooms.EventQueryParam{ + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"), + Description: cloudflare.F("Production event - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(true), + EventEndTime: cloudflare.F("2021-09-28T17:00:00.000Z"), + EventStartTime: cloudflare.F("2021-09-28T15:30:00.000Z"), + Name: cloudflare.F("production_webinar_event"), + NewUsersPerMinute: cloudflare.F(int64(200)), + PrequeueStartTime: cloudflare.F("2021-09-28T15:00:00.000Z"), + QueueingMethod: cloudflare.F("random"), + SessionDuration: cloudflare.F(int64(1)), + ShuffleAtEventStart: cloudflare.F(true), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }, ) if err != nil { diff --git a/waiting_rooms/eventdetail.go b/waiting_rooms/eventdetail.go index e7948269f59..03911c33361 100644 --- a/waiting_rooms/eventdetail.go +++ b/waiting_rooms/eventdetail.go @@ -46,6 +46,58 @@ func (r *EventDetailService) Get(ctx context.Context, waitingRoomID string, even return } +type EventQueryParam struct { + // An ISO 8601 timestamp that marks the end of the event. + EventEndTime param.Field[string] `json:"event_end_time,required"` + // An ISO 8601 timestamp that marks the start of the event. At this time, queued + // users will be processed with the event's configuration. The start time must be + // at least one minute before `event_end_time`. + EventStartTime param.Field[string] `json:"event_start_time,required"` + // A unique name to identify the event. Only alphanumeric characters, hyphens and + // underscores are allowed. + Name param.Field[string] `json:"name,required"` + // If set, the event will override the waiting room's `custom_page_html` property + // while it is active. If null, the event will inherit it. + CustomPageHTML param.Field[string] `json:"custom_page_html"` + // A note that you can use to add more details about the event. + Description param.Field[string] `json:"description"` + // If set, the event will override the waiting room's `disable_session_renewal` + // property while it is active. If null, the event will inherit it. + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + // If set, the event will override the waiting room's `new_users_per_minute` + // property while it is active. If null, the event will inherit it. This can only + // be set if the event's `total_active_users` property is also set. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when to begin queueing all users before the + // event starts. The prequeue must start at least five minutes before + // `event_start_time`. + PrequeueStartTime param.Field[string] `json:"prequeue_start_time"` + // If set, the event will override the waiting room's `queueing_method` property + // while it is active. If null, the event will inherit it. + QueueingMethod param.Field[string] `json:"queueing_method"` + // If set, the event will override the waiting room's `session_duration` property + // while it is active. If null, the event will inherit it. + SessionDuration param.Field[int64] `json:"session_duration"` + // If enabled, users in the prequeue will be shuffled randomly at the + // `event_start_time`. Requires that `prequeue_start_time` is not null. This is + // useful for situations when many users will join the event prequeue at the same + // time and you want to shuffle them to ensure fairness. Naturally, it makes the + // most sense to enable this feature when the `queueing_method` during the event + // respects ordering such as **fifo**, or else the shuffling may be unnecessary. + ShuffleAtEventStart param.Field[bool] `json:"shuffle_at_event_start"` + // Suspends or allows an event. If set to `true`, the event is ignored and traffic + // will be handled based on the waiting room configuration. + Suspended param.Field[bool] `json:"suspended"` + // If set, the event will override the waiting room's `total_active_users` property + // while it is active. If null, the event will inherit it. This can only be set if + // the event's `new_users_per_minute` property is also set. + TotalActiveUsers param.Field[int64] `json:"total_active_users"` +} + +func (r EventQueryParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type EventDetailGetResponse struct { ID string `json:"id"` CreatedOn time.Time `json:"created_on" format:"date-time"` diff --git a/waiting_rooms/rule.go b/waiting_rooms/rule.go index a3671a86ba6..9e3df896258 100644 --- a/waiting_rooms/rule.go +++ b/waiting_rooms/rule.go @@ -273,8 +273,8 @@ func (r ruleNewResponseEnvelopeResultInfoJSON) RawJSON() string { type RuleUpdateParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[[]RuleUpdateParamsBody] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body []RuleUpdateParamsBody `json:"body,required"` } func (r RuleUpdateParams) MarshalJSON() (data []byte, err error) { @@ -394,8 +394,8 @@ type RuleListParams struct { type RuleDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r RuleDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/waiting_rooms/rule_test.go b/waiting_rooms/rule_test.go index 9bd5b3fb63e..5535ce64dfd 100644 --- a/waiting_rooms/rule_test.go +++ b/waiting_rooms/rule_test.go @@ -67,7 +67,7 @@ func TestRuleUpdate(t *testing.T) { "699d98642c564d2e855e9661899b7252", waiting_rooms.RuleUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]waiting_rooms.RuleUpdateParamsBody{{ + Body: []waiting_rooms.RuleUpdateParamsBody{{ Action: cloudflare.F(waiting_rooms.RuleUpdateParamsBodyActionBypassWaitingRoom), Description: cloudflare.F("allow all traffic from 10.20.30.40"), Enabled: cloudflare.F(true), @@ -82,7 +82,7 @@ func TestRuleUpdate(t *testing.T) { Description: cloudflare.F("allow all traffic from 10.20.30.40"), Enabled: cloudflare.F(true), Expression: cloudflare.F("ip.src in {10.20.30.40}"), - }}), + }}, }, ) if err != nil { @@ -144,7 +144,7 @@ func TestRuleDelete(t *testing.T) { "25756b2dfe6e378a06b033b670413757", waiting_rooms.RuleDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/waiting_rooms/waitingroom.go b/waiting_rooms/waitingroom.go index 209506dce76..3b96d3db3f3 100644 --- a/waiting_rooms/waitingroom.go +++ b/waiting_rooms/waitingroom.go @@ -270,21 +270,38 @@ func (r CookieAttributesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type WaitingRoom struct { - ID string `json:"id"` +type QueryParam struct { + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host param.Field[string] `json:"host,required"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name param.Field[string] `json:"name,required"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` // Only available for the Waiting Room Advanced subscription. Additional hostname // and path combinations to which this waiting room will be applied. There is an // implied wildcard at the end of the path. The hostname and path combination must // be unique to this and all other waiting rooms. - AdditionalRoutes []AdditionalRoutes `json:"additional_routes"` + AdditionalRoutes param.Field[[]AdditionalRoutesParam] `json:"additional_routes"` // Configures cookie attributes for the waiting room cookie. This encrypted cookie // stores a user's status in the waiting room, such as queue position. - CookieAttributes CookieAttributes `json:"cookie_attributes"` + CookieAttributes param.Field[CookieAttributesParam] `json:"cookie_attributes"` // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - CookieSuffix string `json:"cookie_suffix"` - CreatedOn time.Time `json:"created_on" format:"date-time"` + CookieSuffix param.Field[string] `json:"cookie_suffix"` // Only available for the Waiting Room Advanced subscription. This is a template // html file that will be rendered at the edge. If no custom_page_html is provided, // the default waiting room will be used. The template is based on mustache ( @@ -306,22 +323,18 @@ type WaitingRoom struct { // // To view the full list of variables, look at the `cfWaitingRoom` object described // under the `json_response_enabled` property in other Waiting Room API calls. - CustomPageHTML string `json:"custom_page_html"` + CustomPageHTML param.Field[string] `json:"custom_page_html"` // The language of the default page template. If no default_template_language is // provided, then `en-US` (English) will be used. - DefaultTemplateLanguage WaitingRoomDefaultTemplateLanguage `json:"default_template_language"` + DefaultTemplateLanguage param.Field[QueryDefaultTemplateLanguage] `json:"default_template_language"` // A note that you can use to add more details about the waiting room. - Description string `json:"description"` + Description param.Field[string] `json:"description"` // Only available for the Waiting Room Advanced subscription. Disables automatic // renewal of session cookies. If `true`, an accepted user will have // session_duration minutes to browse the site. After that, they will have to go // through the waiting room again. If `false`, a user's session cookie will be // automatically renewed on every request. - DisableSessionRenewal bool `json:"disable_session_renewal"` - // The host name to which the waiting room will be applied (no wildcards). Please - // do not include the scheme (http:// or https://). The host and path combination - // must be unique. - Host string `json:"host"` + DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` // Only available for the Waiting Room Advanced subscription. If `true`, requests // to the waiting room with the header `Accept: application/json` will receive a // JSON response object with information on the user's status in the waiting room @@ -467,29 +480,16 @@ type WaitingRoom struct { // "shuffleAtEventStart": true // } // }. - JsonResponseEnabled bool `json:"json_response_enabled"` - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // A unique name to identify the waiting room. Only alphanumeric characters, - // hyphens and underscores are allowed. - Name string `json:"name"` - // Sets the number of new users that will be let into the route every minute. This - // value is used as baseline for the number of users that are let in per minute. So - // it is possible that there is a little more or little less traffic coming to the - // route based on the traffic patterns at that time around the world. - NewUsersPerMinute int64 `json:"new_users_per_minute"` - // An ISO 8601 timestamp that marks when the next event will begin queueing. - NextEventPrequeueStartTime string `json:"next_event_prequeue_start_time,nullable"` - // An ISO 8601 timestamp that marks when the next event will start. - NextEventStartTime string `json:"next_event_start_time,nullable"` + JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` // Sets the path within the host to enable the waiting room on. The waiting room // will be enabled for all subpaths as well. If there are two waiting rooms on the // same subpath, the waiting room for the most specific path will be chosen. // Wildcards and query parameters are not supported. - Path string `json:"path"` + Path param.Field[string] `json:"path"` // If queue_all is `true`, all the traffic that is coming to a route will be sent // to the waiting room. No new traffic can get to the route once this field is set // and estimated time will become unavailable. - QueueAll bool `json:"queue_all"` + QueueAll param.Field[bool] `json:"queue_all"` // Sets the queueing method used by the waiting room. Changing this parameter from // the **default** queueing method is only available for the Waiting Room Advanced // subscription. Regardless of the queueing method, if `queue_all` is enabled or an @@ -517,90 +517,49 @@ type WaitingRoom struct { // events override this with `fifo`, `random`, or `passthrough`. When this // queueing method is enabled and neither `queueAll` is enabled nor an event is // prequeueing, the waiting room page **will not refresh automatically**. - QueueingMethod WaitingRoomQueueingMethod `json:"queueing_method"` + QueueingMethod param.Field[QueryQueueingMethod] `json:"queueing_method"` // HTTP status code returned to a user while in the queue. - QueueingStatusCode WaitingRoomQueueingStatusCode `json:"queueing_status_code"` + QueueingStatusCode param.Field[QueryQueueingStatusCode] `json:"queueing_status_code"` // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to // the route. If a user is not seen by Cloudflare again in that time period, they // will be treated as a new user that visits the route. - SessionDuration int64 `json:"session_duration"` + SessionDuration param.Field[int64] `json:"session_duration"` // Suspends or allows traffic going to the waiting room. If set to `true`, the // traffic will not go to the waiting room. - Suspended bool `json:"suspended"` - // Sets the total number of active user sessions on the route at a point in time. A - // route is a combination of host and path on which a waiting room is available. - // This value is used as a baseline for the total number of active user sessions on - // the route. It is possible to have a situation where there are more or less - // active users sessions on the route based on the traffic patterns at that time - // around the world. - TotalActiveUsers int64 `json:"total_active_users"` - JSON waitingRoomJSON `json:"-"` -} - -// waitingRoomJSON contains the JSON metadata for the struct [WaitingRoom] -type waitingRoomJSON struct { - ID apijson.Field - AdditionalRoutes apijson.Field - CookieAttributes apijson.Field - CookieSuffix apijson.Field - CreatedOn apijson.Field - CustomPageHTML apijson.Field - DefaultTemplateLanguage apijson.Field - Description apijson.Field - DisableSessionRenewal apijson.Field - Host apijson.Field - JsonResponseEnabled apijson.Field - ModifiedOn apijson.Field - Name apijson.Field - NewUsersPerMinute apijson.Field - NextEventPrequeueStartTime apijson.Field - NextEventStartTime apijson.Field - Path apijson.Field - QueueAll apijson.Field - QueueingMethod apijson.Field - QueueingStatusCode apijson.Field - SessionDuration apijson.Field - Suspended apijson.Field - TotalActiveUsers apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WaitingRoom) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + Suspended param.Field[bool] `json:"suspended"` } -func (r waitingRoomJSON) RawJSON() string { - return r.raw +func (r QueryParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } // The language of the default page template. If no default_template_language is // provided, then `en-US` (English) will be used. -type WaitingRoomDefaultTemplateLanguage string +type QueryDefaultTemplateLanguage string const ( - WaitingRoomDefaultTemplateLanguageEnUs WaitingRoomDefaultTemplateLanguage = "en-US" - WaitingRoomDefaultTemplateLanguageEsEs WaitingRoomDefaultTemplateLanguage = "es-ES" - WaitingRoomDefaultTemplateLanguageDeDe WaitingRoomDefaultTemplateLanguage = "de-DE" - WaitingRoomDefaultTemplateLanguageFrFr WaitingRoomDefaultTemplateLanguage = "fr-FR" - WaitingRoomDefaultTemplateLanguageItIt WaitingRoomDefaultTemplateLanguage = "it-IT" - WaitingRoomDefaultTemplateLanguageJaJp WaitingRoomDefaultTemplateLanguage = "ja-JP" - WaitingRoomDefaultTemplateLanguageKoKr WaitingRoomDefaultTemplateLanguage = "ko-KR" - WaitingRoomDefaultTemplateLanguagePtBr WaitingRoomDefaultTemplateLanguage = "pt-BR" - WaitingRoomDefaultTemplateLanguageZhCn WaitingRoomDefaultTemplateLanguage = "zh-CN" - WaitingRoomDefaultTemplateLanguageZhTw WaitingRoomDefaultTemplateLanguage = "zh-TW" - WaitingRoomDefaultTemplateLanguageNlNl WaitingRoomDefaultTemplateLanguage = "nl-NL" - WaitingRoomDefaultTemplateLanguagePlPl WaitingRoomDefaultTemplateLanguage = "pl-PL" - WaitingRoomDefaultTemplateLanguageIDID WaitingRoomDefaultTemplateLanguage = "id-ID" - WaitingRoomDefaultTemplateLanguageTrTr WaitingRoomDefaultTemplateLanguage = "tr-TR" - WaitingRoomDefaultTemplateLanguageArEg WaitingRoomDefaultTemplateLanguage = "ar-EG" - WaitingRoomDefaultTemplateLanguageRuRu WaitingRoomDefaultTemplateLanguage = "ru-RU" - WaitingRoomDefaultTemplateLanguageFaIr WaitingRoomDefaultTemplateLanguage = "fa-IR" + QueryDefaultTemplateLanguageEnUs QueryDefaultTemplateLanguage = "en-US" + QueryDefaultTemplateLanguageEsEs QueryDefaultTemplateLanguage = "es-ES" + QueryDefaultTemplateLanguageDeDe QueryDefaultTemplateLanguage = "de-DE" + QueryDefaultTemplateLanguageFrFr QueryDefaultTemplateLanguage = "fr-FR" + QueryDefaultTemplateLanguageItIt QueryDefaultTemplateLanguage = "it-IT" + QueryDefaultTemplateLanguageJaJp QueryDefaultTemplateLanguage = "ja-JP" + QueryDefaultTemplateLanguageKoKr QueryDefaultTemplateLanguage = "ko-KR" + QueryDefaultTemplateLanguagePtBr QueryDefaultTemplateLanguage = "pt-BR" + QueryDefaultTemplateLanguageZhCn QueryDefaultTemplateLanguage = "zh-CN" + QueryDefaultTemplateLanguageZhTw QueryDefaultTemplateLanguage = "zh-TW" + QueryDefaultTemplateLanguageNlNl QueryDefaultTemplateLanguage = "nl-NL" + QueryDefaultTemplateLanguagePlPl QueryDefaultTemplateLanguage = "pl-PL" + QueryDefaultTemplateLanguageIDID QueryDefaultTemplateLanguage = "id-ID" + QueryDefaultTemplateLanguageTrTr QueryDefaultTemplateLanguage = "tr-TR" + QueryDefaultTemplateLanguageArEg QueryDefaultTemplateLanguage = "ar-EG" + QueryDefaultTemplateLanguageRuRu QueryDefaultTemplateLanguage = "ru-RU" + QueryDefaultTemplateLanguageFaIr QueryDefaultTemplateLanguage = "fa-IR" ) -func (r WaitingRoomDefaultTemplateLanguage) IsKnown() bool { +func (r QueryDefaultTemplateLanguage) IsKnown() bool { switch r { - case WaitingRoomDefaultTemplateLanguageEnUs, WaitingRoomDefaultTemplateLanguageEsEs, WaitingRoomDefaultTemplateLanguageDeDe, WaitingRoomDefaultTemplateLanguageFrFr, WaitingRoomDefaultTemplateLanguageItIt, WaitingRoomDefaultTemplateLanguageJaJp, WaitingRoomDefaultTemplateLanguageKoKr, WaitingRoomDefaultTemplateLanguagePtBr, WaitingRoomDefaultTemplateLanguageZhCn, WaitingRoomDefaultTemplateLanguageZhTw, WaitingRoomDefaultTemplateLanguageNlNl, WaitingRoomDefaultTemplateLanguagePlPl, WaitingRoomDefaultTemplateLanguageIDID, WaitingRoomDefaultTemplateLanguageTrTr, WaitingRoomDefaultTemplateLanguageArEg, WaitingRoomDefaultTemplateLanguageRuRu, WaitingRoomDefaultTemplateLanguageFaIr: + case QueryDefaultTemplateLanguageEnUs, QueryDefaultTemplateLanguageEsEs, QueryDefaultTemplateLanguageDeDe, QueryDefaultTemplateLanguageFrFr, QueryDefaultTemplateLanguageItIt, QueryDefaultTemplateLanguageJaJp, QueryDefaultTemplateLanguageKoKr, QueryDefaultTemplateLanguagePtBr, QueryDefaultTemplateLanguageZhCn, QueryDefaultTemplateLanguageZhTw, QueryDefaultTemplateLanguageNlNl, QueryDefaultTemplateLanguagePlPl, QueryDefaultTemplateLanguageIDID, QueryDefaultTemplateLanguageTrTr, QueryDefaultTemplateLanguageArEg, QueryDefaultTemplateLanguageRuRu, QueryDefaultTemplateLanguageFaIr: return true } return false @@ -633,95 +592,55 @@ func (r WaitingRoomDefaultTemplateLanguage) IsKnown() bool { // events override this with `fifo`, `random`, or `passthrough`. When this // queueing method is enabled and neither `queueAll` is enabled nor an event is // prequeueing, the waiting room page **will not refresh automatically**. -type WaitingRoomQueueingMethod string +type QueryQueueingMethod string const ( - WaitingRoomQueueingMethodFifo WaitingRoomQueueingMethod = "fifo" - WaitingRoomQueueingMethodRandom WaitingRoomQueueingMethod = "random" - WaitingRoomQueueingMethodPassthrough WaitingRoomQueueingMethod = "passthrough" - WaitingRoomQueueingMethodReject WaitingRoomQueueingMethod = "reject" + QueryQueueingMethodFifo QueryQueueingMethod = "fifo" + QueryQueueingMethodRandom QueryQueueingMethod = "random" + QueryQueueingMethodPassthrough QueryQueueingMethod = "passthrough" + QueryQueueingMethodReject QueryQueueingMethod = "reject" ) -func (r WaitingRoomQueueingMethod) IsKnown() bool { +func (r QueryQueueingMethod) IsKnown() bool { switch r { - case WaitingRoomQueueingMethodFifo, WaitingRoomQueueingMethodRandom, WaitingRoomQueueingMethodPassthrough, WaitingRoomQueueingMethodReject: + case QueryQueueingMethodFifo, QueryQueueingMethodRandom, QueryQueueingMethodPassthrough, QueryQueueingMethodReject: return true } return false } // HTTP status code returned to a user while in the queue. -type WaitingRoomQueueingStatusCode int64 +type QueryQueueingStatusCode int64 const ( - WaitingRoomQueueingStatusCode200 WaitingRoomQueueingStatusCode = 200 - WaitingRoomQueueingStatusCode202 WaitingRoomQueueingStatusCode = 202 - WaitingRoomQueueingStatusCode429 WaitingRoomQueueingStatusCode = 429 + QueryQueueingStatusCode200 QueryQueueingStatusCode = 200 + QueryQueueingStatusCode202 QueryQueueingStatusCode = 202 + QueryQueueingStatusCode429 QueryQueueingStatusCode = 429 ) -func (r WaitingRoomQueueingStatusCode) IsKnown() bool { +func (r QueryQueueingStatusCode) IsKnown() bool { switch r { - case WaitingRoomQueueingStatusCode200, WaitingRoomQueueingStatusCode202, WaitingRoomQueueingStatusCode429: + case QueryQueueingStatusCode200, QueryQueueingStatusCode202, QueryQueueingStatusCode429: return true } return false } -type WaitingRoomDeleteResponse struct { - ID string `json:"id"` - JSON waitingRoomDeleteResponseJSON `json:"-"` -} - -// waitingRoomDeleteResponseJSON contains the JSON metadata for the struct -// [WaitingRoomDeleteResponse] -type waitingRoomDeleteResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WaitingRoomDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r waitingRoomDeleteResponseJSON) RawJSON() string { - return r.raw -} - -type WaitingRoomNewParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The host name to which the waiting room will be applied (no wildcards). Please - // do not include the scheme (http:// or https://). The host and path combination - // must be unique. - Host param.Field[string] `json:"host,required"` - // A unique name to identify the waiting room. Only alphanumeric characters, - // hyphens and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // Sets the number of new users that will be let into the route every minute. This - // value is used as baseline for the number of users that are let in per minute. So - // it is possible that there is a little more or little less traffic coming to the - // route based on the traffic patterns at that time around the world. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` - // Sets the total number of active user sessions on the route at a point in time. A - // route is a combination of host and path on which a waiting room is available. - // This value is used as a baseline for the total number of active user sessions on - // the route. It is possible to have a situation where there are more or less - // active users sessions on the route based on the traffic patterns at that time - // around the world. - TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` +type WaitingRoom struct { + ID string `json:"id"` // Only available for the Waiting Room Advanced subscription. Additional hostname // and path combinations to which this waiting room will be applied. There is an // implied wildcard at the end of the path. The hostname and path combination must // be unique to this and all other waiting rooms. - AdditionalRoutes param.Field[[]AdditionalRoutesParam] `json:"additional_routes"` + AdditionalRoutes []AdditionalRoutes `json:"additional_routes"` // Configures cookie attributes for the waiting room cookie. This encrypted cookie // stores a user's status in the waiting room, such as queue position. - CookieAttributes param.Field[CookieAttributesParam] `json:"cookie_attributes"` + CookieAttributes CookieAttributes `json:"cookie_attributes"` // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - CookieSuffix param.Field[string] `json:"cookie_suffix"` + CookieSuffix string `json:"cookie_suffix"` + CreatedOn time.Time `json:"created_on" format:"date-time"` // Only available for the Waiting Room Advanced subscription. This is a template // html file that will be rendered at the edge. If no custom_page_html is provided, // the default waiting room will be used. The template is based on mustache ( @@ -743,18 +662,22 @@ type WaitingRoomNewParams struct { // // To view the full list of variables, look at the `cfWaitingRoom` object described // under the `json_response_enabled` property in other Waiting Room API calls. - CustomPageHTML param.Field[string] `json:"custom_page_html"` + CustomPageHTML string `json:"custom_page_html"` // The language of the default page template. If no default_template_language is // provided, then `en-US` (English) will be used. - DefaultTemplateLanguage param.Field[WaitingRoomNewParamsDefaultTemplateLanguage] `json:"default_template_language"` + DefaultTemplateLanguage WaitingRoomDefaultTemplateLanguage `json:"default_template_language"` // A note that you can use to add more details about the waiting room. - Description param.Field[string] `json:"description"` + Description string `json:"description"` // Only available for the Waiting Room Advanced subscription. Disables automatic // renewal of session cookies. If `true`, an accepted user will have // session_duration minutes to browse the site. After that, they will have to go // through the waiting room again. If `false`, a user's session cookie will be // automatically renewed on every request. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` + DisableSessionRenewal bool `json:"disable_session_renewal"` + // The host name to which the waiting room will be applied (no wildcards). Please + // do not include the scheme (http:// or https://). The host and path combination + // must be unique. + Host string `json:"host"` // Only available for the Waiting Room Advanced subscription. If `true`, requests // to the waiting room with the header `Accept: application/json` will receive a // JSON response object with information on the user's status in the waiting room @@ -900,16 +823,29 @@ type WaitingRoomNewParams struct { // "shuffleAtEventStart": true // } // }. - JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` + JsonResponseEnabled bool `json:"json_response_enabled"` + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // A unique name to identify the waiting room. Only alphanumeric characters, + // hyphens and underscores are allowed. + Name string `json:"name"` + // Sets the number of new users that will be let into the route every minute. This + // value is used as baseline for the number of users that are let in per minute. So + // it is possible that there is a little more or little less traffic coming to the + // route based on the traffic patterns at that time around the world. + NewUsersPerMinute int64 `json:"new_users_per_minute"` + // An ISO 8601 timestamp that marks when the next event will begin queueing. + NextEventPrequeueStartTime string `json:"next_event_prequeue_start_time,nullable"` + // An ISO 8601 timestamp that marks when the next event will start. + NextEventStartTime string `json:"next_event_start_time,nullable"` // Sets the path within the host to enable the waiting room on. The waiting room // will be enabled for all subpaths as well. If there are two waiting rooms on the // same subpath, the waiting room for the most specific path will be chosen. // Wildcards and query parameters are not supported. - Path param.Field[string] `json:"path"` + Path string `json:"path"` // If queue_all is `true`, all the traffic that is coming to a route will be sent // to the waiting room. No new traffic can get to the route once this field is set // and estimated time will become unavailable. - QueueAll param.Field[bool] `json:"queue_all"` + QueueAll bool `json:"queue_all"` // Sets the queueing method used by the waiting room. Changing this parameter from // the **default** queueing method is only available for the Waiting Room Advanced // subscription. Regardless of the queueing method, if `queue_all` is enabled or an @@ -937,57 +873,98 @@ type WaitingRoomNewParams struct { // events override this with `fifo`, `random`, or `passthrough`. When this // queueing method is enabled and neither `queueAll` is enabled nor an event is // prequeueing, the waiting room page **will not refresh automatically**. - QueueingMethod param.Field[WaitingRoomNewParamsQueueingMethod] `json:"queueing_method"` + QueueingMethod WaitingRoomQueueingMethod `json:"queueing_method"` // HTTP status code returned to a user while in the queue. - QueueingStatusCode param.Field[WaitingRoomNewParamsQueueingStatusCode] `json:"queueing_status_code"` + QueueingStatusCode WaitingRoomQueueingStatusCode `json:"queueing_status_code"` // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to // the route. If a user is not seen by Cloudflare again in that time period, they // will be treated as a new user that visits the route. - SessionDuration param.Field[int64] `json:"session_duration"` + SessionDuration int64 `json:"session_duration"` // Suspends or allows traffic going to the waiting room. If set to `true`, the // traffic will not go to the waiting room. - Suspended param.Field[bool] `json:"suspended"` -} - -func (r WaitingRoomNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The language of the default page template. If no default_template_language is -// provided, then `en-US` (English) will be used. -type WaitingRoomNewParamsDefaultTemplateLanguage string - -const ( - WaitingRoomNewParamsDefaultTemplateLanguageEnUs WaitingRoomNewParamsDefaultTemplateLanguage = "en-US" - WaitingRoomNewParamsDefaultTemplateLanguageEsEs WaitingRoomNewParamsDefaultTemplateLanguage = "es-ES" - WaitingRoomNewParamsDefaultTemplateLanguageDeDe WaitingRoomNewParamsDefaultTemplateLanguage = "de-DE" - WaitingRoomNewParamsDefaultTemplateLanguageFrFr WaitingRoomNewParamsDefaultTemplateLanguage = "fr-FR" - WaitingRoomNewParamsDefaultTemplateLanguageItIt WaitingRoomNewParamsDefaultTemplateLanguage = "it-IT" - WaitingRoomNewParamsDefaultTemplateLanguageJaJp WaitingRoomNewParamsDefaultTemplateLanguage = "ja-JP" - WaitingRoomNewParamsDefaultTemplateLanguageKoKr WaitingRoomNewParamsDefaultTemplateLanguage = "ko-KR" - WaitingRoomNewParamsDefaultTemplateLanguagePtBr WaitingRoomNewParamsDefaultTemplateLanguage = "pt-BR" - WaitingRoomNewParamsDefaultTemplateLanguageZhCn WaitingRoomNewParamsDefaultTemplateLanguage = "zh-CN" - WaitingRoomNewParamsDefaultTemplateLanguageZhTw WaitingRoomNewParamsDefaultTemplateLanguage = "zh-TW" - WaitingRoomNewParamsDefaultTemplateLanguageNlNl WaitingRoomNewParamsDefaultTemplateLanguage = "nl-NL" - WaitingRoomNewParamsDefaultTemplateLanguagePlPl WaitingRoomNewParamsDefaultTemplateLanguage = "pl-PL" - WaitingRoomNewParamsDefaultTemplateLanguageIDID WaitingRoomNewParamsDefaultTemplateLanguage = "id-ID" - WaitingRoomNewParamsDefaultTemplateLanguageTrTr WaitingRoomNewParamsDefaultTemplateLanguage = "tr-TR" - WaitingRoomNewParamsDefaultTemplateLanguageArEg WaitingRoomNewParamsDefaultTemplateLanguage = "ar-EG" - WaitingRoomNewParamsDefaultTemplateLanguageRuRu WaitingRoomNewParamsDefaultTemplateLanguage = "ru-RU" - WaitingRoomNewParamsDefaultTemplateLanguageFaIr WaitingRoomNewParamsDefaultTemplateLanguage = "fa-IR" -) - -func (r WaitingRoomNewParamsDefaultTemplateLanguage) IsKnown() bool { - switch r { - case WaitingRoomNewParamsDefaultTemplateLanguageEnUs, WaitingRoomNewParamsDefaultTemplateLanguageEsEs, WaitingRoomNewParamsDefaultTemplateLanguageDeDe, WaitingRoomNewParamsDefaultTemplateLanguageFrFr, WaitingRoomNewParamsDefaultTemplateLanguageItIt, WaitingRoomNewParamsDefaultTemplateLanguageJaJp, WaitingRoomNewParamsDefaultTemplateLanguageKoKr, WaitingRoomNewParamsDefaultTemplateLanguagePtBr, WaitingRoomNewParamsDefaultTemplateLanguageZhCn, WaitingRoomNewParamsDefaultTemplateLanguageZhTw, WaitingRoomNewParamsDefaultTemplateLanguageNlNl, WaitingRoomNewParamsDefaultTemplateLanguagePlPl, WaitingRoomNewParamsDefaultTemplateLanguageIDID, WaitingRoomNewParamsDefaultTemplateLanguageTrTr, WaitingRoomNewParamsDefaultTemplateLanguageArEg, WaitingRoomNewParamsDefaultTemplateLanguageRuRu, WaitingRoomNewParamsDefaultTemplateLanguageFaIr: - return true - } - return false + Suspended bool `json:"suspended"` + // Sets the total number of active user sessions on the route at a point in time. A + // route is a combination of host and path on which a waiting room is available. + // This value is used as a baseline for the total number of active user sessions on + // the route. It is possible to have a situation where there are more or less + // active users sessions on the route based on the traffic patterns at that time + // around the world. + TotalActiveUsers int64 `json:"total_active_users"` + JSON waitingRoomJSON `json:"-"` } -// Sets the queueing method used by the waiting room. Changing this parameter from -// the **default** queueing method is only available for the Waiting Room Advanced -// subscription. Regardless of the queueing method, if `queue_all` is enabled or an +// waitingRoomJSON contains the JSON metadata for the struct [WaitingRoom] +type waitingRoomJSON struct { + ID apijson.Field + AdditionalRoutes apijson.Field + CookieAttributes apijson.Field + CookieSuffix apijson.Field + CreatedOn apijson.Field + CustomPageHTML apijson.Field + DefaultTemplateLanguage apijson.Field + Description apijson.Field + DisableSessionRenewal apijson.Field + Host apijson.Field + JsonResponseEnabled apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + NewUsersPerMinute apijson.Field + NextEventPrequeueStartTime apijson.Field + NextEventStartTime apijson.Field + Path apijson.Field + QueueAll apijson.Field + QueueingMethod apijson.Field + QueueingStatusCode apijson.Field + SessionDuration apijson.Field + Suspended apijson.Field + TotalActiveUsers apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WaitingRoom) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r waitingRoomJSON) RawJSON() string { + return r.raw +} + +// The language of the default page template. If no default_template_language is +// provided, then `en-US` (English) will be used. +type WaitingRoomDefaultTemplateLanguage string + +const ( + WaitingRoomDefaultTemplateLanguageEnUs WaitingRoomDefaultTemplateLanguage = "en-US" + WaitingRoomDefaultTemplateLanguageEsEs WaitingRoomDefaultTemplateLanguage = "es-ES" + WaitingRoomDefaultTemplateLanguageDeDe WaitingRoomDefaultTemplateLanguage = "de-DE" + WaitingRoomDefaultTemplateLanguageFrFr WaitingRoomDefaultTemplateLanguage = "fr-FR" + WaitingRoomDefaultTemplateLanguageItIt WaitingRoomDefaultTemplateLanguage = "it-IT" + WaitingRoomDefaultTemplateLanguageJaJp WaitingRoomDefaultTemplateLanguage = "ja-JP" + WaitingRoomDefaultTemplateLanguageKoKr WaitingRoomDefaultTemplateLanguage = "ko-KR" + WaitingRoomDefaultTemplateLanguagePtBr WaitingRoomDefaultTemplateLanguage = "pt-BR" + WaitingRoomDefaultTemplateLanguageZhCn WaitingRoomDefaultTemplateLanguage = "zh-CN" + WaitingRoomDefaultTemplateLanguageZhTw WaitingRoomDefaultTemplateLanguage = "zh-TW" + WaitingRoomDefaultTemplateLanguageNlNl WaitingRoomDefaultTemplateLanguage = "nl-NL" + WaitingRoomDefaultTemplateLanguagePlPl WaitingRoomDefaultTemplateLanguage = "pl-PL" + WaitingRoomDefaultTemplateLanguageIDID WaitingRoomDefaultTemplateLanguage = "id-ID" + WaitingRoomDefaultTemplateLanguageTrTr WaitingRoomDefaultTemplateLanguage = "tr-TR" + WaitingRoomDefaultTemplateLanguageArEg WaitingRoomDefaultTemplateLanguage = "ar-EG" + WaitingRoomDefaultTemplateLanguageRuRu WaitingRoomDefaultTemplateLanguage = "ru-RU" + WaitingRoomDefaultTemplateLanguageFaIr WaitingRoomDefaultTemplateLanguage = "fa-IR" +) + +func (r WaitingRoomDefaultTemplateLanguage) IsKnown() bool { + switch r { + case WaitingRoomDefaultTemplateLanguageEnUs, WaitingRoomDefaultTemplateLanguageEsEs, WaitingRoomDefaultTemplateLanguageDeDe, WaitingRoomDefaultTemplateLanguageFrFr, WaitingRoomDefaultTemplateLanguageItIt, WaitingRoomDefaultTemplateLanguageJaJp, WaitingRoomDefaultTemplateLanguageKoKr, WaitingRoomDefaultTemplateLanguagePtBr, WaitingRoomDefaultTemplateLanguageZhCn, WaitingRoomDefaultTemplateLanguageZhTw, WaitingRoomDefaultTemplateLanguageNlNl, WaitingRoomDefaultTemplateLanguagePlPl, WaitingRoomDefaultTemplateLanguageIDID, WaitingRoomDefaultTemplateLanguageTrTr, WaitingRoomDefaultTemplateLanguageArEg, WaitingRoomDefaultTemplateLanguageRuRu, WaitingRoomDefaultTemplateLanguageFaIr: + return true + } + return false +} + +// Sets the queueing method used by the waiting room. Changing this parameter from +// the **default** queueing method is only available for the Waiting Room Advanced +// subscription. Regardless of the queueing method, if `queue_all` is enabled or an // event is prequeueing, users in the waiting room will not be accepted to the // origin. These users will always see a waiting room page that refreshes // automatically. The valid queueing methods are: @@ -1012,40 +989,71 @@ func (r WaitingRoomNewParamsDefaultTemplateLanguage) IsKnown() bool { // events override this with `fifo`, `random`, or `passthrough`. When this // queueing method is enabled and neither `queueAll` is enabled nor an event is // prequeueing, the waiting room page **will not refresh automatically**. -type WaitingRoomNewParamsQueueingMethod string +type WaitingRoomQueueingMethod string const ( - WaitingRoomNewParamsQueueingMethodFifo WaitingRoomNewParamsQueueingMethod = "fifo" - WaitingRoomNewParamsQueueingMethodRandom WaitingRoomNewParamsQueueingMethod = "random" - WaitingRoomNewParamsQueueingMethodPassthrough WaitingRoomNewParamsQueueingMethod = "passthrough" - WaitingRoomNewParamsQueueingMethodReject WaitingRoomNewParamsQueueingMethod = "reject" + WaitingRoomQueueingMethodFifo WaitingRoomQueueingMethod = "fifo" + WaitingRoomQueueingMethodRandom WaitingRoomQueueingMethod = "random" + WaitingRoomQueueingMethodPassthrough WaitingRoomQueueingMethod = "passthrough" + WaitingRoomQueueingMethodReject WaitingRoomQueueingMethod = "reject" ) -func (r WaitingRoomNewParamsQueueingMethod) IsKnown() bool { +func (r WaitingRoomQueueingMethod) IsKnown() bool { switch r { - case WaitingRoomNewParamsQueueingMethodFifo, WaitingRoomNewParamsQueueingMethodRandom, WaitingRoomNewParamsQueueingMethodPassthrough, WaitingRoomNewParamsQueueingMethodReject: + case WaitingRoomQueueingMethodFifo, WaitingRoomQueueingMethodRandom, WaitingRoomQueueingMethodPassthrough, WaitingRoomQueueingMethodReject: return true } return false } // HTTP status code returned to a user while in the queue. -type WaitingRoomNewParamsQueueingStatusCode int64 +type WaitingRoomQueueingStatusCode int64 const ( - WaitingRoomNewParamsQueueingStatusCode200 WaitingRoomNewParamsQueueingStatusCode = 200 - WaitingRoomNewParamsQueueingStatusCode202 WaitingRoomNewParamsQueueingStatusCode = 202 - WaitingRoomNewParamsQueueingStatusCode429 WaitingRoomNewParamsQueueingStatusCode = 429 + WaitingRoomQueueingStatusCode200 WaitingRoomQueueingStatusCode = 200 + WaitingRoomQueueingStatusCode202 WaitingRoomQueueingStatusCode = 202 + WaitingRoomQueueingStatusCode429 WaitingRoomQueueingStatusCode = 429 ) -func (r WaitingRoomNewParamsQueueingStatusCode) IsKnown() bool { +func (r WaitingRoomQueueingStatusCode) IsKnown() bool { switch r { - case WaitingRoomNewParamsQueueingStatusCode200, WaitingRoomNewParamsQueueingStatusCode202, WaitingRoomNewParamsQueueingStatusCode429: + case WaitingRoomQueueingStatusCode200, WaitingRoomQueueingStatusCode202, WaitingRoomQueueingStatusCode429: return true } return false } +type WaitingRoomDeleteResponse struct { + ID string `json:"id"` + JSON waitingRoomDeleteResponseJSON `json:"-"` +} + +// waitingRoomDeleteResponseJSON contains the JSON metadata for the struct +// [WaitingRoomDeleteResponse] +type waitingRoomDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *WaitingRoomDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r waitingRoomDeleteResponseJSON) RawJSON() string { + return r.raw +} + +type WaitingRoomNewParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Query QueryParam `json:"query,required"` +} + +func (r WaitingRoomNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Query) +} + type WaitingRoomNewResponseEnvelope struct { Errors interface{} `json:"errors,required"` Messages interface{} `json:"messages,required"` @@ -1076,359 +1084,11 @@ func (r waitingRoomNewResponseEnvelopeJSON) RawJSON() string { type WaitingRoomUpdateParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // The host name to which the waiting room will be applied (no wildcards). Please - // do not include the scheme (http:// or https://). The host and path combination - // must be unique. - Host param.Field[string] `json:"host,required"` - // A unique name to identify the waiting room. Only alphanumeric characters, - // hyphens and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // Sets the number of new users that will be let into the route every minute. This - // value is used as baseline for the number of users that are let in per minute. So - // it is possible that there is a little more or little less traffic coming to the - // route based on the traffic patterns at that time around the world. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` - // Sets the total number of active user sessions on the route at a point in time. A - // route is a combination of host and path on which a waiting room is available. - // This value is used as a baseline for the total number of active user sessions on - // the route. It is possible to have a situation where there are more or less - // active users sessions on the route based on the traffic patterns at that time - // around the world. - TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` - // Only available for the Waiting Room Advanced subscription. Additional hostname - // and path combinations to which this waiting room will be applied. There is an - // implied wildcard at the end of the path. The hostname and path combination must - // be unique to this and all other waiting rooms. - AdditionalRoutes param.Field[[]AdditionalRoutesParam] `json:"additional_routes"` - // Configures cookie attributes for the waiting room cookie. This encrypted cookie - // stores a user's status in the waiting room, such as queue position. - CookieAttributes param.Field[CookieAttributesParam] `json:"cookie_attributes"` - // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie - // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - CookieSuffix param.Field[string] `json:"cookie_suffix"` - // Only available for the Waiting Room Advanced subscription. This is a template - // html file that will be rendered at the edge. If no custom_page_html is provided, - // the default waiting room will be used. The template is based on mustache ( - // https://mustache.github.io/ ). There are several variables that are evaluated by - // the Cloudflare edge: - // - // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - // take when wait time is not available, for instance when queue_all is - // **true**. - // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - // minutes. Alternatively, you can use: - // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - // (`Math.floor(waitTime/60)`). - // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - // (`waitTime%60`). - // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - // queue. - // - // To view the full list of variables, look at the `cfWaitingRoom` object described - // under the `json_response_enabled` property in other Waiting Room API calls. - CustomPageHTML param.Field[string] `json:"custom_page_html"` - // The language of the default page template. If no default_template_language is - // provided, then `en-US` (English) will be used. - DefaultTemplateLanguage param.Field[WaitingRoomUpdateParamsDefaultTemplateLanguage] `json:"default_template_language"` - // A note that you can use to add more details about the waiting room. - Description param.Field[string] `json:"description"` - // Only available for the Waiting Room Advanced subscription. Disables automatic - // renewal of session cookies. If `true`, an accepted user will have - // session_duration minutes to browse the site. After that, they will have to go - // through the waiting room again. If `false`, a user's session cookie will be - // automatically renewed on every request. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` - // Only available for the Waiting Room Advanced subscription. If `true`, requests - // to the waiting room with the header `Accept: application/json` will receive a - // JSON response object with information on the user's status in the waiting room - // as opposed to the configured static HTML page. This JSON response object has one - // property `cfWaitingRoom` which is an object containing the following fields: - // - // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - // (always **true**). - // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - // accurate. If **false**, they are not available. - // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - // the current estimated time in minutes the user will wait in the waiting room. - // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 25% of users that gain entry the fastest (25th percentile). - // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 50% of users that gain entry the fastest (50th percentile). - // In other words, half of the queued users are expected to let into the origin - // website before `waitTime50Percentile` and half are expected to be let in - // after it. - // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 75% of users that gain entry the fastest (75th percentile). - // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - // **unavailable**. - // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - // full and not accepting new users at the moment. - // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - // room and no one will be let into the origin website. - // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - // user's last attempt to leave the waiting room and be let into the origin - // website. The user is able to make another attempt after - // `refreshIntervalSeconds` past this time. If the user makes a request too - // soon, it will be ignored and `lastUpdated` will not change. - // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - // `lastUpdated` until the user is able to make another attempt to leave the - // waiting room and be let into the origin website. When the `queueingMethod` - // is `reject`, there is no specified refresh time — it will always be - // **zero**. - // 12. `queueingMethod`: The queueing method currently used by the waiting room. It - // is either **fifo**, **random**, **passthrough**, or **reject**. - // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - // (First-In-First-Out) queue. - // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - // where users gain access randomly. - // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - // passthrough queue. Keep in mind that when passthrough is enabled, this JSON - // response will only exist when `queueAll` is **true** or `isEventPrequeueing` - // is **true** because in all other cases requests will go directly to the - // origin. - // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - // 17. `isEventActive`: Boolean indicating if an event is currently occurring. - // Events are able to change a waiting room's behavior during a specified - // period of time. For additional information, look at the event properties - // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - // documentation for creating waiting room events. Events are considered active - // between these start and end times, as well as during the prequeueing period - // if it exists. - // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - // indicating if an event is currently prequeueing users before it starts. - // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - // Integer indicating the number of minutes until the event starts. - // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - // formatted in English for users. If `isEventPrequeueing` is **false**, - // `timeUntilEventStartFormatted` will display **unavailable**. - // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - // indicating the number of minutes until the event ends. - // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - // formatted in English for users. If `isEventActive` is **false**, - // `timeUntilEventEndFormatted` will display **unavailable**. - // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - // indicating if the users in the prequeue are shuffled randomly when the event - // starts. - // - // An example cURL to a waiting room could be: - // - // curl -X GET "https://example.com/waitingroom" \ - // -H "Accept: application/json" - // - // If `json_response_enabled` is **true** and the request hits the waiting room, an - // example JSON response when `queueingMethod` is **fifo** and no event is active - // could be: - // - // { - // "cfWaitingRoom": { - // "inWaitingRoom": true, - // "waitTimeKnown": true, - // "waitTime": 10, - // "waitTime25Percentile": 0, - // "waitTime50Percentile": 0, - // "waitTime75Percentile": 0, - // "waitTimeFormatted": "10 minutes", - // "queueIsFull": false, - // "queueAll": false, - // "lastUpdated": "2020-08-03T23:46:00.000Z", - // "refreshIntervalSeconds": 20, - // "queueingMethod": "fifo", - // "isFIFOQueue": true, - // "isRandomQueue": false, - // "isPassthroughQueue": false, - // "isRejectQueue": false, - // "isEventActive": false, - // "isEventPrequeueing": false, - // "timeUntilEventStart": 0, - // "timeUntilEventStartFormatted": "unavailable", - // "timeUntilEventEnd": 0, - // "timeUntilEventEndFormatted": "unavailable", - // "shuffleAtEventStart": false - // } - // } - // - // If `json_response_enabled` is **true** and the request hits the waiting room, an - // example JSON response when `queueingMethod` is **random** and an event is active - // could be: - // - // { - // "cfWaitingRoom": { - // "inWaitingRoom": true, - // "waitTimeKnown": true, - // "waitTime": 10, - // "waitTime25Percentile": 5, - // "waitTime50Percentile": 10, - // "waitTime75Percentile": 15, - // "waitTimeFormatted": "5 minutes to 15 minutes", - // "queueIsFull": false, - // "queueAll": false, - // "lastUpdated": "2020-08-03T23:46:00.000Z", - // "refreshIntervalSeconds": 20, - // "queueingMethod": "random", - // "isFIFOQueue": false, - // "isRandomQueue": true, - // "isPassthroughQueue": false, - // "isRejectQueue": false, - // "isEventActive": true, - // "isEventPrequeueing": false, - // "timeUntilEventStart": 0, - // "timeUntilEventStartFormatted": "unavailable", - // "timeUntilEventEnd": 15, - // "timeUntilEventEndFormatted": "15 minutes", - // "shuffleAtEventStart": true - // } - // }. - JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` - // Sets the path within the host to enable the waiting room on. The waiting room - // will be enabled for all subpaths as well. If there are two waiting rooms on the - // same subpath, the waiting room for the most specific path will be chosen. - // Wildcards and query parameters are not supported. - Path param.Field[string] `json:"path"` - // If queue_all is `true`, all the traffic that is coming to a route will be sent - // to the waiting room. No new traffic can get to the route once this field is set - // and estimated time will become unavailable. - QueueAll param.Field[bool] `json:"queue_all"` - // Sets the queueing method used by the waiting room. Changing this parameter from - // the **default** queueing method is only available for the Waiting Room Advanced - // subscription. Regardless of the queueing method, if `queue_all` is enabled or an - // event is prequeueing, users in the waiting room will not be accepted to the - // origin. These users will always see a waiting room page that refreshes - // automatically. The valid queueing methods are: - // - // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - // the order they arrived. - // 2. `random`: Random queue where customers gain access randomly, regardless of - // arrival time. - // 3. `passthrough`: Users will pass directly through the waiting room and into the - // origin website. As a result, any configured limits will not be respected - // while this is enabled. This method can be used as an alternative to disabling - // a waiting room (with `suspended`) so that analytics are still reported. This - // can be used if you wish to allow all traffic normally, but want to restrict - // traffic during a waiting room event, or vice versa. - // 4. `reject`: Users will be immediately rejected from the waiting room. As a - // result, no users will reach the origin website while this is enabled. This - // can be used if you wish to reject all traffic while performing maintenance, - // block traffic during a specified period of time (an event), or block traffic - // while events are not occurring. Consider a waiting room used for vaccine - // distribution that only allows traffic during sign-up events, and otherwise - // blocks all traffic. For this case, the waiting room uses `reject`, and its - // events override this with `fifo`, `random`, or `passthrough`. When this - // queueing method is enabled and neither `queueAll` is enabled nor an event is - // prequeueing, the waiting room page **will not refresh automatically**. - QueueingMethod param.Field[WaitingRoomUpdateParamsQueueingMethod] `json:"queueing_method"` - // HTTP status code returned to a user while in the queue. - QueueingStatusCode param.Field[WaitingRoomUpdateParamsQueueingStatusCode] `json:"queueing_status_code"` - // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - // the route. If a user is not seen by Cloudflare again in that time period, they - // will be treated as a new user that visits the route. - SessionDuration param.Field[int64] `json:"session_duration"` - // Suspends or allows traffic going to the waiting room. If set to `true`, the - // traffic will not go to the waiting room. - Suspended param.Field[bool] `json:"suspended"` + Query QueryParam `json:"query,required"` } func (r WaitingRoomUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The language of the default page template. If no default_template_language is -// provided, then `en-US` (English) will be used. -type WaitingRoomUpdateParamsDefaultTemplateLanguage string - -const ( - WaitingRoomUpdateParamsDefaultTemplateLanguageEnUs WaitingRoomUpdateParamsDefaultTemplateLanguage = "en-US" - WaitingRoomUpdateParamsDefaultTemplateLanguageEsEs WaitingRoomUpdateParamsDefaultTemplateLanguage = "es-ES" - WaitingRoomUpdateParamsDefaultTemplateLanguageDeDe WaitingRoomUpdateParamsDefaultTemplateLanguage = "de-DE" - WaitingRoomUpdateParamsDefaultTemplateLanguageFrFr WaitingRoomUpdateParamsDefaultTemplateLanguage = "fr-FR" - WaitingRoomUpdateParamsDefaultTemplateLanguageItIt WaitingRoomUpdateParamsDefaultTemplateLanguage = "it-IT" - WaitingRoomUpdateParamsDefaultTemplateLanguageJaJp WaitingRoomUpdateParamsDefaultTemplateLanguage = "ja-JP" - WaitingRoomUpdateParamsDefaultTemplateLanguageKoKr WaitingRoomUpdateParamsDefaultTemplateLanguage = "ko-KR" - WaitingRoomUpdateParamsDefaultTemplateLanguagePtBr WaitingRoomUpdateParamsDefaultTemplateLanguage = "pt-BR" - WaitingRoomUpdateParamsDefaultTemplateLanguageZhCn WaitingRoomUpdateParamsDefaultTemplateLanguage = "zh-CN" - WaitingRoomUpdateParamsDefaultTemplateLanguageZhTw WaitingRoomUpdateParamsDefaultTemplateLanguage = "zh-TW" - WaitingRoomUpdateParamsDefaultTemplateLanguageNlNl WaitingRoomUpdateParamsDefaultTemplateLanguage = "nl-NL" - WaitingRoomUpdateParamsDefaultTemplateLanguagePlPl WaitingRoomUpdateParamsDefaultTemplateLanguage = "pl-PL" - WaitingRoomUpdateParamsDefaultTemplateLanguageIDID WaitingRoomUpdateParamsDefaultTemplateLanguage = "id-ID" - WaitingRoomUpdateParamsDefaultTemplateLanguageTrTr WaitingRoomUpdateParamsDefaultTemplateLanguage = "tr-TR" - WaitingRoomUpdateParamsDefaultTemplateLanguageArEg WaitingRoomUpdateParamsDefaultTemplateLanguage = "ar-EG" - WaitingRoomUpdateParamsDefaultTemplateLanguageRuRu WaitingRoomUpdateParamsDefaultTemplateLanguage = "ru-RU" - WaitingRoomUpdateParamsDefaultTemplateLanguageFaIr WaitingRoomUpdateParamsDefaultTemplateLanguage = "fa-IR" -) - -func (r WaitingRoomUpdateParamsDefaultTemplateLanguage) IsKnown() bool { - switch r { - case WaitingRoomUpdateParamsDefaultTemplateLanguageEnUs, WaitingRoomUpdateParamsDefaultTemplateLanguageEsEs, WaitingRoomUpdateParamsDefaultTemplateLanguageDeDe, WaitingRoomUpdateParamsDefaultTemplateLanguageFrFr, WaitingRoomUpdateParamsDefaultTemplateLanguageItIt, WaitingRoomUpdateParamsDefaultTemplateLanguageJaJp, WaitingRoomUpdateParamsDefaultTemplateLanguageKoKr, WaitingRoomUpdateParamsDefaultTemplateLanguagePtBr, WaitingRoomUpdateParamsDefaultTemplateLanguageZhCn, WaitingRoomUpdateParamsDefaultTemplateLanguageZhTw, WaitingRoomUpdateParamsDefaultTemplateLanguageNlNl, WaitingRoomUpdateParamsDefaultTemplateLanguagePlPl, WaitingRoomUpdateParamsDefaultTemplateLanguageIDID, WaitingRoomUpdateParamsDefaultTemplateLanguageTrTr, WaitingRoomUpdateParamsDefaultTemplateLanguageArEg, WaitingRoomUpdateParamsDefaultTemplateLanguageRuRu, WaitingRoomUpdateParamsDefaultTemplateLanguageFaIr: - return true - } - return false -} - -// Sets the queueing method used by the waiting room. Changing this parameter from -// the **default** queueing method is only available for the Waiting Room Advanced -// subscription. Regardless of the queueing method, if `queue_all` is enabled or an -// event is prequeueing, users in the waiting room will not be accepted to the -// origin. These users will always see a waiting room page that refreshes -// automatically. The valid queueing methods are: -// -// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in -// the order they arrived. -// 2. `random`: Random queue where customers gain access randomly, regardless of -// arrival time. -// 3. `passthrough`: Users will pass directly through the waiting room and into the -// origin website. As a result, any configured limits will not be respected -// while this is enabled. This method can be used as an alternative to disabling -// a waiting room (with `suspended`) so that analytics are still reported. This -// can be used if you wish to allow all traffic normally, but want to restrict -// traffic during a waiting room event, or vice versa. -// 4. `reject`: Users will be immediately rejected from the waiting room. As a -// result, no users will reach the origin website while this is enabled. This -// can be used if you wish to reject all traffic while performing maintenance, -// block traffic during a specified period of time (an event), or block traffic -// while events are not occurring. Consider a waiting room used for vaccine -// distribution that only allows traffic during sign-up events, and otherwise -// blocks all traffic. For this case, the waiting room uses `reject`, and its -// events override this with `fifo`, `random`, or `passthrough`. When this -// queueing method is enabled and neither `queueAll` is enabled nor an event is -// prequeueing, the waiting room page **will not refresh automatically**. -type WaitingRoomUpdateParamsQueueingMethod string - -const ( - WaitingRoomUpdateParamsQueueingMethodFifo WaitingRoomUpdateParamsQueueingMethod = "fifo" - WaitingRoomUpdateParamsQueueingMethodRandom WaitingRoomUpdateParamsQueueingMethod = "random" - WaitingRoomUpdateParamsQueueingMethodPassthrough WaitingRoomUpdateParamsQueueingMethod = "passthrough" - WaitingRoomUpdateParamsQueueingMethodReject WaitingRoomUpdateParamsQueueingMethod = "reject" -) - -func (r WaitingRoomUpdateParamsQueueingMethod) IsKnown() bool { - switch r { - case WaitingRoomUpdateParamsQueueingMethodFifo, WaitingRoomUpdateParamsQueueingMethodRandom, WaitingRoomUpdateParamsQueueingMethodPassthrough, WaitingRoomUpdateParamsQueueingMethodReject: - return true - } - return false -} - -// HTTP status code returned to a user while in the queue. -type WaitingRoomUpdateParamsQueueingStatusCode int64 - -const ( - WaitingRoomUpdateParamsQueueingStatusCode200 WaitingRoomUpdateParamsQueueingStatusCode = 200 - WaitingRoomUpdateParamsQueueingStatusCode202 WaitingRoomUpdateParamsQueueingStatusCode = 202 - WaitingRoomUpdateParamsQueueingStatusCode429 WaitingRoomUpdateParamsQueueingStatusCode = 429 -) - -func (r WaitingRoomUpdateParamsQueueingStatusCode) IsKnown() bool { - switch r { - case WaitingRoomUpdateParamsQueueingStatusCode200, WaitingRoomUpdateParamsQueueingStatusCode202, WaitingRoomUpdateParamsQueueingStatusCode429: - return true - } - return false + return apijson.MarshalRoot(r.Query) } type WaitingRoomUpdateResponseEnvelope struct { @@ -1465,8 +1125,8 @@ type WaitingRoomListParams struct { type WaitingRoomDeleteParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Body param.Field[interface{}] `json:"body,required"` + ZoneID param.Field[string] `path:"zone_id,required"` + Body interface{} `json:"body,required"` } func (r WaitingRoomDeleteParams) MarshalJSON() (data []byte, err error) { @@ -1503,359 +1163,11 @@ func (r waitingRoomDeleteResponseEnvelopeJSON) RawJSON() string { type WaitingRoomEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - // The host name to which the waiting room will be applied (no wildcards). Please - // do not include the scheme (http:// or https://). The host and path combination - // must be unique. - Host param.Field[string] `json:"host,required"` - // A unique name to identify the waiting room. Only alphanumeric characters, - // hyphens and underscores are allowed. - Name param.Field[string] `json:"name,required"` - // Sets the number of new users that will be let into the route every minute. This - // value is used as baseline for the number of users that are let in per minute. So - // it is possible that there is a little more or little less traffic coming to the - // route based on the traffic patterns at that time around the world. - NewUsersPerMinute param.Field[int64] `json:"new_users_per_minute,required"` - // Sets the total number of active user sessions on the route at a point in time. A - // route is a combination of host and path on which a waiting room is available. - // This value is used as a baseline for the total number of active user sessions on - // the route. It is possible to have a situation where there are more or less - // active users sessions on the route based on the traffic patterns at that time - // around the world. - TotalActiveUsers param.Field[int64] `json:"total_active_users,required"` - // Only available for the Waiting Room Advanced subscription. Additional hostname - // and path combinations to which this waiting room will be applied. There is an - // implied wildcard at the end of the path. The hostname and path combination must - // be unique to this and all other waiting rooms. - AdditionalRoutes param.Field[[]AdditionalRoutesParam] `json:"additional_routes"` - // Configures cookie attributes for the waiting room cookie. This encrypted cookie - // stores a user's status in the waiting room, such as queue position. - CookieAttributes param.Field[CookieAttributesParam] `json:"cookie_attributes"` - // Appends a '\_' + a custom suffix to the end of Cloudflare Waiting Room's cookie - // name(**cf_waitingroom). If `cookie_suffix` is "abcd", the cookie name will be - // `**cf_waitingroom_abcd`. This field is required if using `additional_routes`. - CookieSuffix param.Field[string] `json:"cookie_suffix"` - // Only available for the Waiting Room Advanced subscription. This is a template - // html file that will be rendered at the edge. If no custom_page_html is provided, - // the default waiting room will be used. The template is based on mustache ( - // https://mustache.github.io/ ). There are several variables that are evaluated by - // the Cloudflare edge: - // - // 1. {{`waitTimeKnown`}} Acts like a boolean value that indicates the behavior to - // take when wait time is not available, for instance when queue_all is - // **true**. - // 2. {{`waitTimeFormatted`}} Estimated wait time for the user. For example, five - // minutes. Alternatively, you can use: - // 3. {{`waitTime`}} Number of minutes of estimated wait for a user. - // 4. {{`waitTimeHours`}} Number of hours of estimated wait for a user - // (`Math.floor(waitTime/60)`). - // 5. {{`waitTimeHourMinutes`}} Number of minutes above the `waitTimeHours` value - // (`waitTime%60`). - // 6. {{`queueIsFull`}} Changes to **true** when no more people can be added to the - // queue. - // - // To view the full list of variables, look at the `cfWaitingRoom` object described - // under the `json_response_enabled` property in other Waiting Room API calls. - CustomPageHTML param.Field[string] `json:"custom_page_html"` - // The language of the default page template. If no default_template_language is - // provided, then `en-US` (English) will be used. - DefaultTemplateLanguage param.Field[WaitingRoomEditParamsDefaultTemplateLanguage] `json:"default_template_language"` - // A note that you can use to add more details about the waiting room. - Description param.Field[string] `json:"description"` - // Only available for the Waiting Room Advanced subscription. Disables automatic - // renewal of session cookies. If `true`, an accepted user will have - // session_duration minutes to browse the site. After that, they will have to go - // through the waiting room again. If `false`, a user's session cookie will be - // automatically renewed on every request. - DisableSessionRenewal param.Field[bool] `json:"disable_session_renewal"` - // Only available for the Waiting Room Advanced subscription. If `true`, requests - // to the waiting room with the header `Accept: application/json` will receive a - // JSON response object with information on the user's status in the waiting room - // as opposed to the configured static HTML page. This JSON response object has one - // property `cfWaitingRoom` which is an object containing the following fields: - // - // 1. `inWaitingRoom`: Boolean indicating if the user is in the waiting room - // (always **true**). - // 2. `waitTimeKnown`: Boolean indicating if the current estimated wait times are - // accurate. If **false**, they are not available. - // 3. `waitTime`: Valid only when `waitTimeKnown` is **true**. Integer indicating - // the current estimated time in minutes the user will wait in the waiting room. - // When `queueingMethod` is **random**, this is set to `waitTime50Percentile`. - // 4. `waitTime25Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 25% of users that gain entry the fastest (25th percentile). - // 5. `waitTime50Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 50% of users that gain entry the fastest (50th percentile). - // In other words, half of the queued users are expected to let into the origin - // website before `waitTime50Percentile` and half are expected to be let in - // after it. - // 6. `waitTime75Percentile`: Valid only when `queueingMethod` is **random** and - // `waitTimeKnown` is **true**. Integer indicating the current estimated maximum - // wait time for the 75% of users that gain entry the fastest (75th percentile). - // 7. `waitTimeFormatted`: String displaying the `waitTime` formatted in English - // for users. If `waitTimeKnown` is **false**, `waitTimeFormatted` will display - // **unavailable**. - // 8. `queueIsFull`: Boolean indicating if the waiting room's queue is currently - // full and not accepting new users at the moment. - // 9. `queueAll`: Boolean indicating if all users will be queued in the waiting - // room and no one will be let into the origin website. - // 10. `lastUpdated`: String displaying the timestamp as an ISO 8601 string of the - // user's last attempt to leave the waiting room and be let into the origin - // website. The user is able to make another attempt after - // `refreshIntervalSeconds` past this time. If the user makes a request too - // soon, it will be ignored and `lastUpdated` will not change. - // 11. `refreshIntervalSeconds`: Integer indicating the number of seconds after - // `lastUpdated` until the user is able to make another attempt to leave the - // waiting room and be let into the origin website. When the `queueingMethod` - // is `reject`, there is no specified refresh time — it will always be - // **zero**. - // 12. `queueingMethod`: The queueing method currently used by the waiting room. It - // is either **fifo**, **random**, **passthrough**, or **reject**. - // 13. `isFIFOQueue`: Boolean indicating if the waiting room uses a FIFO - // (First-In-First-Out) queue. - // 14. `isRandomQueue`: Boolean indicating if the waiting room uses a Random queue - // where users gain access randomly. - // 15. `isPassthroughQueue`: Boolean indicating if the waiting room uses a - // passthrough queue. Keep in mind that when passthrough is enabled, this JSON - // response will only exist when `queueAll` is **true** or `isEventPrequeueing` - // is **true** because in all other cases requests will go directly to the - // origin. - // 16. `isRejectQueue`: Boolean indicating if the waiting room uses a reject queue. - // 17. `isEventActive`: Boolean indicating if an event is currently occurring. - // Events are able to change a waiting room's behavior during a specified - // period of time. For additional information, look at the event properties - // `prequeue_start_time`, `event_start_time`, and `event_end_time` in the - // documentation for creating waiting room events. Events are considered active - // between these start and end times, as well as during the prequeueing period - // if it exists. - // 18. `isEventPrequeueing`: Valid only when `isEventActive` is **true**. Boolean - // indicating if an event is currently prequeueing users before it starts. - // 19. `timeUntilEventStart`: Valid only when `isEventPrequeueing` is **true**. - // Integer indicating the number of minutes until the event starts. - // 20. `timeUntilEventStartFormatted`: String displaying the `timeUntilEventStart` - // formatted in English for users. If `isEventPrequeueing` is **false**, - // `timeUntilEventStartFormatted` will display **unavailable**. - // 21. `timeUntilEventEnd`: Valid only when `isEventActive` is **true**. Integer - // indicating the number of minutes until the event ends. - // 22. `timeUntilEventEndFormatted`: String displaying the `timeUntilEventEnd` - // formatted in English for users. If `isEventActive` is **false**, - // `timeUntilEventEndFormatted` will display **unavailable**. - // 23. `shuffleAtEventStart`: Valid only when `isEventActive` is **true**. Boolean - // indicating if the users in the prequeue are shuffled randomly when the event - // starts. - // - // An example cURL to a waiting room could be: - // - // curl -X GET "https://example.com/waitingroom" \ - // -H "Accept: application/json" - // - // If `json_response_enabled` is **true** and the request hits the waiting room, an - // example JSON response when `queueingMethod` is **fifo** and no event is active - // could be: - // - // { - // "cfWaitingRoom": { - // "inWaitingRoom": true, - // "waitTimeKnown": true, - // "waitTime": 10, - // "waitTime25Percentile": 0, - // "waitTime50Percentile": 0, - // "waitTime75Percentile": 0, - // "waitTimeFormatted": "10 minutes", - // "queueIsFull": false, - // "queueAll": false, - // "lastUpdated": "2020-08-03T23:46:00.000Z", - // "refreshIntervalSeconds": 20, - // "queueingMethod": "fifo", - // "isFIFOQueue": true, - // "isRandomQueue": false, - // "isPassthroughQueue": false, - // "isRejectQueue": false, - // "isEventActive": false, - // "isEventPrequeueing": false, - // "timeUntilEventStart": 0, - // "timeUntilEventStartFormatted": "unavailable", - // "timeUntilEventEnd": 0, - // "timeUntilEventEndFormatted": "unavailable", - // "shuffleAtEventStart": false - // } - // } - // - // If `json_response_enabled` is **true** and the request hits the waiting room, an - // example JSON response when `queueingMethod` is **random** and an event is active - // could be: - // - // { - // "cfWaitingRoom": { - // "inWaitingRoom": true, - // "waitTimeKnown": true, - // "waitTime": 10, - // "waitTime25Percentile": 5, - // "waitTime50Percentile": 10, - // "waitTime75Percentile": 15, - // "waitTimeFormatted": "5 minutes to 15 minutes", - // "queueIsFull": false, - // "queueAll": false, - // "lastUpdated": "2020-08-03T23:46:00.000Z", - // "refreshIntervalSeconds": 20, - // "queueingMethod": "random", - // "isFIFOQueue": false, - // "isRandomQueue": true, - // "isPassthroughQueue": false, - // "isRejectQueue": false, - // "isEventActive": true, - // "isEventPrequeueing": false, - // "timeUntilEventStart": 0, - // "timeUntilEventStartFormatted": "unavailable", - // "timeUntilEventEnd": 15, - // "timeUntilEventEndFormatted": "15 minutes", - // "shuffleAtEventStart": true - // } - // }. - JsonResponseEnabled param.Field[bool] `json:"json_response_enabled"` - // Sets the path within the host to enable the waiting room on. The waiting room - // will be enabled for all subpaths as well. If there are two waiting rooms on the - // same subpath, the waiting room for the most specific path will be chosen. - // Wildcards and query parameters are not supported. - Path param.Field[string] `json:"path"` - // If queue_all is `true`, all the traffic that is coming to a route will be sent - // to the waiting room. No new traffic can get to the route once this field is set - // and estimated time will become unavailable. - QueueAll param.Field[bool] `json:"queue_all"` - // Sets the queueing method used by the waiting room. Changing this parameter from - // the **default** queueing method is only available for the Waiting Room Advanced - // subscription. Regardless of the queueing method, if `queue_all` is enabled or an - // event is prequeueing, users in the waiting room will not be accepted to the - // origin. These users will always see a waiting room page that refreshes - // automatically. The valid queueing methods are: - // - // 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in - // the order they arrived. - // 2. `random`: Random queue where customers gain access randomly, regardless of - // arrival time. - // 3. `passthrough`: Users will pass directly through the waiting room and into the - // origin website. As a result, any configured limits will not be respected - // while this is enabled. This method can be used as an alternative to disabling - // a waiting room (with `suspended`) so that analytics are still reported. This - // can be used if you wish to allow all traffic normally, but want to restrict - // traffic during a waiting room event, or vice versa. - // 4. `reject`: Users will be immediately rejected from the waiting room. As a - // result, no users will reach the origin website while this is enabled. This - // can be used if you wish to reject all traffic while performing maintenance, - // block traffic during a specified period of time (an event), or block traffic - // while events are not occurring. Consider a waiting room used for vaccine - // distribution that only allows traffic during sign-up events, and otherwise - // blocks all traffic. For this case, the waiting room uses `reject`, and its - // events override this with `fifo`, `random`, or `passthrough`. When this - // queueing method is enabled and neither `queueAll` is enabled nor an event is - // prequeueing, the waiting room page **will not refresh automatically**. - QueueingMethod param.Field[WaitingRoomEditParamsQueueingMethod] `json:"queueing_method"` - // HTTP status code returned to a user while in the queue. - QueueingStatusCode param.Field[WaitingRoomEditParamsQueueingStatusCode] `json:"queueing_status_code"` - // Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to - // the route. If a user is not seen by Cloudflare again in that time period, they - // will be treated as a new user that visits the route. - SessionDuration param.Field[int64] `json:"session_duration"` - // Suspends or allows traffic going to the waiting room. If set to `true`, the - // traffic will not go to the waiting room. - Suspended param.Field[bool] `json:"suspended"` + Query QueryParam `json:"query,required"` } func (r WaitingRoomEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The language of the default page template. If no default_template_language is -// provided, then `en-US` (English) will be used. -type WaitingRoomEditParamsDefaultTemplateLanguage string - -const ( - WaitingRoomEditParamsDefaultTemplateLanguageEnUs WaitingRoomEditParamsDefaultTemplateLanguage = "en-US" - WaitingRoomEditParamsDefaultTemplateLanguageEsEs WaitingRoomEditParamsDefaultTemplateLanguage = "es-ES" - WaitingRoomEditParamsDefaultTemplateLanguageDeDe WaitingRoomEditParamsDefaultTemplateLanguage = "de-DE" - WaitingRoomEditParamsDefaultTemplateLanguageFrFr WaitingRoomEditParamsDefaultTemplateLanguage = "fr-FR" - WaitingRoomEditParamsDefaultTemplateLanguageItIt WaitingRoomEditParamsDefaultTemplateLanguage = "it-IT" - WaitingRoomEditParamsDefaultTemplateLanguageJaJp WaitingRoomEditParamsDefaultTemplateLanguage = "ja-JP" - WaitingRoomEditParamsDefaultTemplateLanguageKoKr WaitingRoomEditParamsDefaultTemplateLanguage = "ko-KR" - WaitingRoomEditParamsDefaultTemplateLanguagePtBr WaitingRoomEditParamsDefaultTemplateLanguage = "pt-BR" - WaitingRoomEditParamsDefaultTemplateLanguageZhCn WaitingRoomEditParamsDefaultTemplateLanguage = "zh-CN" - WaitingRoomEditParamsDefaultTemplateLanguageZhTw WaitingRoomEditParamsDefaultTemplateLanguage = "zh-TW" - WaitingRoomEditParamsDefaultTemplateLanguageNlNl WaitingRoomEditParamsDefaultTemplateLanguage = "nl-NL" - WaitingRoomEditParamsDefaultTemplateLanguagePlPl WaitingRoomEditParamsDefaultTemplateLanguage = "pl-PL" - WaitingRoomEditParamsDefaultTemplateLanguageIDID WaitingRoomEditParamsDefaultTemplateLanguage = "id-ID" - WaitingRoomEditParamsDefaultTemplateLanguageTrTr WaitingRoomEditParamsDefaultTemplateLanguage = "tr-TR" - WaitingRoomEditParamsDefaultTemplateLanguageArEg WaitingRoomEditParamsDefaultTemplateLanguage = "ar-EG" - WaitingRoomEditParamsDefaultTemplateLanguageRuRu WaitingRoomEditParamsDefaultTemplateLanguage = "ru-RU" - WaitingRoomEditParamsDefaultTemplateLanguageFaIr WaitingRoomEditParamsDefaultTemplateLanguage = "fa-IR" -) - -func (r WaitingRoomEditParamsDefaultTemplateLanguage) IsKnown() bool { - switch r { - case WaitingRoomEditParamsDefaultTemplateLanguageEnUs, WaitingRoomEditParamsDefaultTemplateLanguageEsEs, WaitingRoomEditParamsDefaultTemplateLanguageDeDe, WaitingRoomEditParamsDefaultTemplateLanguageFrFr, WaitingRoomEditParamsDefaultTemplateLanguageItIt, WaitingRoomEditParamsDefaultTemplateLanguageJaJp, WaitingRoomEditParamsDefaultTemplateLanguageKoKr, WaitingRoomEditParamsDefaultTemplateLanguagePtBr, WaitingRoomEditParamsDefaultTemplateLanguageZhCn, WaitingRoomEditParamsDefaultTemplateLanguageZhTw, WaitingRoomEditParamsDefaultTemplateLanguageNlNl, WaitingRoomEditParamsDefaultTemplateLanguagePlPl, WaitingRoomEditParamsDefaultTemplateLanguageIDID, WaitingRoomEditParamsDefaultTemplateLanguageTrTr, WaitingRoomEditParamsDefaultTemplateLanguageArEg, WaitingRoomEditParamsDefaultTemplateLanguageRuRu, WaitingRoomEditParamsDefaultTemplateLanguageFaIr: - return true - } - return false -} - -// Sets the queueing method used by the waiting room. Changing this parameter from -// the **default** queueing method is only available for the Waiting Room Advanced -// subscription. Regardless of the queueing method, if `queue_all` is enabled or an -// event is prequeueing, users in the waiting room will not be accepted to the -// origin. These users will always see a waiting room page that refreshes -// automatically. The valid queueing methods are: -// -// 1. `fifo` **(default)**: First-In-First-Out queue where customers gain access in -// the order they arrived. -// 2. `random`: Random queue where customers gain access randomly, regardless of -// arrival time. -// 3. `passthrough`: Users will pass directly through the waiting room and into the -// origin website. As a result, any configured limits will not be respected -// while this is enabled. This method can be used as an alternative to disabling -// a waiting room (with `suspended`) so that analytics are still reported. This -// can be used if you wish to allow all traffic normally, but want to restrict -// traffic during a waiting room event, or vice versa. -// 4. `reject`: Users will be immediately rejected from the waiting room. As a -// result, no users will reach the origin website while this is enabled. This -// can be used if you wish to reject all traffic while performing maintenance, -// block traffic during a specified period of time (an event), or block traffic -// while events are not occurring. Consider a waiting room used for vaccine -// distribution that only allows traffic during sign-up events, and otherwise -// blocks all traffic. For this case, the waiting room uses `reject`, and its -// events override this with `fifo`, `random`, or `passthrough`. When this -// queueing method is enabled and neither `queueAll` is enabled nor an event is -// prequeueing, the waiting room page **will not refresh automatically**. -type WaitingRoomEditParamsQueueingMethod string - -const ( - WaitingRoomEditParamsQueueingMethodFifo WaitingRoomEditParamsQueueingMethod = "fifo" - WaitingRoomEditParamsQueueingMethodRandom WaitingRoomEditParamsQueueingMethod = "random" - WaitingRoomEditParamsQueueingMethodPassthrough WaitingRoomEditParamsQueueingMethod = "passthrough" - WaitingRoomEditParamsQueueingMethodReject WaitingRoomEditParamsQueueingMethod = "reject" -) - -func (r WaitingRoomEditParamsQueueingMethod) IsKnown() bool { - switch r { - case WaitingRoomEditParamsQueueingMethodFifo, WaitingRoomEditParamsQueueingMethodRandom, WaitingRoomEditParamsQueueingMethodPassthrough, WaitingRoomEditParamsQueueingMethodReject: - return true - } - return false -} - -// HTTP status code returned to a user while in the queue. -type WaitingRoomEditParamsQueueingStatusCode int64 - -const ( - WaitingRoomEditParamsQueueingStatusCode200 WaitingRoomEditParamsQueueingStatusCode = 200 - WaitingRoomEditParamsQueueingStatusCode202 WaitingRoomEditParamsQueueingStatusCode = 202 - WaitingRoomEditParamsQueueingStatusCode429 WaitingRoomEditParamsQueueingStatusCode = 429 -) - -func (r WaitingRoomEditParamsQueueingStatusCode) IsKnown() bool { - switch r { - case WaitingRoomEditParamsQueueingStatusCode200, WaitingRoomEditParamsQueueingStatusCode202, WaitingRoomEditParamsQueueingStatusCode429: - return true - } - return false + return apijson.MarshalRoot(r.Query) } type WaitingRoomEditResponseEnvelope struct { diff --git a/waiting_rooms/waitingroom_test.go b/waiting_rooms/waitingroom_test.go index 47a9705938d..41f31777722 100644 --- a/waiting_rooms/waitingroom_test.go +++ b/waiting_rooms/waitingroom_test.go @@ -29,37 +29,39 @@ func TestWaitingRoomNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.WaitingRooms.New(context.TODO(), waiting_rooms.WaitingRoomNewParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Host: cloudflare.F("shop.example.com"), - Name: cloudflare.F("production_webinar"), - NewUsersPerMinute: cloudflare.F(int64(200)), - TotalActiveUsers: cloudflare.F(int64(200)), - AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }}), - CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ - Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), - Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), - }), - CookieSuffix: cloudflare.F("abcd"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), - DefaultTemplateLanguage: cloudflare.F(waiting_rooms.WaitingRoomNewParamsDefaultTemplateLanguageEsEs), - Description: cloudflare.F("Production - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(false), - JsonResponseEnabled: cloudflare.F(false), - Path: cloudflare.F("/shop/checkout"), - QueueAll: cloudflare.F(true), - QueueingMethod: cloudflare.F(waiting_rooms.WaitingRoomNewParamsQueueingMethodFifo), - QueueingStatusCode: cloudflare.F(waiting_rooms.WaitingRoomNewParamsQueueingStatusCode202), - SessionDuration: cloudflare.F(int64(1)), - Suspended: cloudflare.F(true), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Query: waiting_rooms.QueryParam{ + AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ + Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), + Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(waiting_rooms.QueryDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + Host: cloudflare.F("shop.example.com"), + JsonResponseEnabled: cloudflare.F(false), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(waiting_rooms.QueryQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(waiting_rooms.QueryQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }) if err != nil { var apierr *cloudflare.Error @@ -88,37 +90,39 @@ func TestWaitingRoomUpdateWithOptionalParams(t *testing.T) { context.TODO(), "699d98642c564d2e855e9661899b7252", waiting_rooms.WaitingRoomUpdateParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Host: cloudflare.F("shop.example.com"), - Name: cloudflare.F("production_webinar"), - NewUsersPerMinute: cloudflare.F(int64(200)), - TotalActiveUsers: cloudflare.F(int64(200)), - AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }}), - CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ - Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), - Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), - }), - CookieSuffix: cloudflare.F("abcd"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), - DefaultTemplateLanguage: cloudflare.F(waiting_rooms.WaitingRoomUpdateParamsDefaultTemplateLanguageEsEs), - Description: cloudflare.F("Production - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(false), - JsonResponseEnabled: cloudflare.F(false), - Path: cloudflare.F("/shop/checkout"), - QueueAll: cloudflare.F(true), - QueueingMethod: cloudflare.F(waiting_rooms.WaitingRoomUpdateParamsQueueingMethodFifo), - QueueingStatusCode: cloudflare.F(waiting_rooms.WaitingRoomUpdateParamsQueueingStatusCode202), - SessionDuration: cloudflare.F(int64(1)), - Suspended: cloudflare.F(true), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Query: waiting_rooms.QueryParam{ + AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ + Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), + Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(waiting_rooms.QueryDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + Host: cloudflare.F("shop.example.com"), + JsonResponseEnabled: cloudflare.F(false), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(waiting_rooms.QueryQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(waiting_rooms.QueryQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }, ) if err != nil { @@ -175,7 +179,7 @@ func TestWaitingRoomDelete(t *testing.T) { "699d98642c564d2e855e9661899b7252", waiting_rooms.WaitingRoomDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -205,37 +209,39 @@ func TestWaitingRoomEditWithOptionalParams(t *testing.T) { context.TODO(), "699d98642c564d2e855e9661899b7252", waiting_rooms.WaitingRoomEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Host: cloudflare.F("shop.example.com"), - Name: cloudflare.F("production_webinar"), - NewUsersPerMinute: cloudflare.F(int64(200)), - TotalActiveUsers: cloudflare.F(int64(200)), - AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }, { - Host: cloudflare.F("shop2.example.com"), - Path: cloudflare.F("/shop2/checkout"), - }}), - CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ - Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), - Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), - }), - CookieSuffix: cloudflare.F("abcd"), - CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), - DefaultTemplateLanguage: cloudflare.F(waiting_rooms.WaitingRoomEditParamsDefaultTemplateLanguageEsEs), - Description: cloudflare.F("Production - DO NOT MODIFY"), - DisableSessionRenewal: cloudflare.F(false), - JsonResponseEnabled: cloudflare.F(false), - Path: cloudflare.F("/shop/checkout"), - QueueAll: cloudflare.F(true), - QueueingMethod: cloudflare.F(waiting_rooms.WaitingRoomEditParamsQueueingMethodFifo), - QueueingStatusCode: cloudflare.F(waiting_rooms.WaitingRoomEditParamsQueueingStatusCode202), - SessionDuration: cloudflare.F(int64(1)), - Suspended: cloudflare.F(true), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Query: waiting_rooms.QueryParam{ + AdditionalRoutes: cloudflare.F([]waiting_rooms.AdditionalRoutesParam{{ + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }, { + Host: cloudflare.F("shop2.example.com"), + Path: cloudflare.F("/shop2/checkout"), + }}), + CookieAttributes: cloudflare.F(waiting_rooms.CookieAttributesParam{ + Samesite: cloudflare.F(waiting_rooms.CookieAttributesSamesiteAuto), + Secure: cloudflare.F(waiting_rooms.CookieAttributesSecureAuto), + }), + CookieSuffix: cloudflare.F("abcd"), + CustomPageHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"), + DefaultTemplateLanguage: cloudflare.F(waiting_rooms.QueryDefaultTemplateLanguageEsEs), + Description: cloudflare.F("Production - DO NOT MODIFY"), + DisableSessionRenewal: cloudflare.F(false), + Host: cloudflare.F("shop.example.com"), + JsonResponseEnabled: cloudflare.F(false), + Name: cloudflare.F("production_webinar"), + NewUsersPerMinute: cloudflare.F(int64(200)), + Path: cloudflare.F("/shop/checkout"), + QueueAll: cloudflare.F(true), + QueueingMethod: cloudflare.F(waiting_rooms.QueryQueueingMethodFifo), + QueueingStatusCode: cloudflare.F(waiting_rooms.QueryQueueingStatusCode202), + SessionDuration: cloudflare.F(int64(1)), + Suspended: cloudflare.F(true), + TotalActiveUsers: cloudflare.F(int64(200)), + }, }, ) if err != nil { diff --git a/warp_connector/aliases.go b/warp_connector/aliases.go index 7aac6343dd3..66f0ff25183 100644 --- a/warp_connector/aliases.go +++ b/warp_connector/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/warp_connector/warpconnector.go b/warp_connector/warpconnector.go index 6d56d417912..d9d3dd4525f 100644 --- a/warp_connector/warpconnector.go +++ b/warp_connector/warpconnector.go @@ -608,8 +608,8 @@ func (r WARPConnectorListParams) URLQuery() (v url.Values) { type WARPConnectorDeleteParams struct { // Cloudflare account ID - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r WARPConnectorDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/warp_connector/warpconnector_test.go b/warp_connector/warpconnector_test.go index 1874e5c47d6..4a52ce9e494 100644 --- a/warp_connector/warpconnector_test.go +++ b/warp_connector/warpconnector_test.go @@ -97,7 +97,7 @@ func TestWARPConnectorDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", warp_connector.WARPConnectorDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/web3/aliases.go b/web3/aliases.go index 62bfec2db4d..0421ee04e79 100644 --- a/web3/aliases.go +++ b/web3/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/web3/hostname.go b/web3/hostname.go index 89371da691b..6258eb9b789 100644 --- a/web3/hostname.go +++ b/web3/hostname.go @@ -296,7 +296,7 @@ func (r HostnameNewResponseEnvelopeSuccess) IsKnown() bool { } type HostnameDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r HostnameDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/web3/hostname_test.go b/web3/hostname_test.go index 853ad8f5dac..f8881dd8584 100644 --- a/web3/hostname_test.go +++ b/web3/hostname_test.go @@ -89,7 +89,7 @@ func TestHostnameDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", web3.HostnameDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/web3/hostnameipfsuniversalpathcontentlistentry.go b/web3/hostnameipfsuniversalpathcontentlistentry.go index 24131f62ebb..b47006fe67c 100644 --- a/web3/hostnameipfsuniversalpathcontentlistentry.go +++ b/web3/hostnameipfsuniversalpathcontentlistentry.go @@ -581,7 +581,7 @@ func (r hostnameIPFSUniversalPathContentListEntryListResponseEnvelopeResultInfoJ } type HostnameIPFSUniversalPathContentListEntryDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r HostnameIPFSUniversalPathContentListEntryDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/web3/hostnameipfsuniversalpathcontentlistentry_test.go b/web3/hostnameipfsuniversalpathcontentlistentry_test.go index e0857ae04a9..be6989fa6d6 100644 --- a/web3/hostnameipfsuniversalpathcontentlistentry_test.go +++ b/web3/hostnameipfsuniversalpathcontentlistentry_test.go @@ -129,7 +129,7 @@ func TestHostnameIPFSUniversalPathContentListEntryDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", web3.HostnameIPFSUniversalPathContentListEntryDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/workers/accountsetting.go b/workers/accountsetting.go index 1b16a18a812..9caf4c2d516 100644 --- a/workers/accountsetting.go +++ b/workers/accountsetting.go @@ -107,7 +107,7 @@ func (r accountSettingGetResponseJSON) RawJSON() string { type AccountSettingUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[string] `json:"body,required"` + Body string `json:"body,required"` } func (r AccountSettingUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/workers/accountsetting_test.go b/workers/accountsetting_test.go index bb74eaa7425..08d436c142a 100644 --- a/workers/accountsetting_test.go +++ b/workers/accountsetting_test.go @@ -30,7 +30,7 @@ func TestAccountSettingUpdate(t *testing.T) { ) _, err := client.Workers.AccountSettings.Update(context.TODO(), workers.AccountSettingUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F("{'default_usage_model': 'unbound'}"), + Body: "{'default_usage_model': 'unbound'}", }) if err != nil { var apierr *cloudflare.Error diff --git a/workers/ai.go b/workers/ai.go index 2f8eb9e88c0..f578d1c2426 100644 --- a/workers/ai.go +++ b/workers/ai.go @@ -45,7 +45,7 @@ func NewAIService(opts ...option.RequestOption) (r *AIService) { func (r *AIService) Run(ctx context.Context, modelName string, params AIRunParams, opts ...option.RequestOption) (res *AIRunResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AIRunResponseEnvelope - path := fmt.Sprintf("accounts/%s/ai/run/%s", params.getAccountID(), modelName) + path := fmt.Sprintf("accounts/%s/ai/run/%s", params.AccountID, modelName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -307,238 +307,202 @@ func (r aiRunResponseImageToTextJSON) RawJSON() string { func (r AIRunResponseImageToText) ImplementsWorkersAIRunResponseUnion() {} -// This interface is a union satisfied by one of the following: -// [AIRunParamsTextClassification], [AIRunParamsTextToImage], -// [AIRunParamsSentenceSimilarity], [AIRunParamsTextEmbeddings], -// [AIRunParamsSpeechRecognition], [AIRunParamsImageClassification], -// [AIRunParamsObjectDetection], [AIRunParamsTextGeneration], -// [AIRunParamsTranslation], [AIRunParamsSummarization], [AIRunParamsImageToText]. -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) { +type AIRunParams struct { + AccountID param.Field[string] `path:"account_id,required"` + Body AIRunParamsBodyUnion `json:"body,required"` +} + +func (r AIRunParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type AIRunParamsBody struct { + Text param.Field[interface{}] `json:"text,required"` + Guidance param.Field[float64] `json:"guidance"` + Image param.Field[interface{}] `json:"image,required"` + Mask param.Field[interface{}] `json:"mask,required"` + NumSteps param.Field[int64] `json:"num_steps"` + Prompt param.Field[string] `json:"prompt"` + Strength param.Field[float64] `json:"strength"` + Sentences param.Field[interface{}] `json:"sentences,required"` + Source param.Field[string] `json:"source"` + Audio param.Field[interface{}] `json:"audio,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"` + Messages param.Field[interface{}] `json:"messages,required"` + SourceLang param.Field[string] `json:"source_lang"` + TargetLang param.Field[string] `json:"target_lang"` + InputText param.Field[string] `json:"input_text"` + MaxLength param.Field[int64] `json:"max_length"` +} + +func (r AIRunParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsTextClassification) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsTextClassification) ImplementsAIRunParams() { +func (r AIRunParamsBody) implementsWorkersAIRunParamsBodyUnion() {} +// Satisfied by [workers.AIRunParamsBodyTextClassification], +// [workers.AIRunParamsBodyTextToImage], +// [workers.AIRunParamsBodySentenceSimilarity], +// [workers.AIRunParamsBodyTextEmbeddings], +// [workers.AIRunParamsBodySpeechRecognition], +// [workers.AIRunParamsBodyImageClassification], +// [workers.AIRunParamsBodyObjectDetection], +// [workers.AIRunParamsBodyTextGeneration], [workers.AIRunParamsBodyTranslation], +// [workers.AIRunParamsBodySummarization], [workers.AIRunParamsBodyImageToText], +// [AIRunParamsBody]. +type AIRunParamsBodyUnion interface { + implementsWorkersAIRunParamsBodyUnion() } -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"` +type AIRunParamsBodyTextClassification struct { + Text param.Field[string] `json:"text,required"` } -func (r AIRunParamsTextToImage) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyTextClassification) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsTextToImage) getAccountID() param.Field[string] { - return r.AccountID -} +func (r AIRunParamsBodyTextClassification) implementsWorkersAIRunParamsBodyUnion() {} -func (AIRunParamsTextToImage) 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 AIRunParamsSentenceSimilarity struct { - AccountID param.Field[string] `path:"account_id,required"` +func (r AIRunParamsBodyTextToImage) implementsWorkersAIRunParamsBodyUnion() {} + +type AIRunParamsBodySentenceSimilarity struct { Sentences param.Field[[]string] `json:"sentences,required"` Source param.Field[string] `json:"source,required"` } -func (r AIRunParamsSentenceSimilarity) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodySentenceSimilarity) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsSentenceSimilarity) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsSentenceSimilarity) ImplementsAIRunParams() { - -} +func (r AIRunParamsBodySentenceSimilarity) implementsWorkersAIRunParamsBodyUnion() {} -type AIRunParamsTextEmbeddings struct { - AccountID param.Field[string] `path:"account_id,required"` - Text param.Field[AIRunParamsTextEmbeddingsTextUnion] `json:"text,required"` +type AIRunParamsBodyTextEmbeddings struct { + Text param.Field[AIRunParamsBodyTextEmbeddingsTextUnion] `json:"text,required"` } -func (r AIRunParamsTextEmbeddings) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyTextEmbeddings) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsTextEmbeddings) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsTextEmbeddings) ImplementsAIRunParams() { - -} +func (r AIRunParamsBodyTextEmbeddings) implementsWorkersAIRunParamsBodyUnion() {} -// Satisfied by [shared.UnionString], [workers.AIRunParamsTextEmbeddingsTextArray]. -type AIRunParamsTextEmbeddingsTextUnion interface { - ImplementsWorkersAIRunParamsTextEmbeddingsTextUnion() +// Satisfied by [shared.UnionString], +// [workers.AIRunParamsBodyTextEmbeddingsTextArray]. +type AIRunParamsBodyTextEmbeddingsTextUnion interface { + ImplementsWorkersAIRunParamsBodyTextEmbeddingsTextUnion() } -type AIRunParamsTextEmbeddingsTextArray []string +type AIRunParamsBodyTextEmbeddingsTextArray []string -func (r AIRunParamsTextEmbeddingsTextArray) ImplementsWorkersAIRunParamsTextEmbeddingsTextUnion() {} - -type AIRunParamsSpeechRecognition struct { - AccountID param.Field[string] `path:"account_id,required"` - Audio param.Field[[]float64] `json:"audio"` +func (r AIRunParamsBodyTextEmbeddingsTextArray) ImplementsWorkersAIRunParamsBodyTextEmbeddingsTextUnion() { } -func (r AIRunParamsSpeechRecognition) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +type AIRunParamsBodySpeechRecognition struct { + Audio param.Field[[]float64] `json:"audio"` } -func (r AIRunParamsSpeechRecognition) getAccountID() param.Field[string] { - return r.AccountID +func (r AIRunParamsBodySpeechRecognition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (AIRunParamsSpeechRecognition) ImplementsAIRunParams() { +func (r AIRunParamsBodySpeechRecognition) implementsWorkersAIRunParamsBodyUnion() {} +type AIRunParamsBodyImageClassification struct { + Image param.Field[[]float64] `json:"image"` } -type AIRunParamsImageClassification struct { - AccountID param.Field[string] `path:"account_id,required"` - Image param.Field[[]float64] `json:"image"` -} - -func (r AIRunParamsImageClassification) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyImageClassification) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsImageClassification) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsImageClassification) ImplementsAIRunParams() { +func (r AIRunParamsBodyImageClassification) implementsWorkersAIRunParamsBodyUnion() {} +type AIRunParamsBodyObjectDetection struct { + Image param.Field[[]float64] `json:"image"` } -type AIRunParamsObjectDetection struct { - AccountID param.Field[string] `path:"account_id,required"` - Image param.Field[[]float64] `json:"image"` -} - -func (r AIRunParamsObjectDetection) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyObjectDetection) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsObjectDetection) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsObjectDetection) ImplementsAIRunParams() { +func (r AIRunParamsBodyObjectDetection) implementsWorkersAIRunParamsBodyUnion() {} +type AIRunParamsBodyTextGeneration struct { + Lora param.Field[string] `json:"lora"` + MaxTokens param.Field[int64] `json:"max_tokens"` + Messages param.Field[[]AIRunParamsBodyTextGenerationMessage] `json:"messages"` + Prompt param.Field[string] `json:"prompt"` + Raw param.Field[bool] `json:"raw"` + Stream param.Field[bool] `json:"stream"` } -type AIRunParamsTextGeneration struct { - AccountID param.Field[string] `path:"account_id,required"` - Lora param.Field[string] `json:"lora"` - MaxTokens param.Field[int64] `json:"max_tokens"` - Messages param.Field[[]AIRunParamsTextGenerationMessage] `json:"messages"` - Prompt param.Field[string] `json:"prompt"` - Raw param.Field[bool] `json:"raw"` - Stream param.Field[bool] `json:"stream"` -} - -func (r AIRunParamsTextGeneration) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyTextGeneration) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsTextGeneration) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsTextGeneration) ImplementsAIRunParams() { - -} +func (r AIRunParamsBodyTextGeneration) implementsWorkersAIRunParamsBodyUnion() {} -type AIRunParamsTextGenerationMessage struct { +type AIRunParamsBodyTextGenerationMessage struct { Content param.Field[string] `json:"content,required"` Role param.Field[string] `json:"role,required"` } -func (r AIRunParamsTextGenerationMessage) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyTextGenerationMessage) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type AIRunParamsTranslation struct { - AccountID param.Field[string] `path:"account_id,required"` +type AIRunParamsBodyTranslation struct { TargetLang param.Field[string] `json:"target_lang,required"` Text param.Field[string] `json:"text,required"` SourceLang param.Field[string] `json:"source_lang"` } -func (r AIRunParamsTranslation) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyTranslation) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsTranslation) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsTranslation) ImplementsAIRunParams() { - -} +func (r AIRunParamsBodyTranslation) implementsWorkersAIRunParamsBodyUnion() {} -type AIRunParamsSummarization struct { - AccountID param.Field[string] `path:"account_id,required"` +type AIRunParamsBodySummarization struct { InputText param.Field[string] `json:"input_text,required"` MaxLength param.Field[int64] `json:"max_length"` } -func (r AIRunParamsSummarization) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodySummarization) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsSummarization) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsSummarization) ImplementsAIRunParams() { +func (r AIRunParamsBodySummarization) implementsWorkersAIRunParamsBodyUnion() {} -} - -type AIRunParamsImageToText struct { - AccountID param.Field[string] `path:"account_id,required"` +type AIRunParamsBodyImageToText struct { Image param.Field[[]float64] `json:"image"` MaxTokens param.Field[int64] `json:"max_tokens"` Prompt param.Field[string] `json:"prompt"` } -func (r AIRunParamsImageToText) MarshalJSON() (data []byte, err error) { +func (r AIRunParamsBodyImageToText) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AIRunParamsImageToText) getAccountID() param.Field[string] { - return r.AccountID -} - -func (AIRunParamsImageToText) ImplementsAIRunParams() { - -} +func (r AIRunParamsBodyImageToText) implementsWorkersAIRunParamsBodyUnion() {} type AIRunResponseEnvelope struct { Result AIRunResponseUnion `json:"result" format:"binary"` diff --git a/workers/ai_test.go b/workers/ai_test.go index a2f9ffb448c..ece41338400 100644 --- a/workers/ai_test.go +++ b/workers/ai_test.go @@ -31,9 +31,11 @@ func TestAIRunWithOptionalParams(t *testing.T) { _, err := client.Workers.AI.Run( context.TODO(), "string", - workers.AIRunParamsTextClassification{ + workers.AIRunParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Text: cloudflare.F("x"), + Body: workers.AIRunParamsBodyTextClassification{ + Text: cloudflare.F("x"), + }, }, ) if err != nil { diff --git a/workers/aliases.go b/workers/aliases.go index bd4cce25034..d67b04cf858 100644 --- a/workers/aliases.go +++ b/workers/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/workers/domain.go b/workers/domain.go index 5414009e75f..dcbcfce9401 100644 --- a/workers/domain.go +++ b/workers/domain.go @@ -210,8 +210,8 @@ func (r DomainListParams) URLQuery() (v url.Values) { } type DomainDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DomainDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/workers/domain_test.go b/workers/domain_test.go index c279177736c..a2a6e5ba3c8 100644 --- a/workers/domain_test.go +++ b/workers/domain_test.go @@ -94,7 +94,7 @@ func TestDomainDelete(t *testing.T) { "dbe10b4bc17c295377eabd600e1787fd", workers.DomainDeleteParams{ AccountID: cloudflare.F("9a7806061c88ada191ed06f989cc3dac"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/workers/script.go b/workers/script.go index 33eb5434ec2..41f93167199 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 *Script, err error) { opts = append(r.Options[:], opts...) var env ScriptUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/scripts/%s", params.getAccountID(), scriptName) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s", params.AccountID, scriptName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -186,30 +186,17 @@ func (r ScriptSettingParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// This interface is a union satisfied by one of the following: -// [ScriptUpdateParamsVariant0], [ScriptUpdateParamsVariant1]. -type ScriptUpdateParams interface { - ImplementsScriptUpdateParams() - - getAccountID() param.Field[string] -} - -type ScriptUpdateParamsVariant0 struct { +type ScriptUpdateParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body ScriptUpdateParamsBodyUnion `json:"body,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"` - // 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"` - // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[ScriptUpdateParamsVariant0Metadata] `json:"metadata"` } -func (r ScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { +func (r ScriptUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) err = apiform.MarshalRoot(r, writer) @@ -224,25 +211,51 @@ func (r ScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType return buf.Bytes(), writer.FormDataContentType(), nil } -// URLQuery serializes [ScriptUpdateParamsVariant0]'s query parameters as -// `url.Values`. -func (r ScriptUpdateParamsVariant0) URLQuery() (v url.Values) { +// URLQuery serializes [ScriptUpdateParams]'s query parameters as `url.Values`. +func (r ScriptUpdateParams) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ ArrayFormat: apiquery.ArrayQueryFormatRepeat, NestedFormat: apiquery.NestedQueryFormatBrackets, }) } -func (r ScriptUpdateParamsVariant0) getAccountID() param.Field[string] { - return r.AccountID +type ScriptUpdateParamsBody struct { + AnyPartName param.Field[interface{}] `json:",required"` + Metadata param.Field[interface{}] `json:"metadata,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 (ScriptUpdateParamsVariant0) ImplementsScriptUpdateParams() { +func (r ScriptUpdateParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ScriptUpdateParamsBody) implementsWorkersScriptUpdateParamsBodyUnion() {} +// Satisfied by [workers.ScriptUpdateParamsBodyObject], +// [workers.ScriptUpdateParamsBodyObject], [ScriptUpdateParamsBody]. +type ScriptUpdateParamsBodyUnion interface { + implementsWorkersScriptUpdateParamsBodyUnion() } +type ScriptUpdateParamsBodyObject struct { + // 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"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[ScriptUpdateParamsBodyObjectMetadata] `json:"metadata"` +} + +func (r ScriptUpdateParamsBodyObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ScriptUpdateParamsBodyObject) implementsWorkersScriptUpdateParamsBodyUnion() {} + // JSON encoded metadata about the uploaded parts and Worker configuration. -type ScriptUpdateParamsVariant0Metadata struct { +type ScriptUpdateParamsBodyObjectMetadata 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 @@ -264,24 +277,24 @@ type ScriptUpdateParamsVariant0Metadata 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[ScriptUpdateParamsVariant0MetadataMigrationsUnion] `json:"migrations"` - Placement param.Field[PlacementConfigurationParam] `json:"placement"` + Migrations param.Field[ScriptUpdateParamsBodyObjectMetadataMigrationsUnion] `json:"migrations"` + Placement param.Field[PlacementConfigurationParam] `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[[]ConsumerScriptParam] `json:"tail_consumers"` // Usage model to apply to invocations. - UsageModel param.Field[ScriptUpdateParamsVariant0MetadataUsageModel] `json:"usage_model"` + UsageModel param.Field[ScriptUpdateParamsBodyObjectMetadataUsageModel] `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 ScriptUpdateParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsBodyObjectMetadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Migrations to apply for Durable Objects associated with this Worker. -type ScriptUpdateParamsVariant0MetadataMigrations struct { +type ScriptUpdateParamsBodyObjectMetadataMigrations 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 @@ -294,70 +307,38 @@ type ScriptUpdateParamsVariant0MetadataMigrations struct { Steps param.Field[interface{}] `json:"steps,required"` } -func (r ScriptUpdateParamsVariant0MetadataMigrations) MarshalJSON() (data []byte, err error) { +func (r ScriptUpdateParamsBodyObjectMetadataMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ScriptUpdateParamsVariant0MetadataMigrations) implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() { +func (r ScriptUpdateParamsBodyObjectMetadataMigrations) implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } // Migrations to apply for Durable Objects associated with this Worker. // // Satisfied by [workers.SingleStepMigrationParam], -// [workers.SteppedMigrationParam], [ScriptUpdateParamsVariant0MetadataMigrations]. -type ScriptUpdateParamsVariant0MetadataMigrationsUnion interface { - implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() +// [workers.SteppedMigrationParam], +// [ScriptUpdateParamsBodyObjectMetadataMigrations]. +type ScriptUpdateParamsBodyObjectMetadataMigrationsUnion interface { + implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() } // Usage model to apply to invocations. -type ScriptUpdateParamsVariant0MetadataUsageModel string +type ScriptUpdateParamsBodyObjectMetadataUsageModel string const ( - ScriptUpdateParamsVariant0MetadataUsageModelBundled ScriptUpdateParamsVariant0MetadataUsageModel = "bundled" - ScriptUpdateParamsVariant0MetadataUsageModelUnbound ScriptUpdateParamsVariant0MetadataUsageModel = "unbound" + ScriptUpdateParamsBodyObjectMetadataUsageModelBundled ScriptUpdateParamsBodyObjectMetadataUsageModel = "bundled" + ScriptUpdateParamsBodyObjectMetadataUsageModelUnbound ScriptUpdateParamsBodyObjectMetadataUsageModel = "unbound" ) -func (r ScriptUpdateParamsVariant0MetadataUsageModel) IsKnown() bool { +func (r ScriptUpdateParamsBodyObjectMetadataUsageModel) IsKnown() bool { switch r { - case ScriptUpdateParamsVariant0MetadataUsageModelBundled, ScriptUpdateParamsVariant0MetadataUsageModelUnbound: + case ScriptUpdateParamsBodyObjectMetadataUsageModelBundled, ScriptUpdateParamsBodyObjectMetadataUsageModelUnbound: 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.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -func (r ScriptUpdateParamsVariant1) getAccountID() param.Field[string] { - return r.AccountID -} - -func (ScriptUpdateParamsVariant1) ImplementsScriptUpdateParams() { - -} - type ScriptUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -408,8 +389,8 @@ type ScriptListParams struct { type ScriptDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` // If set to true, delete will not be stopped by associated service binding, // durable object, or other binding. Any of these associated bindings/durable // objects will be deleted along with the script. diff --git a/workers/script_test.go b/workers/script_test.go index 07cfa5f8bf7..95c8c9fd2d6 100644 --- a/workers/script_test.go +++ b/workers/script_test.go @@ -35,71 +35,73 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { _, err := client.Workers.Scripts.Update( context.TODO(), "this-is_my_script-01", - 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")))}), - Metadata: cloudflare.F(workers.ScriptUpdateParamsVariant0Metadata{ - Bindings: cloudflare.F([]interface{}{map[string]interface{}{ - "name": "MY_ENV_VAR", - "text": "my_data", - "type": "plain_text", - }}), - BodyPart: cloudflare.F("worker.js"), - CompatibilityDate: cloudflare.F("2023-07-25"), - CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), - KeepBindings: cloudflare.F([]string{"string", "string", "string"}), - Logpush: cloudflare.F(false), - MainModule: cloudflare.F("worker.js"), - Migrations: cloudflare.F[workers.ScriptUpdateParamsVariant0MetadataMigrationsUnion](workers.SingleStepMigrationParam{ - 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.SingleStepMigrationRenamedClassParam{{ - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), + workers.ScriptUpdateParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Body: workers.ScriptUpdateParamsBodyObject{ + 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")))}), + Metadata: cloudflare.F(workers.ScriptUpdateParamsBodyObjectMetadata{ + Bindings: cloudflare.F([]interface{}{map[string]interface{}{ + "name": "MY_ENV_VAR", + "text": "my_data", + "type": "plain_text", }}), - TransferredClasses: cloudflare.F([]workers.SingleStepMigrationTransferredClassParam{{ - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + BodyPart: cloudflare.F("worker.js"), + CompatibilityDate: cloudflare.F("2023-07-25"), + CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), + KeepBindings: cloudflare.F([]string{"string", "string", "string"}), + Logpush: cloudflare.F(false), + MainModule: cloudflare.F("worker.js"), + Migrations: cloudflare.F[workers.ScriptUpdateParamsBodyObjectMetadataMigrationsUnion](workers.SingleStepMigrationParam{ + 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.SingleStepMigrationRenamedClassParam{{ + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }}), + TransferredClasses: cloudflare.F([]workers.SingleStepMigrationTransferredClassParam{{ + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }}), + }), + Placement: cloudflare.F(workers.PlacementConfigurationParam{ + Mode: cloudflare.F(workers.PlacementConfigurationModeSmart), + }), + Tags: cloudflare.F([]string{"string", "string", "string"}), + TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }}), + UsageModel: cloudflare.F(workers.ScriptUpdateParamsBodyObjectMetadataUsageModelBundled), + VersionTags: cloudflare.F[any](map[string]interface{}{}), }), - Placement: cloudflare.F(workers.PlacementConfigurationParam{ - Mode: cloudflare.F(workers.PlacementConfigurationModeSmart), - }), - Tags: cloudflare.F([]string{"string", "string", "string"}), - TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }}), - UsageModel: cloudflare.F(workers.ScriptUpdateParamsVariant0MetadataUsageModelBundled), - VersionTags: cloudflare.F[any](map[string]interface{}{}), - }), + }, + RollbackTo: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"), }, ) if err != nil { @@ -156,7 +158,7 @@ func TestScriptDeleteWithOptionalParams(t *testing.T) { "this-is_my_script-01", workers.ScriptDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, Force: cloudflare.F(true), }, ) diff --git a/workers/scriptcontent.go b/workers/scriptcontent.go index ec6d5693d19..b0a4146c50a 100644 --- a/workers/scriptcontent.go +++ b/workers/scriptcontent.go @@ -68,9 +68,9 @@ type ScriptContentUpdateParams struct { // (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param] `json:"metadata"` - CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` - CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` + Metadata param.Field[WorkerMetadataParam] `json:"metadata"` + CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` + CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` } func (r ScriptContentUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { diff --git a/workers/scriptcontent_test.go b/workers/scriptcontent_test.go index a223f19c24c..ec7fd6f6802 100644 --- a/workers/scriptcontent_test.go +++ b/workers/scriptcontent_test.go @@ -13,7 +13,6 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/workers" @@ -39,7 +38,7 @@ func TestScriptContentUpdateWithOptionalParams(t *testing.T) { workers.ScriptContentUpdateParams{ 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")))}), - Metadata: cloudflare.F(shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param{ + Metadata: cloudflare.F(workers.WorkerMetadataParam{ BodyPart: cloudflare.F("worker.js"), MainModule: cloudflare.F("worker.js"), }), diff --git a/workers/scriptschedule.go b/workers/scriptschedule.go index 20f93c8f646..cae43009da9 100644 --- a/workers/scriptschedule.go +++ b/workers/scriptschedule.go @@ -128,7 +128,7 @@ func (r scriptScheduleGetResponseJSON) RawJSON() string { type ScriptScheduleUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[string] `json:"body,required"` + Body string `json:"body,required"` } func (r ScriptScheduleUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/workers/scriptschedule_test.go b/workers/scriptschedule_test.go index 27590d0e6bd..a14d50ae951 100644 --- a/workers/scriptschedule_test.go +++ b/workers/scriptschedule_test.go @@ -33,7 +33,7 @@ func TestScriptScheduleUpdate(t *testing.T) { "this-is_my_script-01", workers.ScriptScheduleUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F("[{'cron': '*/30 * * * *'}]"), + Body: "[{'cron': '*/30 * * * *'}]", }, ) if err != nil { diff --git a/workers/scriptsetting.go b/workers/scriptsetting.go index a91ebb86ba4..ed8c14427bd 100644 --- a/workers/scriptsetting.go +++ b/workers/scriptsetting.go @@ -64,15 +64,12 @@ func (r *ScriptSettingService) Get(ctx context.Context, scriptName string, query type ScriptSettingEditParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // Whether Logpush is turned on for the Worker. - Logpush param.Field[bool] `json:"logpush"` - // List of Workers that will consume logs from the attached Worker. - TailConsumers param.Field[[]ConsumerScriptParam] `json:"tail_consumers"` + AccountID param.Field[string] `path:"account_id,required"` + ScriptSetting ScriptSettingParam `json:"script_setting,required"` } func (r ScriptSettingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.ScriptSetting) } type ScriptSettingEditResponseEnvelope struct { diff --git a/workers/scriptsetting_test.go b/workers/scriptsetting_test.go index 028e598f069..939837760f9 100644 --- a/workers/scriptsetting_test.go +++ b/workers/scriptsetting_test.go @@ -33,20 +33,22 @@ func TestScriptSettingEditWithOptionalParams(t *testing.T) { "this-is_my_script-01", workers.ScriptSettingEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Logpush: cloudflare.F(false), - TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }}), + ScriptSetting: workers.ScriptSettingParam{ + Logpush: cloudflare.F(false), + TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), + }, { + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), + }, { + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), + }}), + }, }, ) if err != nil { diff --git a/workers/scripttail.go b/workers/scripttail.go index 3b0ad3054b6..2824704d2f1 100644 --- a/workers/scripttail.go +++ b/workers/scripttail.go @@ -191,8 +191,8 @@ func (r scriptTailGetResponseJSON) RawJSON() string { type ScriptTailNewParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ScriptTailNewParams) MarshalJSON() (data []byte, err error) { @@ -244,8 +244,8 @@ func (r ScriptTailNewResponseEnvelopeSuccess) IsKnown() bool { type ScriptTailDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r ScriptTailDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/workers/scripttail_test.go b/workers/scripttail_test.go index 2eb633af8b6..42b6671626b 100644 --- a/workers/scripttail_test.go +++ b/workers/scripttail_test.go @@ -33,7 +33,7 @@ func TestScriptTailNew(t *testing.T) { "this-is_my_script-01", workers.ScriptTailNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -65,7 +65,7 @@ func TestScriptTailDelete(t *testing.T) { "03dc9f77817b488fb26c5861ec18f791", workers.ScriptTailDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/workers/subdomain.go b/workers/subdomain.go index 2edafd81a4e..947137a3ea2 100644 --- a/workers/subdomain.go +++ b/workers/subdomain.go @@ -102,7 +102,7 @@ func (r subdomainGetResponseJSON) RawJSON() string { type SubdomainUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[string] `json:"body,required"` + Body string `json:"body,required"` } func (r SubdomainUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/workers/subdomain_test.go b/workers/subdomain_test.go index f11d0f91c79..f659c744ed5 100644 --- a/workers/subdomain_test.go +++ b/workers/subdomain_test.go @@ -30,7 +30,7 @@ func TestSubdomainUpdate(t *testing.T) { ) _, err := client.Workers.Subdomains.Update(context.TODO(), workers.SubdomainUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F("{'subdomain': 'example-subdomain'}"), + Body: "{'subdomain': 'example-subdomain'}", }) if err != nil { var apierr *cloudflare.Error diff --git a/workers/worker.go b/workers/worker.go index e6e24950cc8..101892cea19 100644 --- a/workers/worker.go +++ b/workers/worker.go @@ -694,10 +694,10 @@ func (r SingleStepMigrationParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r SingleStepMigrationParam) implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() { +func (r SingleStepMigrationParam) implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } -func (r SingleStepMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() { +func (r SingleStepMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } type SingleStepMigrationRenamedClassParam struct { @@ -733,7 +733,23 @@ func (r SteppedMigrationParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r SteppedMigrationParam) implementsWorkersScriptUpdateParamsVariant0MetadataMigrationsUnion() {} +func (r SteppedMigrationParam) implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { +} + +func (r SteppedMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { +} -func (r SteppedMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() { +// JSON encoded metadata about the uploaded parts and Worker configuration. +type WorkerMetadataParam struct { + // Name of the part in the multipart request that contains the script (e.g. the + // file adding a listener to the `fetch` event). Indicates a + // `service worker syntax` Worker. + BodyPart param.Field[string] `json:"body_part"` + // Name of the part in the multipart request that contains the main module (e.g. + // the file exporting a `fetch` handler). Indicates a `module syntax` Worker. + MainModule param.Field[string] `json:"main_module"` +} + +func (r WorkerMetadataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } diff --git a/workers_for_platforms/aliases.go b/workers_for_platforms/aliases.go index 5fbf083e5bc..2bebdbf23d2 100644 --- a/workers_for_platforms/aliases.go +++ b/workers_for_platforms/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/workers_for_platforms/dispatchnamespacescript.go b/workers_for_platforms/dispatchnamespacescript.go index cb2f676cd48..fe2707228ff 100644 --- a/workers_for_platforms/dispatchnamespacescript.go +++ b/workers_for_platforms/dispatchnamespacescript.go @@ -50,7 +50,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.Script, err error) { opts = append(r.Options[:], opts...) var env DispatchNamespaceScriptUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", params.getAccountID(), dispatchNamespace, scriptName) + path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", params.AccountID, dispatchNamespace, scriptName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -112,27 +112,13 @@ func (r scriptJSON) RawJSON() string { return r.raw } -// This interface is a union satisfied by one of the following: -// [DispatchNamespaceScriptUpdateParamsVariant0], -// [DispatchNamespaceScriptUpdateParamsVariant1]. -type DispatchNamespaceScriptUpdateParams interface { - ImplementsDispatchNamespaceScriptUpdateParams() - - getAccountID() param.Field[string] -} - -type DispatchNamespaceScriptUpdateParamsVariant0 struct { +type DispatchNamespaceScriptUpdateParams 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"` - // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[DispatchNamespaceScriptUpdateParamsVariant0Metadata] `json:"metadata"` + AccountID param.Field[string] `path:"account_id,required"` + Body DispatchNamespaceScriptUpdateParamsBodyUnion `json:"body,required"` } -func (r DispatchNamespaceScriptUpdateParamsVariant0) MarshalMultipart() (data []byte, contentType string, err error) { +func (r DispatchNamespaceScriptUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) err = apiform.MarshalRoot(r, writer) @@ -147,16 +133,47 @@ func (r DispatchNamespaceScriptUpdateParamsVariant0) MarshalMultipart() (data [] return buf.Bytes(), writer.FormDataContentType(), nil } -func (r DispatchNamespaceScriptUpdateParamsVariant0) getAccountID() param.Field[string] { - return r.AccountID +type DispatchNamespaceScriptUpdateParamsBody struct { + AnyPartName param.Field[interface{}] `json:",required"` + Metadata param.Field[interface{}] `json:"metadata,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 DispatchNamespaceScriptUpdateParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (DispatchNamespaceScriptUpdateParamsVariant0) ImplementsDispatchNamespaceScriptUpdateParams() { +func (r DispatchNamespaceScriptUpdateParamsBody) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyUnion() { +} +// Satisfied by +// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObject], +// [workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObject], +// [DispatchNamespaceScriptUpdateParamsBody]. +type DispatchNamespaceScriptUpdateParamsBodyUnion interface { + implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyUnion() +} + +type DispatchNamespaceScriptUpdateParamsBodyObject struct { + // 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"` + // JSON encoded metadata about the uploaded parts and Worker configuration. + Metadata param.Field[DispatchNamespaceScriptUpdateParamsBodyObjectMetadata] `json:"metadata"` +} + +func (r DispatchNamespaceScriptUpdateParamsBodyObject) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r DispatchNamespaceScriptUpdateParamsBodyObject) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyUnion() { } // JSON encoded metadata about the uploaded parts and Worker configuration. -type DispatchNamespaceScriptUpdateParamsVariant0Metadata struct { +type DispatchNamespaceScriptUpdateParamsBodyObjectMetadata 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 @@ -178,24 +195,24 @@ type DispatchNamespaceScriptUpdateParamsVariant0Metadata 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[DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion] `json:"migrations"` - Placement param.Field[workers.PlacementConfigurationParam] `json:"placement"` + Migrations param.Field[DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion] `json:"migrations"` + Placement param.Field[workers.PlacementConfigurationParam] `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[[]workers.ConsumerScriptParam] `json:"tail_consumers"` // Usage model to apply to invocations. - UsageModel param.Field[DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel] `json:"usage_model"` + UsageModel param.Field[DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModel] `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 DispatchNamespaceScriptUpdateParamsVariant0Metadata) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Migrations to apply for Durable Objects associated with this Worker. -type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations struct { +type DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations 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 @@ -208,58 +225,38 @@ type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations struct { Steps param.Field[interface{}] `json:"steps,required"` } -func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations) MarshalJSON() (data []byte, err error) { +func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() { +func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } // Migrations to apply for Durable Objects associated with this Worker. // // Satisfied by [workers.SingleStepMigrationParam], // [workers.SteppedMigrationParam], -// [DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrations]. -type DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion interface { - implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion() +// [DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations]. +type DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion interface { + implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() } // Usage model to apply to invocations. -type DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel string +type DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModel string const ( - DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel = "bundled" - DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelUnbound DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel = "unbound" + DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModelBundled DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModel = "bundled" + DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModelUnbound DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModel = "unbound" ) -func (r DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModel) IsKnown() bool { +func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModel) IsKnown() bool { switch r { - case DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled, DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelUnbound: + case DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModelBundled, DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModelUnbound: 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 []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -305,8 +302,8 @@ func (r DispatchNamespaceScriptUpdateResponseEnvelopeSuccess) IsKnown() bool { type DispatchNamespaceScriptDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` // If set to true, delete will not be stopped by associated service binding, // durable object, or other binding. Any of these associated bindings/durable // objects will be deleted along with the script. diff --git a/workers_for_platforms/dispatchnamespacescript_test.go b/workers_for_platforms/dispatchnamespacescript_test.go index 56722a4c586..5d77cc1d499 100644 --- a/workers_for_platforms/dispatchnamespacescript_test.go +++ b/workers_for_platforms/dispatchnamespacescript_test.go @@ -35,70 +35,72 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", - 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")))}), - Metadata: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0Metadata{ - Bindings: cloudflare.F([]interface{}{map[string]interface{}{ - "name": "MY_ENV_VAR", - "text": "my_data", - "type": "plain_text", - }}), - BodyPart: cloudflare.F("worker.js"), - CompatibilityDate: cloudflare.F("2023-07-25"), - CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), - KeepBindings: cloudflare.F([]string{"string", "string", "string"}), - Logpush: cloudflare.F(false), - MainModule: cloudflare.F("worker.js"), - Migrations: cloudflare.F[workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataMigrationsUnion](workers.SingleStepMigrationParam{ - 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.SingleStepMigrationRenamedClassParam{{ - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), - }, { - From: cloudflare.F("string"), - To: cloudflare.F("string"), + workers_for_platforms.DispatchNamespaceScriptUpdateParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Body: workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObject{ + 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")))}), + Metadata: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObjectMetadata{ + Bindings: cloudflare.F([]interface{}{map[string]interface{}{ + "name": "MY_ENV_VAR", + "text": "my_data", + "type": "plain_text", }}), - TransferredClasses: cloudflare.F([]workers.SingleStepMigrationTransferredClassParam{{ - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + BodyPart: cloudflare.F("worker.js"), + CompatibilityDate: cloudflare.F("2023-07-25"), + CompatibilityFlags: cloudflare.F([]string{"string", "string", "string"}), + KeepBindings: cloudflare.F([]string{"string", "string", "string"}), + Logpush: cloudflare.F(false), + MainModule: cloudflare.F("worker.js"), + Migrations: cloudflare.F[workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion](workers.SingleStepMigrationParam{ + 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.SingleStepMigrationRenamedClassParam{{ + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + To: cloudflare.F("string"), + }}), + TransferredClasses: cloudflare.F([]workers.SingleStepMigrationTransferredClassParam{{ + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }, { + From: cloudflare.F("string"), + FromScript: cloudflare.F("string"), + To: cloudflare.F("string"), + }}), + }), + Placement: cloudflare.F(workers.PlacementConfigurationParam{ + Mode: cloudflare.F(workers.PlacementConfigurationModeSmart), + }), + Tags: cloudflare.F([]string{"string", "string", "string"}), + TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }, { - From: cloudflare.F("string"), - FromScript: cloudflare.F("string"), - To: cloudflare.F("string"), + Environment: cloudflare.F("production"), + Namespace: cloudflare.F("my-namespace"), + Service: cloudflare.F("my-log-consumer"), }}), + UsageModel: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsBodyObjectMetadataUsageModelBundled), + VersionTags: cloudflare.F[any](map[string]interface{}{}), }), - Placement: cloudflare.F(workers.PlacementConfigurationParam{ - Mode: cloudflare.F(workers.PlacementConfigurationModeSmart), - }), - Tags: cloudflare.F([]string{"string", "string", "string"}), - TailConsumers: cloudflare.F([]workers.ConsumerScriptParam{{ - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }, { - Environment: cloudflare.F("production"), - Namespace: cloudflare.F("my-namespace"), - Service: cloudflare.F("my-log-consumer"), - }}), - UsageModel: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsVariant0MetadataUsageModelBundled), - VersionTags: cloudflare.F[any](map[string]interface{}{}), - }), + }, }, ) if err != nil { @@ -130,7 +132,7 @@ func TestDispatchNamespaceScriptDeleteWithOptionalParams(t *testing.T) { "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, Force: cloudflare.F(true), }, ) diff --git a/workers_for_platforms/dispatchnamespacescriptcontent.go b/workers_for_platforms/dispatchnamespacescriptcontent.go index fe95b449e13..634cdf4db52 100644 --- a/workers_for_platforms/dispatchnamespacescriptcontent.go +++ b/workers_for_platforms/dispatchnamespacescriptcontent.go @@ -70,9 +70,9 @@ type DispatchNamespaceScriptContentUpdateParams struct { // (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. AnyPartName param.Field[[]io.Reader] `json:"" format:"binary"` // JSON encoded metadata about the uploaded parts and Worker configuration. - Metadata param.Field[shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param] `json:"metadata"` - CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` - CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` + Metadata param.Field[workers.WorkerMetadataParam] `json:"metadata"` + CfWorkerBodyPart param.Field[string] `header:"CF-WORKER-BODY-PART"` + CfWorkerMainModulePart param.Field[string] `header:"CF-WORKER-MAIN-MODULE-PART"` } func (r DispatchNamespaceScriptContentUpdateParams) MarshalMultipart() (data []byte, contentType string, err error) { diff --git a/workers_for_platforms/dispatchnamespacescriptcontent_test.go b/workers_for_platforms/dispatchnamespacescriptcontent_test.go index eb80c98227d..3393d0a1e6e 100644 --- a/workers_for_platforms/dispatchnamespacescriptcontent_test.go +++ b/workers_for_platforms/dispatchnamespacescriptcontent_test.go @@ -13,9 +13,9 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/workers" "github.com/cloudflare/cloudflare-go/v2/workers_for_platforms" ) @@ -40,7 +40,7 @@ func TestDispatchNamespaceScriptContentUpdateWithOptionalParams(t *testing.T) { workers_for_platforms.DispatchNamespaceScriptContentUpdateParams{ 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")))}), - Metadata: cloudflare.F(shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param{ + Metadata: cloudflare.F(workers.WorkerMetadataParam{ BodyPart: cloudflare.F("worker.js"), MainModule: cloudflare.F("worker.js"), }), diff --git a/zero_trust/accessapplication.go b/zero_trust/accessapplication.go index b80ac92ab68..be44d04260b 100644 --- a/zero_trust/accessapplication.go +++ b/zero_trust/accessapplication.go @@ -48,12 +48,12 @@ func (r *AccessApplicationService) New(ctx context.Context, params AccessApplica var env AccessApplicationNewResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/access/apps", accountOrZone, accountOrZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -70,12 +70,12 @@ func (r *AccessApplicationService) Update(ctx context.Context, appID AppIDUnionP var env AccessApplicationUpdateResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/access/apps/%v", accountOrZone, accountOrZoneID, appID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) @@ -1317,1092 +1317,87 @@ func (r applicationBookmarkApplicationJSON) RawJSON() string { func (r ApplicationBookmarkApplication) implementsZeroTrustApplication() {} -type CorsHeaders struct { - // Allows all HTTP request headers. - AllowAllHeaders bool `json:"allow_all_headers"` - // Allows all HTTP request methods. - AllowAllMethods bool `json:"allow_all_methods"` - // Allows all origins. - AllowAllOrigins bool `json:"allow_all_origins"` - // When set to `true`, includes credentials (cookies, authorization headers, or TLS - // client certificates) with requests. - AllowCredentials bool `json:"allow_credentials"` - // Allowed HTTP request headers. - AllowedHeaders []AllowedHeadersh `json:"allowed_headers"` - // Allowed HTTP request methods. - AllowedMethods []AllowedMethodsh `json:"allowed_methods"` - // Allowed origins. - AllowedOrigins []AllowedOriginsh `json:"allowed_origins"` - // The maximum number of seconds the results of a preflight request can be cached. - MaxAge float64 `json:"max_age"` - JSON corsHeadersJSON `json:"-"` -} - -// corsHeadersJSON contains the JSON metadata for the struct [CorsHeaders] -type corsHeadersJSON struct { - AllowAllHeaders apijson.Field - AllowAllMethods apijson.Field - AllowAllOrigins apijson.Field - AllowCredentials apijson.Field - AllowedHeaders apijson.Field - AllowedMethods apijson.Field - AllowedOrigins apijson.Field - MaxAge apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *CorsHeaders) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r corsHeadersJSON) RawJSON() string { - return r.raw -} - -type CorsHeadersParam 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[[]AllowedHeadershParam] `json:"allowed_headers"` - // Allowed HTTP request methods. - AllowedMethods param.Field[[]AllowedMethodsh] `json:"allowed_methods"` - // Allowed origins. - AllowedOrigins param.Field[[]AllowedOriginshParam] `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 CorsHeadersParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type CustomPagesh = string - -type CustomPageshParam = string - -type SAMLSaasApp struct { - // Optional identifier indicating the authentication protocol used for the saas - // app. Required for OIDC. Default if unset is "saml" - AuthType SAMLSaasAppAuthType `json:"auth_type"` - // The service provider's endpoint that is responsible for receiving and parsing a - // SAML assertion. - ConsumerServiceURL string `json:"consumer_service_url"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - CustomAttributes SAMLSaasAppCustomAttributes `json:"custom_attributes"` - // The URL that the user will be redirected to after a successful login for IDP - // initiated logins. - DefaultRelayState string `json:"default_relay_state"` - // The unique identifier for your SaaS application. - IDPEntityID string `json:"idp_entity_id"` - // The format of the name identifier sent to the SaaS application. - NameIDFormat SAMLSaasAppNameIDFormat `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 string `json:"name_id_transform_jsonata"` - // The Access public certificate that will be used to verify your identity. - PublicKey string `json:"public_key"` - // A [JSONata] (https://jsonata.org/) expression that transforms an application's - // user identities into attribute assertions in the SAML response. The expression - // can transform id, email, name, and groups values. It can also transform fields - // listed in the saml_attributes or oidc_fields of the identity provider used to - // authenticate. The output of this expression must be a JSON object. - SAMLAttributeTransformJsonata string `json:"saml_attribute_transform_jsonata"` - // A globally unique name for an identity or service provider. - SpEntityID string `json:"sp_entity_id"` - // The endpoint where your SaaS application will send login requests. - SSOEndpoint string `json:"sso_endpoint"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - JSON samlSaasAppJSON `json:"-"` -} - -// samlSaasAppJSON contains the JSON metadata for the struct [SAMLSaasApp] -type samlSaasAppJSON struct { - AuthType apijson.Field - ConsumerServiceURL apijson.Field - CreatedAt apijson.Field - CustomAttributes apijson.Field - DefaultRelayState apijson.Field - IDPEntityID apijson.Field - NameIDFormat apijson.Field - NameIDTransformJsonata apijson.Field - PublicKey apijson.Field - SAMLAttributeTransformJsonata apijson.Field - SpEntityID apijson.Field - SSOEndpoint apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SAMLSaasApp) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r samlSaasAppJSON) RawJSON() string { - return r.raw -} - -func (r SAMLSaasApp) implementsZeroTrustApplicationSaaSApplicationSaasApp() {} - -// Optional identifier indicating the authentication protocol used for the saas -// app. Required for OIDC. Default if unset is "saml" -type SAMLSaasAppAuthType string - -const ( - SAMLSaasAppAuthTypeSAML SAMLSaasAppAuthType = "saml" - SAMLSaasAppAuthTypeOIDC SAMLSaasAppAuthType = "oidc" -) - -func (r SAMLSaasAppAuthType) IsKnown() bool { - switch r { - case SAMLSaasAppAuthTypeSAML, SAMLSaasAppAuthTypeOIDC: - return true - } - return false -} - -type SAMLSaasAppCustomAttributes struct { - // The name of the attribute. - Name string `json:"name"` - // A globally unique name for an identity or service provider. - NameFormat SAMLSaasAppCustomAttributesNameFormat `json:"name_format"` - Source SAMLSaasAppCustomAttributesSource `json:"source"` - JSON samlSaasAppCustomAttributesJSON `json:"-"` -} - -// samlSaasAppCustomAttributesJSON contains the JSON metadata for the struct -// [SAMLSaasAppCustomAttributes] -type samlSaasAppCustomAttributesJSON struct { - Name apijson.Field - NameFormat apijson.Field - Source apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SAMLSaasAppCustomAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r samlSaasAppCustomAttributesJSON) RawJSON() string { - return r.raw -} - -// A globally unique name for an identity or service provider. -type SAMLSaasAppCustomAttributesNameFormat string - -const ( - SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatUnspecified SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" - SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatBasic SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" - SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatURI SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" -) - -func (r SAMLSaasAppCustomAttributesNameFormat) IsKnown() bool { - switch r { - case SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatUnspecified, SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatBasic, SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatURI: - return true - } - return false -} - -type SAMLSaasAppCustomAttributesSource struct { - // The name of the IdP attribute. - Name string `json:"name"` - JSON samlSaasAppCustomAttributesSourceJSON `json:"-"` -} - -// samlSaasAppCustomAttributesSourceJSON contains the JSON metadata for the struct -// [SAMLSaasAppCustomAttributesSource] -type samlSaasAppCustomAttributesSourceJSON struct { - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SAMLSaasAppCustomAttributesSource) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r samlSaasAppCustomAttributesSourceJSON) RawJSON() string { - return r.raw -} - -// The format of the name identifier sent to the SaaS application. -type SAMLSaasAppNameIDFormat string - -const ( - SAMLSaasAppNameIDFormatID SAMLSaasAppNameIDFormat = "id" - SAMLSaasAppNameIDFormatEmail SAMLSaasAppNameIDFormat = "email" -) - -func (r SAMLSaasAppNameIDFormat) IsKnown() bool { - switch r { - case SAMLSaasAppNameIDFormatID, SAMLSaasAppNameIDFormatEmail: - return true - } - return false -} - -type SAMLSaasAppParam struct { - // Optional identifier indicating the authentication protocol used for the saas - // app. Required for OIDC. Default if unset is "saml" - AuthType param.Field[SAMLSaasAppAuthType] `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[SAMLSaasAppCustomAttributesParam] `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[SAMLSaasAppNameIDFormat] `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 [JSONata] (https://jsonata.org/) expression that transforms an application's - // user identities into attribute assertions in the SAML response. The expression - // can transform id, email, name, and groups values. It can also transform fields - // listed in the saml_attributes or oidc_fields of the identity provider used to - // authenticate. The output of this expression must be a JSON object. - SAMLAttributeTransformJsonata param.Field[string] `json:"saml_attribute_transform_jsonata"` - // 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 SAMLSaasAppParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SAMLSaasAppParam) implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasAppUnion() { -} - -func (r SAMLSaasAppParam) implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasAppUnion() { -} - -type SAMLSaasAppCustomAttributesParam 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[SAMLSaasAppCustomAttributesNameFormat] `json:"name_format"` - Source param.Field[SAMLSaasAppCustomAttributesSourceParam] `json:"source"` -} - -func (r SAMLSaasAppCustomAttributesParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SAMLSaasAppCustomAttributesSourceParam struct { - // The name of the IdP attribute. - Name param.Field[string] `json:"name"` -} - -func (r SAMLSaasAppCustomAttributesSourceParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SelfHostedDomainsh = string - -type SelfHostedDomainshParam = string - -type AccessApplicationDeleteResponse struct { - // UUID - ID string `json:"id"` - JSON accessApplicationDeleteResponseJSON `json:"-"` -} - -// accessApplicationDeleteResponseJSON contains the JSON metadata for the struct -// [AccessApplicationDeleteResponse] -type accessApplicationDeleteResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AccessApplicationDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r accessApplicationDeleteResponseJSON) RawJSON() string { - return r.raw -} - -type AccessApplicationRevokeTokensResponse = interface{} - -// 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. - 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[[]AllowedIdpshParam] `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[CorsHeadersParam] `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[[]CustomPageshParam] `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[[]SelfHostedDomainshParam] `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 AccessApplicationNewParamsSelfHostedApplication) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationNewParamsSelfHostedApplication) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r AccessApplicationNewParamsSelfHostedApplication) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (AccessApplicationNewParamsSelfHostedApplication) ImplementsAccessApplicationNewParams() { - -} - -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[[]AllowedIdpshParam] `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[[]CustomPageshParam] `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[AccessApplicationNewParamsSaaSApplicationSaasAppUnion] `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() { - -} - -type AccessApplicationNewParamsSaaSApplicationSaasApp struct { - // Optional identifier indicating the authentication protocol used for the saas - // app. Required for OIDC. Default if unset is "saml" - AuthType param.Field[AccessApplicationNewParamsSaaSApplicationSaasAppAuthType] `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[interface{}] `json:"custom_attributes,required"` - // 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[AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormat] `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 [JSONata] (https://jsonata.org/) expression that transforms an application's - // user identities into attribute assertions in the SAML response. The expression - // can transform id, email, name, and groups values. It can also transform fields - // listed in the saml_attributes or oidc_fields of the identity provider used to - // authenticate. The output of this expression must be a JSON object. - SAMLAttributeTransformJsonata param.Field[string] `json:"saml_attribute_transform_jsonata"` - // 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"` - // The URL where this applications tile redirects users - AppLauncherURL param.Field[string] `json:"app_launcher_url"` - // 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"` - GrantTypes param.Field[interface{}] `json:"grant_types,required"` - // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint - GroupFilterRegex param.Field[string] `json:"group_filter_regex"` - RedirectURIs param.Field[interface{}] `json:"redirect_uris,required"` - Scopes param.Field[interface{}] `json:"scopes,required"` -} - -func (r AccessApplicationNewParamsSaaSApplicationSaasApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationNewParamsSaaSApplicationSaasApp) implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasAppUnion() { -} - -// Satisfied by [zero_trust.SAMLSaasAppParam], -// [zero_trust.AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasApp], -// [AccessApplicationNewParamsSaaSApplicationSaasApp]. -type AccessApplicationNewParamsSaaSApplicationSaasAppUnion interface { - implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasAppUnion() -} - -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[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[[]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. - 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[[]AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope] `json:"scopes"` -} - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasApp) implementsZeroTrustAccessApplicationNewParamsSaaSApplicationSaasAppUnion() { -} - -// Identifier of the authentication protocol used for the saas app. Required for -// OIDC. -type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthType string - -const ( - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthTypeSAML AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthType = "saml" - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthTypeOIDC AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthType = "oidc" -) - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthType) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthTypeSAML, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppAuthTypeOIDC: - return true - } - return false -} - -type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantType string - -const ( - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantTypeAuthorizationCode AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantType = "authorization_code" - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantTypeAuthorizationCodeWithPkce AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantType = "authorization_code_with_pkce" -) - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantType) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantTypeAuthorizationCode, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppGrantTypeAuthorizationCodeWithPkce: - return true - } - return false -} - -type AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope string - -const ( - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeOpenid AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope = "openid" - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeGroups AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope = "groups" - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeEmail AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope = "email" - AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeProfile AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope = "profile" -) - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScope) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeOpenid, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeGroups, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeEmail, AccessApplicationNewParamsSaaSApplicationSaasAppAccessOIDCSaasAppScopeProfile: - return true - } - return false -} - -// Optional identifier indicating the authentication protocol used for the saas -// app. Required for OIDC. Default if unset is "saml" -type AccessApplicationNewParamsSaaSApplicationSaasAppAuthType string - -const ( - AccessApplicationNewParamsSaaSApplicationSaasAppAuthTypeSAML AccessApplicationNewParamsSaaSApplicationSaasAppAuthType = "saml" - AccessApplicationNewParamsSaaSApplicationSaasAppAuthTypeOIDC AccessApplicationNewParamsSaaSApplicationSaasAppAuthType = "oidc" -) - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppAuthType) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaaSApplicationSaasAppAuthTypeSAML, AccessApplicationNewParamsSaaSApplicationSaasAppAuthTypeOIDC: - return true - } - return false -} - -// The format of the name identifier sent to the SaaS application. -type AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormat string - -const ( - AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormatID AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormat = "id" - AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormatEmail AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormat = "email" -) - -func (r AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormat) IsKnown() bool { - switch r { - case AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormatID, AccessApplicationNewParamsSaaSApplicationSaasAppNameIDFormatEmail: - return true - } - return false -} - -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[[]AllowedIdpshParam] `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[CorsHeadersParam] `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[[]CustomPageshParam] `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[[]SelfHostedDomainshParam] `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 AccessApplicationNewParamsBrowserSSHApplication) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationNewParamsBrowserSSHApplication) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r AccessApplicationNewParamsBrowserSSHApplication) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (AccessApplicationNewParamsBrowserSSHApplication) ImplementsAccessApplicationNewParams() { - -} - -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. - 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[[]AllowedIdpshParam] `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[CorsHeadersParam] `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[[]CustomPageshParam] `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[[]SelfHostedDomainshParam] `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 AccessApplicationNewParamsBrowserVncApplication) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationNewParamsBrowserVncApplication) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r AccessApplicationNewParamsBrowserVncApplication) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (AccessApplicationNewParamsBrowserVncApplication) ImplementsAccessApplicationNewParams() { - -} - -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[[]AllowedIdpshParam] `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) -} - -func (r AccessApplicationNewParamsAppLauncherApplication) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r AccessApplicationNewParamsAppLauncherApplication) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (AccessApplicationNewParamsAppLauncherApplication) ImplementsAccessApplicationNewParams() { - -} - -// The application type. -type AccessApplicationNewParamsAppLauncherApplicationType string - -const ( - 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 AccessApplicationNewParamsAppLauncherApplicationType) IsKnown() bool { - switch r { - case AccessApplicationNewParamsAppLauncherApplicationTypeSelfHosted, AccessApplicationNewParamsAppLauncherApplicationTypeSaas, AccessApplicationNewParamsAppLauncherApplicationTypeSSH, AccessApplicationNewParamsAppLauncherApplicationTypeVnc, AccessApplicationNewParamsAppLauncherApplicationTypeAppLauncher, AccessApplicationNewParamsAppLauncherApplicationTypeWARP, AccessApplicationNewParamsAppLauncherApplicationTypeBiso, AccessApplicationNewParamsAppLauncherApplicationTypeBookmark, AccessApplicationNewParamsAppLauncherApplicationTypeDashSSO: - return true - } - return false -} - -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[[]AllowedIdpshParam] `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[[]AllowedIdpshParam] `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"` +type ApplicationParam struct { + // 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"` + AllowedIDPs param.Field[interface{}] `json:"allowed_idps,required"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` - // The URL or domain of the bookmark. + // 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[CorsHeadersParam] `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"` + CustomPages param.Field[interface{}] `json:"custom_pages,required"` + // 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"` + // 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"` - // 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"` + // 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"` + SelfHostedDomains param.Field[interface{}] `json:"self_hosted_domains,required"` + // 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"` + Tags param.Field[interface{}] `json:"tags,required"` // The application type. - Type param.Field[string] `json:"type"` + Type param.Field[string] `json:"type"` + SaasApp param.Field[interface{}] `json:"saas_app,required"` } -func (r AccessApplicationNewParamsBookmarkApplication) MarshalJSON() (data []byte, err error) { +func (r ApplicationParam) 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 []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result Application `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 -} - -// 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() +func (r ApplicationParam) implementsZeroTrustApplicationUnionParam() {} - getAccountID() param.Field[string] - - getZoneID() param.Field[string] +// Satisfied by [zero_trust.ApplicationSelfHostedApplicationParam], +// [zero_trust.ApplicationSaaSApplicationParam], +// [zero_trust.ApplicationBrowserSSHApplicationParam], +// [zero_trust.ApplicationBrowserVncApplicationParam], +// [zero_trust.ApplicationAppLauncherApplicationParam], +// [zero_trust.ApplicationDeviceEnrollmentPermissionsApplicationParam], +// [zero_trust.ApplicationBrowserIsolationPermissionsApplicationParam], +// [zero_trust.ApplicationBookmarkApplicationParam], [ApplicationParam]. +type ApplicationUnionParam interface { + implementsZeroTrustApplicationUnionParam() } -type AccessApplicationUpdateParamsSelfHostedApplication struct { +type ApplicationSelfHostedApplicationParam 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 @@ -2459,27 +1454,13 @@ type AccessApplicationUpdateParamsSelfHostedApplication struct { Tags param.Field[[]string] `json:"tags"` } -func (r AccessApplicationUpdateParamsSelfHostedApplication) MarshalJSON() (data []byte, err error) { +func (r ApplicationSelfHostedApplicationParam) 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() { - -} +func (r ApplicationSelfHostedApplicationParam) implementsZeroTrustApplicationUnionParam() {} -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"` +type ApplicationSaaSApplicationParam struct { // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. AllowedIDPs param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` @@ -2493,8 +1474,8 @@ type AccessApplicationUpdateParamsSaaSApplication struct { // 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[AccessApplicationUpdateParamsSaaSApplicationSaasAppUnion] `json:"saas_app"` + Name param.Field[string] `json:"name"` + SaasApp param.Field[ApplicationSaaSApplicationSaasAppUnionParam] `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"` @@ -2502,26 +1483,16 @@ type AccessApplicationUpdateParamsSaaSApplication struct { Type param.Field[string] `json:"type"` } -func (r AccessApplicationUpdateParamsSaaSApplication) MarshalJSON() (data []byte, err error) { +func (r ApplicationSaaSApplicationParam) 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() { - -} +func (r ApplicationSaaSApplicationParam) implementsZeroTrustApplicationUnionParam() {} -type AccessApplicationUpdateParamsSaaSApplicationSaasApp struct { +type ApplicationSaaSApplicationSaasAppParam struct { // Optional identifier indicating the authentication protocol used for the saas // app. Required for OIDC. Default if unset is "saml" - AuthType param.Field[AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthType] `json:"auth_type"` + AuthType param.Field[ApplicationSaaSApplicationSaasAppAuthType] `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"` @@ -2532,7 +1503,7 @@ type AccessApplicationUpdateParamsSaaSApplicationSaasApp struct { // 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[AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormat] `json:"name_id_format"` + NameIDFormat param.Field[ApplicationSaaSApplicationSaasAppNameIDFormat] `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 @@ -2556,149 +1527,63 @@ type AccessApplicationUpdateParamsSaaSApplicationSaasApp struct { ClientID param.Field[string] `json:"client_id"` // The application client secret, only returned on POST request. ClientSecret param.Field[string] `json:"client_secret"` - GrantTypes param.Field[interface{}] `json:"grant_types,required"` - // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint - GroupFilterRegex param.Field[string] `json:"group_filter_regex"` - RedirectURIs param.Field[interface{}] `json:"redirect_uris,required"` - Scopes param.Field[interface{}] `json:"scopes,required"` -} - -func (r AccessApplicationUpdateParamsSaaSApplicationSaasApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r AccessApplicationUpdateParamsSaaSApplicationSaasApp) implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasAppUnion() { -} - -// Satisfied by [zero_trust.SAMLSaasAppParam], -// [zero_trust.AccessApplicationUpdateParamsSaaSApplicationSaasAppAccessOIDCSaasApp], -// [AccessApplicationUpdateParamsSaaSApplicationSaasApp]. -type AccessApplicationUpdateParamsSaaSApplicationSaasAppUnion interface { - implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasAppUnion() -} - -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) implementsZeroTrustAccessApplicationUpdateParamsSaaSApplicationSaasAppUnion() { -} - -// 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 + GrantTypes param.Field[interface{}] `json:"grant_types,required"` + // A regex to filter Cloudflare groups returned in ID token and userinfo endpoint + GroupFilterRegex param.Field[string] `json:"group_filter_regex"` + RedirectURIs param.Field[interface{}] `json:"redirect_uris,required"` + Scopes param.Field[interface{}] `json:"scopes,required"` } -// Optional identifier indicating the authentication protocol used for the saas -// app. Required for OIDC. Default if unset is "saml" -type AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthType string +func (r ApplicationSaaSApplicationSaasAppParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -const ( - AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthTypeSAML AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthType = "saml" - AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthTypeOIDC AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthType = "oidc" -) +func (r ApplicationSaaSApplicationSaasAppParam) implementsZeroTrustApplicationSaaSApplicationSaasAppUnionParam() { +} -func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthType) IsKnown() bool { - switch r { - case AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthTypeSAML, AccessApplicationUpdateParamsSaaSApplicationSaasAppAuthTypeOIDC: - return true - } - return false +// Satisfied by [zero_trust.SAMLSaasAppParam], +// [zero_trust.ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppParam], +// [ApplicationSaaSApplicationSaasAppParam]. +type ApplicationSaaSApplicationSaasAppUnionParam interface { + implementsZeroTrustApplicationSaaSApplicationSaasAppUnionParam() } -// The format of the name identifier sent to the SaaS application. -type AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormat string +type ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppParam 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[ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppAuthType] `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[[]ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppGrantType] `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[[]ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppScope] `json:"scopes"` +} -const ( - AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormatID AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormat = "id" - AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormatEmail AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormat = "email" -) +func (r ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormat) IsKnown() bool { - switch r { - case AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormatID, AccessApplicationUpdateParamsSaaSApplicationSaasAppNameIDFormatEmail: - return true - } - return false +func (r ApplicationSaaSApplicationSaasAppAccessOIDCSaasAppParam) implementsZeroTrustApplicationSaaSApplicationSaasAppUnionParam() { } -type AccessApplicationUpdateParamsBrowserSSHApplication struct { +type ApplicationBrowserSSHApplicationParam 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 @@ -2755,32 +1640,18 @@ type AccessApplicationUpdateParamsBrowserSSHApplication struct { Tags param.Field[[]string] `json:"tags"` } -func (r AccessApplicationUpdateParamsBrowserSSHApplication) MarshalJSON() (data []byte, err error) { +func (r ApplicationBrowserSSHApplicationParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AccessApplicationUpdateParamsBrowserSSHApplication) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r AccessApplicationUpdateParamsBrowserSSHApplication) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (AccessApplicationUpdateParamsBrowserSSHApplication) ImplementsAccessApplicationUpdateParams() { +func (r ApplicationBrowserSSHApplicationParam) implementsZeroTrustApplicationUnionParam() {} -} - -type AccessApplicationUpdateParamsBrowserVncApplication struct { +type ApplicationBrowserVncApplicationParam 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 @@ -2837,230 +1708,489 @@ type AccessApplicationUpdateParamsBrowserVncApplication struct { Tags param.Field[[]string] `json:"tags"` } -func (r AccessApplicationUpdateParamsBrowserVncApplication) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r ApplicationBrowserVncApplicationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ApplicationBrowserVncApplicationParam) implementsZeroTrustApplicationUnionParam() {} + +type ApplicationAppLauncherApplicationParam struct { + // The application type. + Type param.Field[ApplicationAppLauncherApplicationType] `json:"type,required"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]AllowedIdpshParam] `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 ApplicationAppLauncherApplicationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ApplicationAppLauncherApplicationParam) implementsZeroTrustApplicationUnionParam() {} + +type ApplicationDeviceEnrollmentPermissionsApplicationParam struct { + // The application type. + Type param.Field[ApplicationDeviceEnrollmentPermissionsApplicationType] `json:"type,required"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]AllowedIdpshParam] `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 ApplicationDeviceEnrollmentPermissionsApplicationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ApplicationDeviceEnrollmentPermissionsApplicationParam) implementsZeroTrustApplicationUnionParam() { +} + +type ApplicationBrowserIsolationPermissionsApplicationParam struct { + // The application type. + Type param.Field[ApplicationBrowserIsolationPermissionsApplicationType] `json:"type,required"` + // The identity providers your users can select when connecting to this + // application. Defaults to all IdPs configured in your account. + AllowedIDPs param.Field[[]AllowedIdpshParam] `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 ApplicationBrowserIsolationPermissionsApplicationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ApplicationBrowserIsolationPermissionsApplicationParam) implementsZeroTrustApplicationUnionParam() { +} + +type ApplicationBookmarkApplicationParam struct { + // Displays the application in the App Launcher. + AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` + // The URL or domain of the bookmark. + Domain param.Field[string] `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 ApplicationBookmarkApplicationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ApplicationBookmarkApplicationParam) implementsZeroTrustApplicationUnionParam() {} + +type CorsHeaders struct { + // Allows all HTTP request headers. + AllowAllHeaders bool `json:"allow_all_headers"` + // Allows all HTTP request methods. + AllowAllMethods bool `json:"allow_all_methods"` + // Allows all origins. + AllowAllOrigins bool `json:"allow_all_origins"` + // When set to `true`, includes credentials (cookies, authorization headers, or TLS + // client certificates) with requests. + AllowCredentials bool `json:"allow_credentials"` + // Allowed HTTP request headers. + AllowedHeaders []AllowedHeadersh `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods []AllowedMethodsh `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins []AllowedOriginsh `json:"allowed_origins"` + // The maximum number of seconds the results of a preflight request can be cached. + MaxAge float64 `json:"max_age"` + JSON corsHeadersJSON `json:"-"` +} + +// corsHeadersJSON contains the JSON metadata for the struct [CorsHeaders] +type corsHeadersJSON struct { + AllowAllHeaders apijson.Field + AllowAllMethods apijson.Field + AllowAllOrigins apijson.Field + AllowCredentials apijson.Field + AllowedHeaders apijson.Field + AllowedMethods apijson.Field + AllowedOrigins apijson.Field + MaxAge apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CorsHeaders) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r corsHeadersJSON) RawJSON() string { + return r.raw +} + +type CorsHeadersParam 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[[]AllowedHeadershParam] `json:"allowed_headers"` + // Allowed HTTP request methods. + AllowedMethods param.Field[[]AllowedMethodsh] `json:"allowed_methods"` + // Allowed origins. + AllowedOrigins param.Field[[]AllowedOriginshParam] `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 CorsHeadersParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type CustomPagesh = string + +type CustomPageshParam = string + +type SAMLSaasApp struct { + // Optional identifier indicating the authentication protocol used for the saas + // app. Required for OIDC. Default if unset is "saml" + AuthType SAMLSaasAppAuthType `json:"auth_type"` + // The service provider's endpoint that is responsible for receiving and parsing a + // SAML assertion. + ConsumerServiceURL string `json:"consumer_service_url"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + CustomAttributes SAMLSaasAppCustomAttributes `json:"custom_attributes"` + // The URL that the user will be redirected to after a successful login for IDP + // initiated logins. + DefaultRelayState string `json:"default_relay_state"` + // The unique identifier for your SaaS application. + IDPEntityID string `json:"idp_entity_id"` + // The format of the name identifier sent to the SaaS application. + NameIDFormat SAMLSaasAppNameIDFormat `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 string `json:"name_id_transform_jsonata"` + // The Access public certificate that will be used to verify your identity. + PublicKey string `json:"public_key"` + // A [JSONata] (https://jsonata.org/) expression that transforms an application's + // user identities into attribute assertions in the SAML response. The expression + // can transform id, email, name, and groups values. It can also transform fields + // listed in the saml_attributes or oidc_fields of the identity provider used to + // authenticate. The output of this expression must be a JSON object. + SAMLAttributeTransformJsonata string `json:"saml_attribute_transform_jsonata"` + // A globally unique name for an identity or service provider. + SpEntityID string `json:"sp_entity_id"` + // The endpoint where your SaaS application will send login requests. + SSOEndpoint string `json:"sso_endpoint"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON samlSaasAppJSON `json:"-"` +} + +// samlSaasAppJSON contains the JSON metadata for the struct [SAMLSaasApp] +type samlSaasAppJSON struct { + AuthType apijson.Field + ConsumerServiceURL apijson.Field + CreatedAt apijson.Field + CustomAttributes apijson.Field + DefaultRelayState apijson.Field + IDPEntityID apijson.Field + NameIDFormat apijson.Field + NameIDTransformJsonata apijson.Field + PublicKey apijson.Field + SAMLAttributeTransformJsonata apijson.Field + SpEntityID apijson.Field + SSOEndpoint apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *SAMLSaasApp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r AccessApplicationUpdateParamsBrowserVncApplication) getAccountID() param.Field[string] { - return r.AccountID +func (r samlSaasAppJSON) RawJSON() string { + return r.raw } -func (r AccessApplicationUpdateParamsBrowserVncApplication) getZoneID() param.Field[string] { - return r.ZoneID +func (r SAMLSaasApp) implementsZeroTrustApplicationSaaSApplicationSaasApp() {} + +// Optional identifier indicating the authentication protocol used for the saas +// app. Required for OIDC. Default if unset is "saml" +type SAMLSaasAppAuthType string + +const ( + SAMLSaasAppAuthTypeSAML SAMLSaasAppAuthType = "saml" + SAMLSaasAppAuthTypeOIDC SAMLSaasAppAuthType = "oidc" +) + +func (r SAMLSaasAppAuthType) IsKnown() bool { + switch r { + case SAMLSaasAppAuthTypeSAML, SAMLSaasAppAuthTypeOIDC: + return true + } + return false } -func (AccessApplicationUpdateParamsBrowserVncApplication) ImplementsAccessApplicationUpdateParams() { +type SAMLSaasAppCustomAttributes struct { + // The name of the attribute. + Name string `json:"name"` + // A globally unique name for an identity or service provider. + NameFormat SAMLSaasAppCustomAttributesNameFormat `json:"name_format"` + Source SAMLSaasAppCustomAttributesSource `json:"source"` + JSON samlSaasAppCustomAttributesJSON `json:"-"` +} +// samlSaasAppCustomAttributesJSON contains the JSON metadata for the struct +// [SAMLSaasAppCustomAttributes] +type samlSaasAppCustomAttributesJSON struct { + Name apijson.Field + NameFormat apijson.Field + Source apijson.Field + raw string + ExtraFields map[string]apijson.Field } -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[[]AllowedIdpshParam] `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 *SAMLSaasAppCustomAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r AccessApplicationUpdateParamsAppLauncherApplication) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r samlSaasAppCustomAttributesJSON) RawJSON() string { + return r.raw +} + +// A globally unique name for an identity or service provider. +type SAMLSaasAppCustomAttributesNameFormat string + +const ( + SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatUnspecified SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" + SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatBasic SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" + SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatURI SAMLSaasAppCustomAttributesNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" +) + +func (r SAMLSaasAppCustomAttributesNameFormat) IsKnown() bool { + switch r { + case SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatUnspecified, SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatBasic, SAMLSaasAppCustomAttributesNameFormatUrnOasisNamesTcSAML2_0AttrnameFormatURI: + return true + } + return false } -func (r AccessApplicationUpdateParamsAppLauncherApplication) getAccountID() param.Field[string] { - return r.AccountID +type SAMLSaasAppCustomAttributesSource struct { + // The name of the IdP attribute. + Name string `json:"name"` + JSON samlSaasAppCustomAttributesSourceJSON `json:"-"` } -func (r AccessApplicationUpdateParamsAppLauncherApplication) getZoneID() param.Field[string] { - return r.ZoneID +// samlSaasAppCustomAttributesSourceJSON contains the JSON metadata for the struct +// [SAMLSaasAppCustomAttributesSource] +type samlSaasAppCustomAttributesSourceJSON struct { + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (AccessApplicationUpdateParamsAppLauncherApplication) ImplementsAccessApplicationUpdateParams() { +func (r *SAMLSaasAppCustomAttributesSource) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} +func (r samlSaasAppCustomAttributesSourceJSON) RawJSON() string { + return r.raw } -// The application type. -type AccessApplicationUpdateParamsAppLauncherApplicationType string +// The format of the name identifier sent to the SaaS application. +type SAMLSaasAppNameIDFormat string const ( - 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" + SAMLSaasAppNameIDFormatID SAMLSaasAppNameIDFormat = "id" + SAMLSaasAppNameIDFormatEmail SAMLSaasAppNameIDFormat = "email" ) -func (r AccessApplicationUpdateParamsAppLauncherApplicationType) IsKnown() bool { +func (r SAMLSaasAppNameIDFormat) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsAppLauncherApplicationTypeSelfHosted, AccessApplicationUpdateParamsAppLauncherApplicationTypeSaas, AccessApplicationUpdateParamsAppLauncherApplicationTypeSSH, AccessApplicationUpdateParamsAppLauncherApplicationTypeVnc, AccessApplicationUpdateParamsAppLauncherApplicationTypeAppLauncher, AccessApplicationUpdateParamsAppLauncherApplicationTypeWARP, AccessApplicationUpdateParamsAppLauncherApplicationTypeBiso, AccessApplicationUpdateParamsAppLauncherApplicationTypeBookmark, AccessApplicationUpdateParamsAppLauncherApplicationTypeDashSSO: + case SAMLSaasAppNameIDFormatID, SAMLSaasAppNameIDFormatEmail: return true } return false } -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[[]AllowedIdpshParam] `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"` +type SAMLSaasAppParam struct { + // Optional identifier indicating the authentication protocol used for the saas + // app. Required for OIDC. Default if unset is "saml" + AuthType param.Field[SAMLSaasAppAuthType] `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[SAMLSaasAppCustomAttributesParam] `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[SAMLSaasAppNameIDFormat] `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 [JSONata] (https://jsonata.org/) expression that transforms an application's + // user identities into attribute assertions in the SAML response. The expression + // can transform id, email, name, and groups values. It can also transform fields + // listed in the saml_attributes or oidc_fields of the identity provider used to + // authenticate. The output of this expression must be a JSON object. + SAMLAttributeTransformJsonata param.Field[string] `json:"saml_attribute_transform_jsonata"` + // 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 AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) MarshalJSON() (data []byte, err error) { +func (r SAMLSaasAppParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) getAccountID() param.Field[string] { - return r.AccountID +func (r SAMLSaasAppParam) implementsZeroTrustApplicationSaaSApplicationSaasAppUnionParam() {} + +type SAMLSaasAppCustomAttributesParam 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[SAMLSaasAppCustomAttributesNameFormat] `json:"name_format"` + Source param.Field[SAMLSaasAppCustomAttributesSourceParam] `json:"source"` } -func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) getZoneID() param.Field[string] { - return r.ZoneID +func (r SAMLSaasAppCustomAttributesParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplication) ImplementsAccessApplicationUpdateParams() { +type SAMLSaasAppCustomAttributesSourceParam struct { + // The name of the IdP attribute. + Name param.Field[string] `json:"name"` +} +func (r SAMLSaasAppCustomAttributesSourceParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The application type. -type AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType string +type SelfHostedDomainsh = string -const ( - 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" -) +type SelfHostedDomainshParam = string -func (r AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationType) IsKnown() bool { - switch r { - case AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSelfHosted, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSaas, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeSSH, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeVnc, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeAppLauncher, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeWARP, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBiso, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeBookmark, AccessApplicationUpdateParamsDeviceEnrollmentPermissionsApplicationTypeDashSSO: - return true - } - return false +type AccessApplicationDeleteResponse struct { + // UUID + ID string `json:"id"` + JSON accessApplicationDeleteResponseJSON `json:"-"` } -type AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication struct { - // The application type. - Type param.Field[AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType] `json:"type,required"` +// accessApplicationDeleteResponseJSON contains the JSON metadata for the struct +// [AccessApplicationDeleteResponse] +type accessApplicationDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccessApplicationDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r accessApplicationDeleteResponseJSON) RawJSON() string { + return r.raw +} + +type AccessApplicationRevokeTokensResponse = interface{} + +type AccessApplicationNewParams struct { + Application ApplicationUnionParam `json:"application,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[[]AllowedIdpshParam] `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 AccessApplicationNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Application) } -func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) getAccountID() param.Field[string] { - return r.AccountID +type AccessApplicationNewResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result Application `json:"result,required"` + // Whether the API call was successful + Success AccessApplicationNewResponseEnvelopeSuccess `json:"success,required"` + JSON accessApplicationNewResponseEnvelopeJSON `json:"-"` } -func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) getZoneID() param.Field[string] { - return r.ZoneID +// 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 (AccessApplicationUpdateParamsBrowserIsolationPermissionsApplication) ImplementsAccessApplicationUpdateParams() { +func (r *AccessApplicationNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} +func (r accessApplicationNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } -// The application type. -type AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType string +// Whether the API call was successful +type AccessApplicationNewResponseEnvelopeSuccess bool const ( - 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" + AccessApplicationNewResponseEnvelopeSuccessTrue AccessApplicationNewResponseEnvelopeSuccess = true ) -func (r AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationType) IsKnown() bool { +func (r AccessApplicationNewResponseEnvelopeSuccess) IsKnown() bool { switch r { - case AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSelfHosted, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSaas, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeSSH, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeVnc, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeAppLauncher, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeWARP, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBiso, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeBookmark, AccessApplicationUpdateParamsBrowserIsolationPermissionsApplicationTypeDashSSO: + case AccessApplicationNewResponseEnvelopeSuccessTrue: return true } return false } -type AccessApplicationUpdateParamsBookmarkApplication struct { +type AccessApplicationUpdateParams struct { + Application ApplicationUnionParam `json:"application,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"` - // Displays the application in the App Launcher. - AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` - // The URL or domain of the bookmark. - Domain param.Field[string] `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() { - +func (r AccessApplicationUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Application) } type AccessApplicationUpdateResponseEnvelope struct { diff --git a/zero_trust/accessapplication_test.go b/zero_trust/accessapplication_test.go index b74aa57850e..ef99ad6c7ea 100644 --- a/zero_trust/accessapplication_test.go +++ b/zero_trust/accessapplication_test.go @@ -29,72 +29,8 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, 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([]zero_trust.AllowedIdpshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - AppLauncherVisible: cloudflare.F(true), - AutoRedirectToIdentity: cloudflare.F(true), - CorsHeaders: cloudflare.F(zero_trust.CorsHeadersParam{ - AllowAllHeaders: cloudflare.F(true), - AllowAllMethods: cloudflare.F(true), - AllowAllOrigins: cloudflare.F(true), - AllowCredentials: cloudflare.F(true), - AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadershParam{"string", "string", "string"}), - AllowedMethods: cloudflare.F([]zero_trust.AllowedMethodsh{zero_trust.AllowedMethodshGet}), - AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginshParam{"https://example.com"}), - MaxAge: cloudflare.F(-1.000000), - }), - CustomDenyMessage: cloudflare.F("string"), - CustomDenyURL: cloudflare.F("string"), - CustomNonIdentityDenyURL: cloudflare.F("string"), - CustomPages: cloudflare.F([]zero_trust.CustomPageshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), - 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), - SameSiteCookieAttribute: cloudflare.F("strict"), - SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainshParam{"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 - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.ZeroTrust.Access.Applications.Update( - context.TODO(), - shared.UnionString("023e105f4ecef8ad9ca31a8372d0c353"), - zero_trust.AccessApplicationUpdateParamsSelfHostedApplication{ - Domain: cloudflare.F("test.example.com/admin"), - Type: cloudflare.F("self_hosted"), - AccountID: cloudflare.F("string"), - ZoneID: cloudflare.F("string"), + _, err := client.ZeroTrust.Access.Applications.New(context.TODO(), zero_trust.AccessApplicationNewParams{ + Application: zero_trust.ApplicationSelfHostedApplicationParam{ AllowAuthenticateViaWARP: cloudflare.F(true), AllowedIDPs: cloudflare.F([]zero_trust.AllowedIdpshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), AppLauncherVisible: cloudflare.F(true), @@ -113,6 +49,7 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { CustomDenyURL: cloudflare.F("string"), CustomNonIdentityDenyURL: cloudflare.F("string"), CustomPages: cloudflare.F([]zero_trust.CustomPageshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + Domain: cloudflare.F("test.example.com/admin"), 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"), @@ -124,6 +61,73 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { SessionDuration: cloudflare.F("24h"), SkipInterstitial: cloudflare.F(true), Tags: cloudflare.F([]string{"engineers", "engineers", "engineers"}), + Type: cloudflare.F("self_hosted"), + }, + AccountID: cloudflare.F("string"), + ZoneID: cloudflare.F("string"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.ZeroTrust.Access.Applications.Update( + context.TODO(), + shared.UnionString("023e105f4ecef8ad9ca31a8372d0c353"), + zero_trust.AccessApplicationUpdateParams{ + Application: zero_trust.ApplicationSelfHostedApplicationParam{ + AllowAuthenticateViaWARP: cloudflare.F(true), + AllowedIDPs: cloudflare.F([]zero_trust.AllowedIdpshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + AppLauncherVisible: cloudflare.F(true), + AutoRedirectToIdentity: cloudflare.F(true), + CorsHeaders: cloudflare.F(zero_trust.CorsHeadersParam{ + AllowAllHeaders: cloudflare.F(true), + AllowAllMethods: cloudflare.F(true), + AllowAllOrigins: cloudflare.F(true), + AllowCredentials: cloudflare.F(true), + AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadershParam{"string", "string", "string"}), + AllowedMethods: cloudflare.F([]zero_trust.AllowedMethodsh{zero_trust.AllowedMethodshGet}), + AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginshParam{"https://example.com"}), + MaxAge: cloudflare.F(-1.000000), + }), + CustomDenyMessage: cloudflare.F("string"), + CustomDenyURL: cloudflare.F("string"), + CustomNonIdentityDenyURL: cloudflare.F("string"), + CustomPages: cloudflare.F([]zero_trust.CustomPageshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + Domain: cloudflare.F("test.example.com/admin"), + 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), + SameSiteCookieAttribute: cloudflare.F("strict"), + SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainshParam{"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("self_hosted"), + }, + AccountID: cloudflare.F("string"), + ZoneID: cloudflare.F("string"), }, ) if err != nil { diff --git a/zero_trust/accessapplicationca.go b/zero_trust/accessapplicationca.go index e6fdc3d3196..14e654432cb 100644 --- a/zero_trust/accessapplicationca.go +++ b/zero_trust/accessapplicationca.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // AccessApplicationCAService contains methods and other services that help with @@ -34,7 +36,7 @@ func NewAccessApplicationCAService(opts ...option.RequestOption) (r *AccessAppli } // Generates a new short-lived certificate CA and public key. -func (r *AccessApplicationCAService) New(ctx context.Context, uuid string, body AccessApplicationCANewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccessApplicationCAService) New(ctx context.Context, uuid string, body AccessApplicationCANewParams, opts ...option.RequestOption) (res *AccessApplicationCANewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccessApplicationCANewResponseEnvelope var accountOrZone string @@ -110,7 +112,7 @@ func (r *AccessApplicationCAService) Delete(ctx context.Context, uuid string, bo } // Fetches a short-lived certificate CA and its public key. -func (r *AccessApplicationCAService) Get(ctx context.Context, uuid string, query AccessApplicationCAGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *AccessApplicationCAService) Get(ctx context.Context, uuid string, query AccessApplicationCAGetParams, opts ...option.RequestOption) (res *AccessApplicationCAGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env AccessApplicationCAGetResponseEnvelope var accountOrZone string @@ -159,6 +161,23 @@ func (r caJSON) RawJSON() string { return r.raw } +// Union satisfied by [zero_trust.AccessApplicationCANewResponseUnknown] or +// [shared.UnionString]. +type AccessApplicationCANewResponseUnion interface { + ImplementsZeroTrustAccessApplicationCANewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccessApplicationCANewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AccessApplicationCADeleteResponse struct { // The ID of the CA. ID string `json:"id"` @@ -181,6 +200,23 @@ func (r accessApplicationCADeleteResponseJSON) RawJSON() string { return r.raw } +// Union satisfied by [zero_trust.AccessApplicationCAGetResponseUnknown] or +// [shared.UnionString]. +type AccessApplicationCAGetResponseUnion interface { + ImplementsZeroTrustAccessApplicationCAGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*AccessApplicationCAGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type AccessApplicationCANewParams struct { // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. AccountID param.Field[string] `path:"account_id"` @@ -189,9 +225,9 @@ type AccessApplicationCANewParams struct { } type AccessApplicationCANewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccessApplicationCANewResponseUnion `json:"result,required"` // Whether the API call was successful Success AccessApplicationCANewResponseEnvelopeSuccess `json:"success,required"` JSON accessApplicationCANewResponseEnvelopeJSON `json:"-"` @@ -296,9 +332,9 @@ type AccessApplicationCAGetParams struct { } type AccessApplicationCAGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result AccessApplicationCAGetResponseUnion `json:"result,required"` // Whether the API call was successful Success AccessApplicationCAGetResponseEnvelopeSuccess `json:"success,required"` JSON accessApplicationCAGetResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/accessbookmark.go b/zero_trust/accessbookmark.go index 8f075fc2fd3..0a156212fb2 100644 --- a/zero_trust/accessbookmark.go +++ b/zero_trust/accessbookmark.go @@ -10,7 +10,6 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" @@ -169,7 +168,7 @@ func (r accessBookmarkDeleteResponseJSON) RawJSON() string { } type AccessBookmarkNewParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r AccessBookmarkNewParams) MarshalJSON() (data []byte, err error) { @@ -220,7 +219,7 @@ func (r AccessBookmarkNewResponseEnvelopeSuccess) IsKnown() bool { } type AccessBookmarkUpdateParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r AccessBookmarkUpdateParams) MarshalJSON() (data []byte, err error) { @@ -271,7 +270,7 @@ func (r AccessBookmarkUpdateResponseEnvelopeSuccess) IsKnown() bool { } type AccessBookmarkDeleteParams struct { - Body param.Field[interface{}] `json:"body,required"` + Body interface{} `json:"body,required"` } func (r AccessBookmarkDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/accessbookmark_test.go b/zero_trust/accessbookmark_test.go index 8224ad3e551..98f7e866fe1 100644 --- a/zero_trust/accessbookmark_test.go +++ b/zero_trust/accessbookmark_test.go @@ -33,7 +33,7 @@ func TestAccessBookmarkNew(t *testing.T) { "699d98642c564d2e855e9661899b7252", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessBookmarkNewParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -64,7 +64,7 @@ func TestAccessBookmarkUpdate(t *testing.T) { "699d98642c564d2e855e9661899b7252", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessBookmarkUpdateParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { @@ -119,7 +119,7 @@ func TestAccessBookmarkDelete(t *testing.T) { "699d98642c564d2e855e9661899b7252", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessBookmarkDeleteParams{ - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/accesscustompage.go b/zero_trust/accesscustompage.go index c4981da2a5e..b862590c07c 100644 --- a/zero_trust/accesscustompage.go +++ b/zero_trust/accesscustompage.go @@ -162,6 +162,21 @@ func (r CustomPageType) IsKnown() bool { return false } +type CustomPageParam struct { + // Custom page HTML. + CustomHTML param.Field[string] `json:"custom_html,required"` + // Custom page name. + Name param.Field[string] `json:"name,required"` + // Custom page type. + Type param.Field[CustomPageType] `json:"type,required"` + // Number of apps the custom page is assigned to. + AppCount param.Field[int64] `json:"app_count"` +} + +func (r CustomPageParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type CustomPageWithoutHTML struct { // Custom page name. Name string `json:"name,required"` @@ -236,34 +251,11 @@ func (r accessCustomPageDeleteResponseJSON) RawJSON() string { } type AccessCustomPageNewParams struct { - // Custom page HTML. - CustomHTML param.Field[string] `json:"custom_html,required"` - // Custom page name. - Name param.Field[string] `json:"name,required"` - // Custom page type. - Type param.Field[AccessCustomPageNewParamsType] `json:"type,required"` - // Number of apps the custom page is assigned to. - AppCount param.Field[int64] `json:"app_count"` + CustomPage CustomPageParam `json:"custom_page,required"` } func (r AccessCustomPageNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Custom page type. -type AccessCustomPageNewParamsType string - -const ( - AccessCustomPageNewParamsTypeIdentityDenied AccessCustomPageNewParamsType = "identity_denied" - AccessCustomPageNewParamsTypeForbidden AccessCustomPageNewParamsType = "forbidden" -) - -func (r AccessCustomPageNewParamsType) IsKnown() bool { - switch r { - case AccessCustomPageNewParamsTypeIdentityDenied, AccessCustomPageNewParamsTypeForbidden: - return true - } - return false + return apijson.MarshalRoot(r.CustomPage) } type AccessCustomPageNewResponseEnvelope struct { @@ -310,34 +302,11 @@ func (r AccessCustomPageNewResponseEnvelopeSuccess) IsKnown() bool { } type AccessCustomPageUpdateParams struct { - // Custom page HTML. - CustomHTML param.Field[string] `json:"custom_html,required"` - // Custom page name. - Name param.Field[string] `json:"name,required"` - // Custom page type. - Type param.Field[AccessCustomPageUpdateParamsType] `json:"type,required"` - // Number of apps the custom page is assigned to. - AppCount param.Field[int64] `json:"app_count"` + CustomPage CustomPageParam `json:"custom_page,required"` } func (r AccessCustomPageUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Custom page type. -type AccessCustomPageUpdateParamsType string - -const ( - AccessCustomPageUpdateParamsTypeIdentityDenied AccessCustomPageUpdateParamsType = "identity_denied" - AccessCustomPageUpdateParamsTypeForbidden AccessCustomPageUpdateParamsType = "forbidden" -) - -func (r AccessCustomPageUpdateParamsType) IsKnown() bool { - switch r { - case AccessCustomPageUpdateParamsTypeIdentityDenied, AccessCustomPageUpdateParamsTypeForbidden: - return true - } - return false + return apijson.MarshalRoot(r.CustomPage) } type AccessCustomPageUpdateResponseEnvelope struct { diff --git a/zero_trust/accesscustompage_test.go b/zero_trust/accesscustompage_test.go index 08b1fce1d8e..59147eca3f1 100644 --- a/zero_trust/accesscustompage_test.go +++ b/zero_trust/accesscustompage_test.go @@ -32,10 +32,12 @@ func TestAccessCustomPageNewWithOptionalParams(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", zero_trust.AccessCustomPageNewParams{ - CustomHTML: cloudflare.F("

Access Denied

"), - Name: cloudflare.F("string"), - Type: cloudflare.F(zero_trust.AccessCustomPageNewParamsTypeIdentityDenied), - AppCount: cloudflare.F(int64(0)), + CustomPage: zero_trust.CustomPageParam{ + AppCount: cloudflare.F(int64(0)), + CustomHTML: cloudflare.F("

Access Denied

"), + Name: cloudflare.F("string"), + Type: cloudflare.F(zero_trust.CustomPageTypeIdentityDenied), + }, }, ) if err != nil { @@ -66,10 +68,12 @@ func TestAccessCustomPageUpdateWithOptionalParams(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessCustomPageUpdateParams{ - CustomHTML: cloudflare.F("

Access Denied

"), - Name: cloudflare.F("string"), - Type: cloudflare.F(zero_trust.AccessCustomPageUpdateParamsTypeIdentityDenied), - AppCount: cloudflare.F(int64(0)), + CustomPage: zero_trust.CustomPageParam{ + AppCount: cloudflare.F(int64(0)), + CustomHTML: cloudflare.F("

Access Denied

"), + Name: cloudflare.F("string"), + Type: cloudflare.F(zero_trust.CustomPageTypeIdentityDenied), + }, }, ) if err != nil { diff --git a/zero_trust/aliases.go b/zero_trust/aliases.go index cda1a63d1c4..648def9045f 100644 --- a/zero_trust/aliases.go +++ b/zero_trust/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/zero_trust/device.go b/zero_trust/device.go index 5c3e02627d1..27a823d0460 100644 --- a/zero_trust/device.go +++ b/zero_trust/device.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // DeviceService contains methods and other services that help with interacting @@ -73,7 +75,7 @@ func (r *DeviceService) ListAutoPaging(ctx context.Context, query DeviceListPara } // Fetches details for a single device. -func (r *DeviceService) Get(ctx context.Context, deviceID string, query DeviceGetParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DeviceService) Get(ctx context.Context, deviceID string, query DeviceGetParams, opts ...option.RequestOption) (res *DeviceGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DeviceGetResponseEnvelope path := fmt.Sprintf("accounts/%s/devices/%s", query.AccountID, deviceID) @@ -206,6 +208,23 @@ func (r deviceUserJSON) RawJSON() string { return r.raw } +// Union satisfied by [zero_trust.DeviceGetResponseUnknown] or +// [shared.UnionString]. +type DeviceGetResponseUnion interface { + ImplementsZeroTrustDeviceGetResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DeviceGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DeviceListParams struct { AccountID param.Field[string] `path:"account_id,required"` } @@ -215,9 +234,9 @@ type DeviceGetParams struct { } type DeviceGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DeviceGetResponseUnion `json:"result,required"` // Whether the API call was successful. Success DeviceGetResponseEnvelopeSuccess `json:"success,required"` JSON deviceGetResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/devicedextest.go b/zero_trust/devicedextest.go index 109105ca724..633b440e34c 100644 --- a/zero_trust/devicedextest.go +++ b/zero_trust/devicedextest.go @@ -220,8 +220,7 @@ func (r schemaHTTPTargetPolicyJSON) RawJSON() string { return r.raw } -type DeviceDEXTestNewParams struct { - AccountID param.Field[string] `path:"account_id,required"` +type SchemaHTTPParam struct { // The configuration object which contains the details for the WARP client to // conduct the test. Data param.Field[SchemaDataParam] `json:"data,required"` @@ -234,15 +233,15 @@ type DeviceDEXTestNewParams struct { // Additional details about the test. Description param.Field[string] `json:"description"` // Device settings profiles targeted by this test - TargetPolicies param.Field[[]DeviceDEXTestNewParamsTargetPolicy] `json:"target_policies"` - Targeted param.Field[bool] `json:"targeted"` + TargetPolicies param.Field[[]SchemaHTTPTargetPolicyParam] `json:"target_policies"` + Targeted param.Field[bool] `json:"targeted"` } -func (r DeviceDEXTestNewParams) MarshalJSON() (data []byte, err error) { +func (r SchemaHTTPParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type DeviceDEXTestNewParamsTargetPolicy struct { +type SchemaHTTPTargetPolicyParam struct { // The id of the device settings profile ID param.Field[string] `json:"id"` // Whether the profile is the account default @@ -251,10 +250,19 @@ type DeviceDEXTestNewParamsTargetPolicy struct { Name param.Field[string] `json:"name"` } -func (r DeviceDEXTestNewParamsTargetPolicy) MarshalJSON() (data []byte, err error) { +func (r SchemaHTTPTargetPolicyParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +type DeviceDEXTestNewParams struct { + AccountID param.Field[string] `path:"account_id,required"` + SchemaHTTP SchemaHTTPParam `json:"schema_http,required"` +} + +func (r DeviceDEXTestNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.SchemaHTTP) +} + type DeviceDEXTestNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -299,38 +307,12 @@ func (r DeviceDEXTestNewResponseEnvelopeSuccess) IsKnown() bool { } type DeviceDEXTestUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - // The configuration object which contains the details for the WARP client to - // conduct the test. - Data param.Field[SchemaDataParam] `json:"data,required"` - // Determines whether or not the test is active. - Enabled param.Field[bool] `json:"enabled,required"` - // How often the test will run. - Interval param.Field[string] `json:"interval,required"` - // The name of the DEX test. Must be unique. - Name param.Field[string] `json:"name,required"` - // Additional details about the test. - Description param.Field[string] `json:"description"` - // Device settings profiles targeted by this test - TargetPolicies param.Field[[]DeviceDEXTestUpdateParamsTargetPolicy] `json:"target_policies"` - Targeted param.Field[bool] `json:"targeted"` + AccountID param.Field[string] `path:"account_id,required"` + SchemaHTTP SchemaHTTPParam `json:"schema_http,required"` } func (r DeviceDEXTestUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type DeviceDEXTestUpdateParamsTargetPolicy struct { - // The id of the device settings profile - ID param.Field[string] `json:"id"` - // Whether the profile is the account default - Default param.Field[bool] `json:"default"` - // The name of the device settings profile - Name param.Field[string] `json:"name"` -} - -func (r DeviceDEXTestUpdateParamsTargetPolicy) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.SchemaHTTP) } type DeviceDEXTestUpdateResponseEnvelope struct { diff --git a/zero_trust/devicedextest_test.go b/zero_trust/devicedextest_test.go index bb10e18fb3b..dac8acee177 100644 --- a/zero_trust/devicedextest_test.go +++ b/zero_trust/devicedextest_test.go @@ -30,29 +30,31 @@ func TestDeviceDEXTestNewWithOptionalParams(t *testing.T) { ) _, err := client.ZeroTrust.Devices.DEXTests.New(context.TODO(), zero_trust.DeviceDEXTestNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Data: cloudflare.F(zero_trust.SchemaDataParam{ - Host: cloudflare.F("https://dash.cloudflare.com"), - Kind: cloudflare.F("http"), - Method: cloudflare.F("GET"), - }), - Enabled: cloudflare.F(true), - Interval: cloudflare.F("30m"), - Name: cloudflare.F("HTTP dash health check"), - Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), - TargetPolicies: cloudflare.F([]zero_trust.DeviceDEXTestNewParamsTargetPolicy{{ - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }, { - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }, { - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }}), - Targeted: cloudflare.F(true), + SchemaHTTP: zero_trust.SchemaHTTPParam{ + Data: cloudflare.F(zero_trust.SchemaDataParam{ + Host: cloudflare.F("https://dash.cloudflare.com"), + Kind: cloudflare.F("http"), + Method: cloudflare.F("GET"), + }), + Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), + Enabled: cloudflare.F(true), + Interval: cloudflare.F("30m"), + Name: cloudflare.F("HTTP dash health check"), + TargetPolicies: cloudflare.F([]zero_trust.SchemaHTTPTargetPolicyParam{{ + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }, { + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }, { + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }}), + Targeted: cloudflare.F(true), + }, }) if err != nil { var apierr *cloudflare.Error @@ -82,29 +84,31 @@ func TestDeviceDEXTestUpdateWithOptionalParams(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DeviceDEXTestUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Data: cloudflare.F(zero_trust.SchemaDataParam{ - Host: cloudflare.F("https://dash.cloudflare.com"), - Kind: cloudflare.F("http"), - Method: cloudflare.F("GET"), - }), - Enabled: cloudflare.F(true), - Interval: cloudflare.F("30m"), - Name: cloudflare.F("HTTP dash health check"), - Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), - TargetPolicies: cloudflare.F([]zero_trust.DeviceDEXTestUpdateParamsTargetPolicy{{ - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }, { - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }, { - Default: cloudflare.F(true), - ID: cloudflare.F("string"), - Name: cloudflare.F("string"), - }}), - Targeted: cloudflare.F(true), + SchemaHTTP: zero_trust.SchemaHTTPParam{ + Data: cloudflare.F(zero_trust.SchemaDataParam{ + Host: cloudflare.F("https://dash.cloudflare.com"), + Kind: cloudflare.F("http"), + Method: cloudflare.F("GET"), + }), + Description: cloudflare.F("Checks the dash endpoint every 30 minutes"), + Enabled: cloudflare.F(true), + Interval: cloudflare.F("30m"), + Name: cloudflare.F("HTTP dash health check"), + TargetPolicies: cloudflare.F([]zero_trust.SchemaHTTPTargetPolicyParam{{ + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }, { + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }, { + Default: cloudflare.F(true), + ID: cloudflare.F("string"), + Name: cloudflare.F("string"), + }}), + Targeted: cloudflare.F(true), + }, }, ) if err != nil { diff --git a/zero_trust/devicenetwork.go b/zero_trust/devicenetwork.go index 56544c23951..151d3cdbe80 100644 --- a/zero_trust/devicenetwork.go +++ b/zero_trust/devicenetwork.go @@ -368,8 +368,8 @@ type DeviceNetworkListParams struct { } type DeviceNetworkDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DeviceNetworkDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/devicenetwork_test.go b/zero_trust/devicenetwork_test.go index 5d252bbdae8..f897bd17f7b 100644 --- a/zero_trust/devicenetwork_test.go +++ b/zero_trust/devicenetwork_test.go @@ -127,7 +127,7 @@ func TestDeviceNetworkDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DeviceNetworkDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/devicepolicy.go b/zero_trust/devicepolicy.go index ff30f9b8633..f76fcf349a2 100644 --- a/zero_trust/devicepolicy.go +++ b/zero_trust/devicepolicy.go @@ -407,8 +407,8 @@ type DevicePolicyListParams struct { } type DevicePolicyDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DevicePolicyDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/devicepolicy_test.go b/zero_trust/devicepolicy_test.go index 84ed9b23d1b..bf407178c6d 100644 --- a/zero_trust/devicepolicy_test.go +++ b/zero_trust/devicepolicy_test.go @@ -105,7 +105,7 @@ func TestDevicePolicyDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePolicyDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/devicepolicyexclude.go b/zero_trust/devicepolicyexclude.go index f2fbb729838..4dd7ce3bce8 100644 --- a/zero_trust/devicepolicyexclude.go +++ b/zero_trust/devicepolicyexclude.go @@ -129,8 +129,8 @@ func (r SplitTunnelExcludeParam) MarshalJSON() (data []byte, err error) { } type DevicePolicyExcludeUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]SplitTunnelExcludeParam] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []SplitTunnelExcludeParam `json:"body,required"` } func (r DevicePolicyExcludeUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/devicepolicyexclude_test.go b/zero_trust/devicepolicyexclude_test.go index 269d4a416d7..3c60baff497 100644 --- a/zero_trust/devicepolicyexclude_test.go +++ b/zero_trust/devicepolicyexclude_test.go @@ -30,7 +30,7 @@ func TestDevicePolicyExcludeUpdate(t *testing.T) { ) _, err := client.ZeroTrust.Devices.Policies.Excludes.Update(context.TODO(), zero_trust.DevicePolicyExcludeUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F([]zero_trust.SplitTunnelExcludeParam{{ + Body: []zero_trust.SplitTunnelExcludeParam{{ Address: cloudflare.F("192.0.2.0/24"), Description: cloudflare.F("Exclude testing domains from the tunnel"), Host: cloudflare.F("*.example.com"), @@ -42,7 +42,7 @@ func TestDevicePolicyExcludeUpdate(t *testing.T) { Address: cloudflare.F("192.0.2.0/24"), Description: cloudflare.F("Exclude testing domains from the tunnel"), Host: cloudflare.F("*.example.com"), - }}), + }}, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/devicepolicyfallbackdomain.go b/zero_trust/devicepolicyfallbackdomain.go index 190af97be1e..960bf9903df 100644 --- a/zero_trust/devicepolicyfallbackdomain.go +++ b/zero_trust/devicepolicyfallbackdomain.go @@ -129,8 +129,8 @@ func (r FallbackDomainParam) MarshalJSON() (data []byte, err error) { } type DevicePolicyFallbackDomainUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]FallbackDomainParam] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []FallbackDomainParam `json:"body,required"` } func (r DevicePolicyFallbackDomainUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/devicepolicyfallbackdomain_test.go b/zero_trust/devicepolicyfallbackdomain_test.go index 3808ddbbc27..caf5294f085 100644 --- a/zero_trust/devicepolicyfallbackdomain_test.go +++ b/zero_trust/devicepolicyfallbackdomain_test.go @@ -33,7 +33,7 @@ func TestDevicePolicyFallbackDomainUpdate(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePolicyFallbackDomainUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F([]zero_trust.FallbackDomainParam{{ + Body: []zero_trust.FallbackDomainParam{{ Description: cloudflare.F("Domain bypass for local development"), DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), Suffix: cloudflare.F("example.com"), @@ -45,7 +45,7 @@ func TestDevicePolicyFallbackDomainUpdate(t *testing.T) { Description: cloudflare.F("Domain bypass for local development"), DNSServer: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}), Suffix: cloudflare.F("example.com"), - }}), + }}, }, ) if err != nil { diff --git a/zero_trust/devicepolicyinclude.go b/zero_trust/devicepolicyinclude.go index d7c10bc14b6..86528171c3a 100644 --- a/zero_trust/devicepolicyinclude.go +++ b/zero_trust/devicepolicyinclude.go @@ -129,8 +129,8 @@ func (r SplitTunnelIncludeParam) MarshalJSON() (data []byte, err error) { } type DevicePolicyIncludeUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]SplitTunnelIncludeParam] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body []SplitTunnelIncludeParam `json:"body,required"` } func (r DevicePolicyIncludeUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/devicepolicyinclude_test.go b/zero_trust/devicepolicyinclude_test.go index 5cf7c9bd19f..73855c68548 100644 --- a/zero_trust/devicepolicyinclude_test.go +++ b/zero_trust/devicepolicyinclude_test.go @@ -30,7 +30,7 @@ func TestDevicePolicyIncludeUpdate(t *testing.T) { ) _, err := client.ZeroTrust.Devices.Policies.Includes.Update(context.TODO(), zero_trust.DevicePolicyIncludeUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F([]zero_trust.SplitTunnelIncludeParam{{ + Body: []zero_trust.SplitTunnelIncludeParam{{ Address: cloudflare.F("192.0.2.0/24"), Description: cloudflare.F("Include testing domains from the tunnel"), Host: cloudflare.F("*.example.com"), @@ -42,7 +42,7 @@ func TestDevicePolicyIncludeUpdate(t *testing.T) { Address: cloudflare.F("192.0.2.0/24"), Description: cloudflare.F("Include testing domains from the tunnel"), Host: cloudflare.F("*.example.com"), - }}), + }}, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/deviceposture.go b/zero_trust/deviceposture.go index 7a108dca10f..47016382246 100644 --- a/zero_trust/deviceposture.go +++ b/zero_trust/deviceposture.go @@ -1986,8 +1986,8 @@ type DevicePostureListParams struct { } type DevicePostureDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DevicePostureDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/deviceposture_test.go b/zero_trust/deviceposture_test.go index 634d86da31e..2c193f8f7fd 100644 --- a/zero_trust/deviceposture_test.go +++ b/zero_trust/deviceposture_test.go @@ -153,7 +153,7 @@ func TestDevicePostureDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePostureDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/devicepostureintegration.go b/zero_trust/devicepostureintegration.go index 698d12d9255..020bfceae32 100644 --- a/zero_trust/devicepostureintegration.go +++ b/zero_trust/devicepostureintegration.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" @@ -13,6 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // DevicePostureIntegrationService contains methods and other services that help @@ -70,7 +72,7 @@ func (r *DevicePostureIntegrationService) ListAutoPaging(ctx context.Context, qu } // Delete a configured device posture integration. -func (r *DevicePostureIntegrationService) Delete(ctx context.Context, integrationID string, params DevicePostureIntegrationDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DevicePostureIntegrationService) Delete(ctx context.Context, integrationID string, params DevicePostureIntegrationDeleteParams, opts ...option.RequestOption) (res *DevicePostureIntegrationDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DevicePostureIntegrationDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/devices/posture/integration/%s", params.AccountID, integrationID) @@ -192,6 +194,23 @@ func (r IntegrationType) IsKnown() bool { return false } +// Union satisfied by [zero_trust.DevicePostureIntegrationDeleteResponseUnknown] or +// [shared.UnionString]. +type DevicePostureIntegrationDeleteResponseUnion interface { + ImplementsZeroTrustDevicePostureIntegrationDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DevicePostureIntegrationDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DevicePostureIntegrationNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // The configuration object containing third-party integration information. @@ -440,8 +459,8 @@ type DevicePostureIntegrationListParams struct { } type DevicePostureIntegrationDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DevicePostureIntegrationDeleteParams) MarshalJSON() (data []byte, err error) { @@ -449,9 +468,9 @@ func (r DevicePostureIntegrationDeleteParams) MarshalJSON() (data []byte, err er } type DevicePostureIntegrationDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DevicePostureIntegrationDeleteResponseUnion `json:"result,required"` // Whether the API call was successful. Success DevicePostureIntegrationDeleteResponseEnvelopeSuccess `json:"success,required"` JSON devicePostureIntegrationDeleteResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/devicepostureintegration_test.go b/zero_trust/devicepostureintegration_test.go index d9a32a73d98..dcb58a0734e 100644 --- a/zero_trust/devicepostureintegration_test.go +++ b/zero_trust/devicepostureintegration_test.go @@ -94,7 +94,7 @@ func TestDevicePostureIntegrationDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePostureIntegrationDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/devicerevoke.go b/zero_trust/devicerevoke.go index dfe33e37c63..6dfeef73042 100644 --- a/zero_trust/devicerevoke.go +++ b/zero_trust/devicerevoke.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // DeviceRevokeService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewDeviceRevokeService(opts ...option.RequestOption) (r *DeviceRevokeServic } // Revokes a list of devices. -func (r *DeviceRevokeService) New(ctx context.Context, params DeviceRevokeNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DeviceRevokeService) New(ctx context.Context, params DeviceRevokeNewParams, opts ...option.RequestOption) (res *DeviceRevokeNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DeviceRevokeNewResponseEnvelope path := fmt.Sprintf("accounts/%s/devices/revoke", params.AccountID) @@ -45,10 +47,27 @@ func (r *DeviceRevokeService) New(ctx context.Context, params DeviceRevokeNewPar return } +// Union satisfied by [zero_trust.DeviceRevokeNewResponseUnknown] or +// [shared.UnionString]. +type DeviceRevokeNewResponseUnion interface { + ImplementsZeroTrustDeviceRevokeNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DeviceRevokeNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DeviceRevokeNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // A list of device ids to revoke. - Body param.Field[[]string] `json:"body,required"` + Body []string `json:"body,required"` } func (r DeviceRevokeNewParams) MarshalJSON() (data []byte, err error) { @@ -56,9 +75,9 @@ func (r DeviceRevokeNewParams) MarshalJSON() (data []byte, err error) { } type DeviceRevokeNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DeviceRevokeNewResponseUnion `json:"result,required"` // Whether the API call was successful. Success DeviceRevokeNewResponseEnvelopeSuccess `json:"success,required"` JSON deviceRevokeNewResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/devicerevoke_test.go b/zero_trust/devicerevoke_test.go index 5937a6e35fa..91b21b1a4ca 100644 --- a/zero_trust/devicerevoke_test.go +++ b/zero_trust/devicerevoke_test.go @@ -30,7 +30,7 @@ func TestDeviceRevokeNew(t *testing.T) { ) _, err := client.ZeroTrust.Devices.Revoke.New(context.TODO(), zero_trust.DeviceRevokeNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), + Body: []string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/devicesetting.go b/zero_trust/devicesetting.go index d6330f7b53b..8238a8f3d96 100644 --- a/zero_trust/devicesetting.go +++ b/zero_trust/devicesetting.go @@ -88,8 +88,7 @@ func (r deviceSettingsJSON) RawJSON() string { return r.raw } -type DeviceSettingUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` +type DeviceSettingsParam struct { // Enable gateway proxy filtering on TCP. GatewayProxyEnabled param.Field[bool] `json:"gateway_proxy_enabled"` // Enable gateway proxy filtering on UDP. @@ -100,10 +99,19 @@ type DeviceSettingUpdateParams struct { UseZtVirtualIP param.Field[bool] `json:"use_zt_virtual_ip"` } -func (r DeviceSettingUpdateParams) MarshalJSON() (data []byte, err error) { +func (r DeviceSettingsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +type DeviceSettingUpdateParams struct { + AccountID param.Field[string] `path:"account_id,required"` + DeviceSettings DeviceSettingsParam `json:"device_settings,required"` +} + +func (r DeviceSettingUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.DeviceSettings) +} + type DeviceSettingUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/zero_trust/devicesetting_test.go b/zero_trust/devicesetting_test.go index 16ef4ca63be..3ccd554d41c 100644 --- a/zero_trust/devicesetting_test.go +++ b/zero_trust/devicesetting_test.go @@ -29,11 +29,13 @@ func TestDeviceSettingUpdateWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.ZeroTrust.Devices.Settings.Update(context.TODO(), zero_trust.DeviceSettingUpdateParams{ - AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - GatewayProxyEnabled: cloudflare.F(true), - GatewayUdpProxyEnabled: cloudflare.F(true), - RootCertificateInstallationEnabled: cloudflare.F(true), - UseZtVirtualIP: cloudflare.F(true), + AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), + DeviceSettings: zero_trust.DeviceSettingsParam{ + GatewayProxyEnabled: cloudflare.F(true), + GatewayUdpProxyEnabled: cloudflare.F(true), + RootCertificateInstallationEnabled: cloudflare.F(true), + UseZtVirtualIP: cloudflare.F(true), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/deviceunrevoke.go b/zero_trust/deviceunrevoke.go index 56bd6cba87a..f2bcd4e770d 100644 --- a/zero_trust/deviceunrevoke.go +++ b/zero_trust/deviceunrevoke.go @@ -6,12 +6,14 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // DeviceUnrevokeService contains methods and other services that help with @@ -33,7 +35,7 @@ func NewDeviceUnrevokeService(opts ...option.RequestOption) (r *DeviceUnrevokeSe } // Unrevokes a list of devices. -func (r *DeviceUnrevokeService) New(ctx context.Context, params DeviceUnrevokeNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *DeviceUnrevokeService) New(ctx context.Context, params DeviceUnrevokeNewParams, opts ...option.RequestOption) (res *DeviceUnrevokeNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DeviceUnrevokeNewResponseEnvelope path := fmt.Sprintf("accounts/%s/devices/unrevoke", params.AccountID) @@ -45,10 +47,27 @@ func (r *DeviceUnrevokeService) New(ctx context.Context, params DeviceUnrevokeNe return } +// Union satisfied by [zero_trust.DeviceUnrevokeNewResponseUnknown] or +// [shared.UnionString]. +type DeviceUnrevokeNewResponseUnion interface { + ImplementsZeroTrustDeviceUnrevokeNewResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*DeviceUnrevokeNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type DeviceUnrevokeNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // A list of device ids to unrevoke. - Body param.Field[[]string] `json:"body,required"` + Body []string `json:"body,required"` } func (r DeviceUnrevokeNewParams) MarshalJSON() (data []byte, err error) { @@ -56,9 +75,9 @@ func (r DeviceUnrevokeNewParams) MarshalJSON() (data []byte, err error) { } type DeviceUnrevokeNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result DeviceUnrevokeNewResponseUnion `json:"result,required"` // Whether the API call was successful. Success DeviceUnrevokeNewResponseEnvelopeSuccess `json:"success,required"` JSON deviceUnrevokeNewResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/deviceunrevoke_test.go b/zero_trust/deviceunrevoke_test.go index 4536f0f66ef..5c0c8cf4822 100644 --- a/zero_trust/deviceunrevoke_test.go +++ b/zero_trust/deviceunrevoke_test.go @@ -30,7 +30,7 @@ func TestDeviceUnrevokeNew(t *testing.T) { ) _, err := client.ZeroTrust.Devices.Unrevoke.New(context.TODO(), zero_trust.DeviceUnrevokeNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), + Body: []string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/dlpdatasetupload.go b/zero_trust/dlpdatasetupload.go index 5a089f1e5a1..6f17dd6f6a7 100644 --- a/zero_trust/dlpdatasetupload.go +++ b/zero_trust/dlpdatasetupload.go @@ -147,8 +147,8 @@ func (r dlpDatasetUploadNewResponseEnvelopeResultInfoJSON) RawJSON() string { } type DLPDatasetUploadEditParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DLPDatasetUploadEditParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/dlpdatasetupload_test.go b/zero_trust/dlpdatasetupload_test.go index b3684f116be..194c2632519 100644 --- a/zero_trust/dlpdatasetupload_test.go +++ b/zero_trust/dlpdatasetupload_test.go @@ -64,7 +64,7 @@ func TestDLPDatasetUploadEdit(t *testing.T) { int64(0), zero_trust.DLPDatasetUploadEditParams{ AccountID: cloudflare.F("string"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/dlpprofilecustom.go b/zero_trust/dlpprofilecustom.go index 7c17f33ad40..b07dedce7b5 100644 --- a/zero_trust/dlpprofilecustom.go +++ b/zero_trust/dlpprofilecustom.go @@ -473,8 +473,8 @@ func (r DLPProfileCustomUpdateParamsSharedEntriesDLPSharedEntryUpdateIntegration type DLPProfileCustomDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r DLPProfileCustomDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/dlpprofilecustom_test.go b/zero_trust/dlpprofilecustom_test.go index 371a31bdd5a..64cea9e783f 100644 --- a/zero_trust/dlpprofilecustom_test.go +++ b/zero_trust/dlpprofilecustom_test.go @@ -231,7 +231,7 @@ func TestDLPProfileCustomDelete(t *testing.T) { "384e129d-25bd-403c-8019-bc19eb7a8a5f", zero_trust.DLPProfileCustomDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/gatewaylist.go b/zero_trust/gatewaylist.go index bf87a246734..78505635fbd 100644 --- a/zero_trust/gatewaylist.go +++ b/zero_trust/gatewaylist.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // GatewayListService contains methods and other services that help with @@ -86,7 +88,7 @@ func (r *GatewayListService) ListAutoPaging(ctx context.Context, query GatewayLi } // Deletes a Zero Trust list. -func (r *GatewayListService) Delete(ctx context.Context, listID string, params GatewayListDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *GatewayListService) Delete(ctx context.Context, listID string, params GatewayListDeleteParams, opts ...option.RequestOption) (res *GatewayListDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayListDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/gateway/lists/%s", params.AccountID, listID) @@ -327,6 +329,23 @@ func (r GatewayListListResponseType) IsKnown() bool { return false } +// Union satisfied by [zero_trust.GatewayListDeleteResponseUnknown] or +// [shared.UnionString]. +type GatewayListDeleteResponseUnion interface { + ImplementsZeroTrustGatewayListDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*GatewayListDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type GatewayListEditResponse struct { // API Resource UUID tag. ID string `json:"id"` @@ -579,8 +598,8 @@ type GatewayListListParams struct { } type GatewayListDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GatewayListDeleteParams) MarshalJSON() (data []byte, err error) { @@ -588,9 +607,9 @@ func (r GatewayListDeleteParams) MarshalJSON() (data []byte, err error) { } type GatewayListDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result GatewayListDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success GatewayListDeleteResponseEnvelopeSuccess `json:"success,required"` JSON gatewayListDeleteResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/gatewaylist_test.go b/zero_trust/gatewaylist_test.go index 6d3c001b085..6c5e02330fc 100644 --- a/zero_trust/gatewaylist_test.go +++ b/zero_trust/gatewaylist_test.go @@ -127,7 +127,7 @@ func TestGatewayListDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/gatewaylocation.go b/zero_trust/gatewaylocation.go index 46933e97b8f..19a458cb651 100644 --- a/zero_trust/gatewaylocation.go +++ b/zero_trust/gatewaylocation.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // GatewayLocationService contains methods and other services that help with @@ -84,7 +86,7 @@ func (r *GatewayLocationService) ListAutoPaging(ctx context.Context, query Gatew } // Deletes a configured Zero Trust Gateway location. -func (r *GatewayLocationService) Delete(ctx context.Context, locationID string, params GatewayLocationDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *GatewayLocationService) Delete(ctx context.Context, locationID string, params GatewayLocationDeleteParams, opts ...option.RequestOption) (res *GatewayLocationDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayLocationDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/gateway/locations/%s", params.AccountID, locationID) @@ -184,6 +186,23 @@ func (r LocationNetworkParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Union satisfied by [zero_trust.GatewayLocationDeleteResponseUnknown] or +// [shared.UnionString]. +type GatewayLocationDeleteResponseUnion interface { + ImplementsZeroTrustGatewayLocationDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*GatewayLocationDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type GatewayLocationNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // The name of the location. @@ -307,8 +326,8 @@ type GatewayLocationListParams struct { } type GatewayLocationDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GatewayLocationDeleteParams) MarshalJSON() (data []byte, err error) { @@ -316,9 +335,9 @@ func (r GatewayLocationDeleteParams) MarshalJSON() (data []byte, err error) { } type GatewayLocationDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result GatewayLocationDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success GatewayLocationDeleteResponseEnvelopeSuccess `json:"success,required"` JSON gatewayLocationDeleteResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/gatewaylocation_test.go b/zero_trust/gatewaylocation_test.go index d2f172935b2..e0b1ef6b2da 100644 --- a/zero_trust/gatewaylocation_test.go +++ b/zero_trust/gatewaylocation_test.go @@ -135,7 +135,7 @@ func TestGatewayLocationDelete(t *testing.T) { "ed35569b41ce4d1facfe683550f54086", zero_trust.GatewayLocationDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/gatewaylogging.go b/zero_trust/gatewaylogging.go index 19883d340f7..c8756ae34e6 100644 --- a/zero_trust/gatewaylogging.go +++ b/zero_trust/gatewaylogging.go @@ -83,6 +83,18 @@ func (r loggingSettingJSON) RawJSON() string { return r.raw } +type LoggingSettingParam struct { + // Redact personally identifiable information from activity logging (PII fields + // are: source IP, user email, user ID, device ID, URL, referrer, user agent). + RedactPii param.Field[bool] `json:"redact_pii"` + // Logging settings by rule type. + SettingsByRuleType param.Field[UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam] `json:"settings_by_rule_type"` +} + +func (r LoggingSettingParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // Logging settings by rule type. type UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7b struct { // Logging settings for DNS firewall. @@ -127,16 +139,12 @@ func (r UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam) MarshalJSON() (da } type GatewayLoggingUpdateParams struct { - AccountID param.Field[string] `path:"account_id,required"` - // Redact personally identifiable information from activity logging (PII fields - // are: source IP, user email, user ID, device ID, URL, referrer, user agent). - RedactPii param.Field[bool] `json:"redact_pii"` - // Logging settings by rule type. - SettingsByRuleType param.Field[UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam] `json:"settings_by_rule_type"` + AccountID param.Field[string] `path:"account_id,required"` + LoggingSetting LoggingSettingParam `json:"logging_setting,required"` } func (r GatewayLoggingUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.LoggingSetting) } type GatewayLoggingUpdateResponseEnvelope struct { diff --git a/zero_trust/gatewaylogging_test.go b/zero_trust/gatewaylogging_test.go index bdf8a2dff08..4393fea3505 100644 --- a/zero_trust/gatewaylogging_test.go +++ b/zero_trust/gatewaylogging_test.go @@ -30,12 +30,14 @@ func TestGatewayLoggingUpdateWithOptionalParams(t *testing.T) { ) _, err := client.ZeroTrust.Gateway.Logging.Update(context.TODO(), zero_trust.GatewayLoggingUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - RedactPii: cloudflare.F(true), - SettingsByRuleType: cloudflare.F(zero_trust.UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam{ - DNS: cloudflare.F[any](map[string]interface{}{}), - HTTP: cloudflare.F[any](map[string]interface{}{}), - L4: cloudflare.F[any](map[string]interface{}{}), - }), + LoggingSetting: zero_trust.LoggingSettingParam{ + RedactPii: cloudflare.F(true), + SettingsByRuleType: cloudflare.F(zero_trust.UnnamedSchemaRefE86eeb84b7e922c35cfb0031a6309f7bParam{ + DNS: cloudflare.F[any](map[string]interface{}{}), + HTTP: cloudflare.F[any](map[string]interface{}{}), + L4: cloudflare.F[any](map[string]interface{}{}), + }), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/zero_trust/gatewayproxyendpoint.go b/zero_trust/gatewayproxyendpoint.go index 4573007ac8b..46e21e372af 100644 --- a/zero_trust/gatewayproxyendpoint.go +++ b/zero_trust/gatewayproxyendpoint.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // GatewayProxyEndpointService contains methods and other services that help with @@ -71,7 +73,7 @@ func (r *GatewayProxyEndpointService) ListAutoPaging(ctx context.Context, query } // Deletes a configured Zero Trust Gateway proxy endpoint. -func (r *GatewayProxyEndpointService) Delete(ctx context.Context, proxyEndpointID string, params GatewayProxyEndpointDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *GatewayProxyEndpointService) Delete(ctx context.Context, proxyEndpointID string, params GatewayProxyEndpointDeleteParams, opts ...option.RequestOption) (res *GatewayProxyEndpointDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayProxyEndpointDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints/%s", params.AccountID, proxyEndpointID) @@ -146,6 +148,23 @@ func (r proxyEndpointJSON) RawJSON() string { return r.raw } +// Union satisfied by [zero_trust.GatewayProxyEndpointDeleteResponseUnknown] or +// [shared.UnionString]. +type GatewayProxyEndpointDeleteResponseUnion interface { + ImplementsZeroTrustGatewayProxyEndpointDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*GatewayProxyEndpointDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type GatewayProxyEndpointNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // A list of CIDRs to restrict ingress connections. @@ -206,8 +225,8 @@ type GatewayProxyEndpointListParams struct { } type GatewayProxyEndpointDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GatewayProxyEndpointDeleteParams) MarshalJSON() (data []byte, err error) { @@ -215,9 +234,9 @@ func (r GatewayProxyEndpointDeleteParams) MarshalJSON() (data []byte, err error) } type GatewayProxyEndpointDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result GatewayProxyEndpointDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success GatewayProxyEndpointDeleteResponseEnvelopeSuccess `json:"success,required"` JSON gatewayProxyEndpointDeleteResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/gatewayproxyendpoint_test.go b/zero_trust/gatewayproxyendpoint_test.go index 6c79ccacdd2..f522e8ef5a5 100644 --- a/zero_trust/gatewayproxyendpoint_test.go +++ b/zero_trust/gatewayproxyendpoint_test.go @@ -87,7 +87,7 @@ func TestGatewayProxyEndpointDelete(t *testing.T) { "ed35569b41ce4d1facfe683550f54086", zero_trust.GatewayProxyEndpointDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/gatewayrule.go b/zero_trust/gatewayrule.go index 715355573ed..1832d5f4cfe 100644 --- a/zero_trust/gatewayrule.go +++ b/zero_trust/gatewayrule.go @@ -6,6 +6,7 @@ import ( "context" "fmt" "net/http" + "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // GatewayRuleService contains methods and other services that help with @@ -84,7 +86,7 @@ func (r *GatewayRuleService) ListAutoPaging(ctx context.Context, query GatewayRu } // Deletes a Zero Trust Gateway rule. -func (r *GatewayRuleService) Delete(ctx context.Context, ruleID string, params GatewayRuleDeleteParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *GatewayRuleService) Delete(ctx context.Context, ruleID string, params GatewayRuleDeleteParams, opts ...option.RequestOption) (res *GatewayRuleDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayRuleDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/gateway/rules/%s", params.AccountID, ruleID) @@ -969,6 +971,23 @@ func (r ScheduleParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Union satisfied by [zero_trust.GatewayRuleDeleteResponseUnknown] or +// [shared.UnionString]. +type GatewayRuleDeleteResponseUnion interface { + ImplementsZeroTrustGatewayRuleDeleteResponseUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*GatewayRuleDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + type GatewayRuleNewParams struct { AccountID param.Field[string] `path:"account_id,required"` // The action to preform when the associated traffic, identity, and device posture @@ -1190,8 +1209,8 @@ type GatewayRuleListParams struct { } type GatewayRuleDeleteParams struct { - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r GatewayRuleDeleteParams) MarshalJSON() (data []byte, err error) { @@ -1199,9 +1218,9 @@ func (r GatewayRuleDeleteParams) MarshalJSON() (data []byte, err error) { } type GatewayRuleDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result GatewayRuleDeleteResponseUnion `json:"result,required"` // Whether the API call was successful Success GatewayRuleDeleteResponseEnvelopeSuccess `json:"success,required"` JSON gatewayRuleDeleteResponseEnvelopeJSON `json:"-"` diff --git a/zero_trust/gatewayrule_test.go b/zero_trust/gatewayrule_test.go index c553cb0f149..1b39f4bbb96 100644 --- a/zero_trust/gatewayrule_test.go +++ b/zero_trust/gatewayrule_test.go @@ -331,7 +331,7 @@ func TestGatewayRuleDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayRuleDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/identityprovider.go b/zero_trust/identityprovider.go index fa75c8b4eb8..058246c1a11 100644 --- a/zero_trust/identityprovider.go +++ b/zero_trust/identityprovider.go @@ -41,12 +41,12 @@ func (r *IdentityProviderService) New(ctx context.Context, params IdentityProvid var env IdentityProviderNewResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/access/identity_providers", accountOrZone, accountOrZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) @@ -63,12 +63,12 @@ func (r *IdentityProviderService) Update(ctx context.Context, uuid string, param var env IdentityProviderUpdateResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.getAccountID().Present { + if params.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.getAccountID() + accountOrZoneID = params.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.getZoneID() + accountOrZoneID = params.ZoneID } path := fmt.Sprintf("%s/%s/access/identity_providers/%s", accountOrZone, accountOrZoneID, uuid) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) @@ -273,6 +273,61 @@ func (r AzureADConfigPrompt) IsKnown() bool { return false } +type AzureADParam 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[AzureADConfigParam] `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[IdentityProviderType] `json:"type,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` +} + +func (r AzureADParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r AzureADParam) implementsZeroTrustIdentityProviderUnionParam() {} + +// 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 AzureADConfigParam 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[AzureADConfigPrompt] `json:"prompt"` + // Should Cloudflare try to load groups from your account + SupportGroups param.Field[bool] `json:"support_groups"` +} + +func (r AzureADConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + type GenericOAuthConfig struct { // Your OAuth Client ID ClientID string `json:"client_id"` @@ -1310,2666 +1365,1662 @@ func (r identityProviderAccessOnetimepinJSON) RawJSON() string { func (r IdentityProviderAccessOnetimepin) implementsZeroTrustIdentityProvider() {} -// 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 IdentityProviderType string +type IdentityProviderParam struct { + Config param.Field[interface{}] `json:"config"` + // The name of the identity provider, shown to users on the login page. + Name param.Field[string] `json:"name,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + // 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[IdentityProviderType] `json:"type,required"` +} -const ( - IdentityProviderTypeOnetimepin IdentityProviderType = "onetimepin" - IdentityProviderTypeAzureAD IdentityProviderType = "azureAD" - IdentityProviderTypeSAML IdentityProviderType = "saml" - IdentityProviderTypeCentrify IdentityProviderType = "centrify" - IdentityProviderTypeFacebook IdentityProviderType = "facebook" - IdentityProviderTypeGitHub IdentityProviderType = "github" - IdentityProviderTypeGoogleApps IdentityProviderType = "google-apps" - IdentityProviderTypeGoogle IdentityProviderType = "google" - IdentityProviderTypeLinkedin IdentityProviderType = "linkedin" - IdentityProviderTypeOIDC IdentityProviderType = "oidc" - IdentityProviderTypeOkta IdentityProviderType = "okta" - IdentityProviderTypeOnelogin IdentityProviderType = "onelogin" - IdentityProviderTypePingone IdentityProviderType = "pingone" - IdentityProviderTypeYandex IdentityProviderType = "yandex" -) +func (r IdentityProviderParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -func (r IdentityProviderType) IsKnown() bool { - switch r { - case IdentityProviderTypeOnetimepin, IdentityProviderTypeAzureAD, IdentityProviderTypeSAML, IdentityProviderTypeCentrify, IdentityProviderTypeFacebook, IdentityProviderTypeGitHub, IdentityProviderTypeGoogleApps, IdentityProviderTypeGoogle, IdentityProviderTypeLinkedin, IdentityProviderTypeOIDC, IdentityProviderTypeOkta, IdentityProviderTypeOnelogin, IdentityProviderTypePingone, IdentityProviderTypeYandex: - return true - } - return false +func (r IdentityProviderParam) implementsZeroTrustIdentityProviderUnionParam() {} + +// Satisfied by [zero_trust.AzureADParam], +// [zero_trust.IdentityProviderAccessCentrifyParam], +// [zero_trust.IdentityProviderAccessFacebookParam], +// [zero_trust.IdentityProviderAccessGitHubParam], +// [zero_trust.IdentityProviderAccessGoogleParam], +// [zero_trust.IdentityProviderAccessGoogleAppsParam], +// [zero_trust.IdentityProviderAccessLinkedinParam], +// [zero_trust.IdentityProviderAccessOIDCParam], +// [zero_trust.IdentityProviderAccessOktaParam], +// [zero_trust.IdentityProviderAccessOneloginParam], +// [zero_trust.IdentityProviderAccessPingoneParam], +// [zero_trust.IdentityProviderAccessSAMLParam], +// [zero_trust.IdentityProviderAccessYandexParam], +// [zero_trust.IdentityProviderAccessOnetimepinParam], [IdentityProviderParam]. +type IdentityProviderUnionParam interface { + implementsZeroTrustIdentityProviderUnionParam() } -// The configuration settings for enabling a System for Cross-Domain Identity -// Management (SCIM) with the identity provider. -type ScimConfig struct { - // A flag to enable or disable SCIM for the identity provider. - Enabled 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 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 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 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 bool `json:"user_deprovision"` - JSON scimConfigJSON `json:"-"` +type IdentityProviderAccessCentrifyParam 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[IdentityProviderAccessCentrifyConfigParam] `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[IdentityProviderType] `json:"type,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -// scimConfigJSON contains the JSON metadata for the struct [ScimConfig] -type scimConfigJSON struct { - Enabled apijson.Field - GroupMemberDeprovision apijson.Field - SeatDeprovision apijson.Field - Secret apijson.Field - UserDeprovision apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessCentrifyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *ScimConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r IdentityProviderAccessCentrifyParam) implementsZeroTrustIdentityProviderUnionParam() {} + +// 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 IdentityProviderAccessCentrifyConfigParam 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 scimConfigJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessCentrifyConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// The configuration settings for enabling a System for Cross-Domain Identity -// Management (SCIM) with the identity provider. -type ScimConfigParam 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"` +type IdentityProviderAccessFacebookParam 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[GenericOAuthConfigParam] `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[IdentityProviderType] `json:"type,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r ScimConfigParam) MarshalJSON() (data []byte, err error) { +func (r IdentityProviderAccessFacebookParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type IdentityProviderListResponse struct { - Config interface{} `json:"config"` - // UUID - ID string `json:"id"` +func (r IdentityProviderAccessFacebookParam) implementsZeroTrustIdentityProviderUnionParam() {} + +type IdentityProviderAccessGitHubParam 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[GenericOAuthConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` +} + +func (r IdentityProviderAccessGitHubParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r IdentityProviderAccessGitHubParam) implementsZeroTrustIdentityProviderUnionParam() {} + +type IdentityProviderAccessGoogleParam 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[IdentityProviderAccessGoogleConfigParam] `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 IdentityProviderType `json:"type,required"` - JSON identityProviderListResponseJSON `json:"-"` - union IdentityProviderListResponseUnion + Type param.Field[IdentityProviderType] `json:"type,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -// identityProviderListResponseJSON contains the JSON metadata for the struct -// [IdentityProviderListResponse] -type identityProviderListResponseJSON struct { - Config apijson.Field - ID apijson.Field - Name apijson.Field - ScimConfig apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessGoogleParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r identityProviderListResponseJSON) RawJSON() string { - return r.raw -} +func (r IdentityProviderAccessGoogleParam) implementsZeroTrustIdentityProviderUnionParam() {} -func (r *IdentityProviderListResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +// 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 IdentityProviderAccessGoogleConfigParam 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 IdentityProviderListResponse) AsUnion() IdentityProviderListResponseUnion { - return r.union +func (r IdentityProviderAccessGoogleConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Union satisfied by [zero_trust.AzureAD], -// [zero_trust.IdentityProviderListResponseAccessCentrify], -// [zero_trust.IdentityProviderListResponseAccessFacebook], -// [zero_trust.IdentityProviderListResponseAccessGitHub], -// [zero_trust.IdentityProviderListResponseAccessGoogle], -// [zero_trust.IdentityProviderListResponseAccessGoogleApps], -// [zero_trust.IdentityProviderListResponseAccessLinkedin], -// [zero_trust.IdentityProviderListResponseAccessOIDC], -// [zero_trust.IdentityProviderListResponseAccessOkta], -// [zero_trust.IdentityProviderListResponseAccessOnelogin], -// [zero_trust.IdentityProviderListResponseAccessPingone], -// [zero_trust.IdentityProviderListResponseAccessSAML] or -// [zero_trust.IdentityProviderListResponseAccessYandex]. -type IdentityProviderListResponseUnion interface { - implementsZeroTrustIdentityProviderListResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*IdentityProviderListResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(AzureAD{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessCentrify{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessFacebook{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessGitHub{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessGoogle{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessGoogleApps{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessLinkedin{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessOIDC{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessOkta{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessOnelogin{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessPingone{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessSAML{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(IdentityProviderListResponseAccessYandex{}), - }, - ) -} - -type IdentityProviderListResponseAccessCentrify struct { +type IdentityProviderAccessGoogleAppsParam 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 IdentityProviderListResponseAccessCentrifyConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessGoogleAppsConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessCentrifyJSON `json:"-"` -} - -// identityProviderListResponseAccessCentrifyJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessCentrify] -type identityProviderListResponseAccessCentrifyJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessCentrify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r identityProviderListResponseAccessCentrifyJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessGoogleAppsParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r IdentityProviderListResponseAccessCentrify) implementsZeroTrustIdentityProviderListResponse() { -} +func (r IdentityProviderAccessGoogleAppsParam) implementsZeroTrustIdentityProviderUnionParam() {} // 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 IdentityProviderListResponseAccessCentrifyConfig struct { - // Your centrify account url - CentrifyAccount string `json:"centrify_account"` - // Your centrify app id - CentrifyAppID string `json:"centrify_app_id"` +type IdentityProviderAccessGoogleAppsConfigParam struct { + // Your companies TLD + AppsDomain param.Field[string] `json:"apps_domain"` // Custom claims - Claims []string `json:"claims"` + Claims param.Field[[]string] `json:"claims"` // Your OAuth Client ID - ClientID string `json:"client_id"` + ClientID param.Field[string] `json:"client_id"` // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` + ClientSecret param.Field[string] `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - JSON identityProviderListResponseAccessCentrifyConfigJSON `json:"-"` -} - -// identityProviderListResponseAccessCentrifyConfigJSON contains the JSON metadata -// for the struct [IdentityProviderListResponseAccessCentrifyConfig] -type identityProviderListResponseAccessCentrifyConfigJSON struct { - CentrifyAccount apijson.Field - CentrifyAppID apijson.Field - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessCentrifyConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + EmailClaimName param.Field[string] `json:"email_claim_name"` } -func (r identityProviderListResponseAccessCentrifyConfigJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessGoogleAppsConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type IdentityProviderListResponseAccessFacebook struct { +type IdentityProviderAccessLinkedinParam 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 GenericOAuthConfig `json:"config,required"` + Config param.Field[GenericOAuthConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessFacebookJSON `json:"-"` -} - -// identityProviderListResponseAccessFacebookJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessFacebook] -type identityProviderListResponseAccessFacebookJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessFacebook) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r identityProviderListResponseAccessFacebookJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessLinkedinParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r IdentityProviderListResponseAccessFacebook) implementsZeroTrustIdentityProviderListResponse() { -} +func (r IdentityProviderAccessLinkedinParam) implementsZeroTrustIdentityProviderUnionParam() {} -type IdentityProviderListResponseAccessGitHub struct { +type IdentityProviderAccessOIDCParam 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 GenericOAuthConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessOIDCConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessGitHubJSON `json:"-"` + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -// identityProviderListResponseAccessGitHubJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessGitHub] -type identityProviderListResponseAccessGitHubJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessOIDCParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderListResponseAccessGitHub) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r IdentityProviderAccessOIDCParam) implementsZeroTrustIdentityProviderUnionParam() {} -func (r identityProviderListResponseAccessGitHubJSON) RawJSON() string { - return r.raw +// 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 IdentityProviderAccessOIDCConfigParam 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 IdentityProviderListResponseAccessGitHub) implementsZeroTrustIdentityProviderListResponse() {} +func (r IdentityProviderAccessOIDCConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} -type IdentityProviderListResponseAccessGoogle struct { +type IdentityProviderAccessOktaParam 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 IdentityProviderListResponseAccessGoogleConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessOktaConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessGoogleJSON `json:"-"` -} - -// identityProviderListResponseAccessGoogleJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessGoogle] -type identityProviderListResponseAccessGoogleJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessGoogle) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r identityProviderListResponseAccessGoogleJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessOktaParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r IdentityProviderListResponseAccessGoogle) implementsZeroTrustIdentityProviderListResponse() {} +func (r IdentityProviderAccessOktaParam) implementsZeroTrustIdentityProviderUnionParam() {} // 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 IdentityProviderListResponseAccessGoogleConfig struct { +type IdentityProviderAccessOktaConfigParam struct { + // Your okta authorization server id + AuthorizationServerID param.Field[string] `json:"authorization_server_id"` // Custom claims - Claims []string `json:"claims"` + Claims param.Field[[]string] `json:"claims"` // Your OAuth Client ID - ClientID string `json:"client_id"` + ClientID param.Field[string] `json:"client_id"` // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` + ClientSecret param.Field[string] `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - JSON identityProviderListResponseAccessGoogleConfigJSON `json:"-"` -} - -// identityProviderListResponseAccessGoogleConfigJSON contains the JSON metadata -// for the struct [IdentityProviderListResponseAccessGoogleConfig] -type identityProviderListResponseAccessGoogleConfigJSON struct { - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessGoogleConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your okta account url + OktaAccount param.Field[string] `json:"okta_account"` } -func (r identityProviderListResponseAccessGoogleConfigJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessOktaConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type IdentityProviderListResponseAccessGoogleApps struct { +type IdentityProviderAccessOneloginParam 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 IdentityProviderListResponseAccessGoogleAppsConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessOneloginConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessGoogleAppsJSON `json:"-"` -} - -// identityProviderListResponseAccessGoogleAppsJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessGoogleApps] -type identityProviderListResponseAccessGoogleAppsJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessGoogleApps) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r identityProviderListResponseAccessGoogleAppsJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessOneloginParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r IdentityProviderListResponseAccessGoogleApps) implementsZeroTrustIdentityProviderListResponse() { -} +func (r IdentityProviderAccessOneloginParam) implementsZeroTrustIdentityProviderUnionParam() {} // 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 IdentityProviderListResponseAccessGoogleAppsConfig struct { - // Your companies TLD - AppsDomain string `json:"apps_domain"` +type IdentityProviderAccessOneloginConfigParam struct { // Custom claims - Claims []string `json:"claims"` + Claims param.Field[[]string] `json:"claims"` // Your OAuth Client ID - ClientID string `json:"client_id"` + ClientID param.Field[string] `json:"client_id"` // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` + ClientSecret param.Field[string] `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - JSON identityProviderListResponseAccessGoogleAppsConfigJSON `json:"-"` -} - -// identityProviderListResponseAccessGoogleAppsConfigJSON contains the JSON -// metadata for the struct [IdentityProviderListResponseAccessGoogleAppsConfig] -type identityProviderListResponseAccessGoogleAppsConfigJSON struct { - AppsDomain apijson.Field - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + EmailClaimName param.Field[string] `json:"email_claim_name"` + // Your OneLogin account url + OneloginAccount param.Field[string] `json:"onelogin_account"` } -func (r identityProviderListResponseAccessGoogleAppsConfigJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessOneloginConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type IdentityProviderListResponseAccessLinkedin struct { +type IdentityProviderAccessPingoneParam 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 GenericOAuthConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessPingoneConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessLinkedinJSON `json:"-"` + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -// identityProviderListResponseAccessLinkedinJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessLinkedin] -type identityProviderListResponseAccessLinkedinJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessPingoneParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderListResponseAccessLinkedin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r IdentityProviderAccessPingoneParam) implementsZeroTrustIdentityProviderUnionParam() {} -func (r identityProviderListResponseAccessLinkedinJSON) RawJSON() string { - return r.raw +// 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 IdentityProviderAccessPingoneConfigParam 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 IdentityProviderListResponseAccessLinkedin) implementsZeroTrustIdentityProviderListResponse() { +func (r IdentityProviderAccessPingoneConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type IdentityProviderListResponseAccessOIDC struct { +type IdentityProviderAccessSAMLParam 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 IdentityProviderListResponseAccessOIDCConfig `json:"config,required"` + Config param.Field[IdentityProviderAccessSAMLConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessOIDCJSON `json:"-"` -} - -// identityProviderListResponseAccessOIDCJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessOIDC] -type identityProviderListResponseAccessOIDCJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessOIDC) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r identityProviderListResponseAccessOIDCJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessSAMLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r IdentityProviderListResponseAccessOIDC) implementsZeroTrustIdentityProviderListResponse() {} +func (r IdentityProviderAccessSAMLParam) implementsZeroTrustIdentityProviderUnionParam() {} // 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 IdentityProviderListResponseAccessOIDCConfig struct { - // The authorization_endpoint URL of your IdP - AuthURL string `json:"auth_url"` - // The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens - CERTsURL string `json:"certs_url"` - // Custom claims - Claims []string `json:"claims"` - // Your OAuth Client ID - ClientID string `json:"client_id"` - // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` - // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - // OAuth scopes - Scopes []string `json:"scopes"` - // The token_endpoint URL of your IdP - TokenURL string `json:"token_url"` - JSON identityProviderListResponseAccessOIDCConfigJSON `json:"-"` +type IdentityProviderAccessSAMLConfigParam 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[[]IdentityProviderAccessSAMLConfigHeaderAttributeParam] `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"` } -// identityProviderListResponseAccessOIDCConfigJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessOIDCConfig] -type identityProviderListResponseAccessOIDCConfigJSON struct { - AuthURL apijson.Field - CERTsURL apijson.Field - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - Scopes apijson.Field - TokenURL apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessSAMLConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderListResponseAccessOIDCConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type IdentityProviderAccessSAMLConfigHeaderAttributeParam 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 identityProviderListResponseAccessOIDCConfigJSON) RawJSON() string { - return r.raw +func (r IdentityProviderAccessSAMLConfigHeaderAttributeParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type IdentityProviderListResponseAccessOkta struct { +type IdentityProviderAccessYandexParam 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 IdentityProviderListResponseAccessOktaConfig `json:"config,required"` + Config param.Field[GenericOAuthConfigParam] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessOktaJSON `json:"-"` -} - -// identityProviderListResponseAccessOktaJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessOkta] -type identityProviderListResponseAccessOktaJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -func (r *IdentityProviderListResponseAccessOkta) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r IdentityProviderAccessYandexParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r identityProviderListResponseAccessOktaJSON) RawJSON() string { - return r.raw -} +func (r IdentityProviderAccessYandexParam) implementsZeroTrustIdentityProviderUnionParam() {} -func (r IdentityProviderListResponseAccessOkta) implementsZeroTrustIdentityProviderListResponse() {} - -// 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 IdentityProviderListResponseAccessOktaConfig struct { - // Your okta authorization server id - AuthorizationServerID string `json:"authorization_server_id"` - // Custom claims - Claims []string `json:"claims"` - // Your OAuth Client ID - ClientID string `json:"client_id"` - // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` - // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - // Your okta account url - OktaAccount string `json:"okta_account"` - JSON identityProviderListResponseAccessOktaConfigJSON `json:"-"` -} - -// identityProviderListResponseAccessOktaConfigJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessOktaConfig] -type identityProviderListResponseAccessOktaConfigJSON struct { - AuthorizationServerID apijson.Field - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - OktaAccount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessOktaConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessOktaConfigJSON) RawJSON() string { - return r.raw -} - -type IdentityProviderListResponseAccessOnelogin struct { +type IdentityProviderAccessOnetimepinParam 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 IdentityProviderListResponseAccessOneloginConfig `json:"config,required"` + Config param.Field[interface{}] `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name string `json:"name,required"` + 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` + Type param.Field[IdentityProviderType] `json:"type,required"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessOneloginJSON `json:"-"` + ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` } -// identityProviderListResponseAccessOneloginJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessOnelogin] -type identityProviderListResponseAccessOneloginJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r IdentityProviderAccessOnetimepinParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *IdentityProviderListResponseAccessOnelogin) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +func (r IdentityProviderAccessOnetimepinParam) implementsZeroTrustIdentityProviderUnionParam() {} -func (r identityProviderListResponseAccessOneloginJSON) 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 IdentityProviderType string -func (r IdentityProviderListResponseAccessOnelogin) implementsZeroTrustIdentityProviderListResponse() { +const ( + IdentityProviderTypeOnetimepin IdentityProviderType = "onetimepin" + IdentityProviderTypeAzureAD IdentityProviderType = "azureAD" + IdentityProviderTypeSAML IdentityProviderType = "saml" + IdentityProviderTypeCentrify IdentityProviderType = "centrify" + IdentityProviderTypeFacebook IdentityProviderType = "facebook" + IdentityProviderTypeGitHub IdentityProviderType = "github" + IdentityProviderTypeGoogleApps IdentityProviderType = "google-apps" + IdentityProviderTypeGoogle IdentityProviderType = "google" + IdentityProviderTypeLinkedin IdentityProviderType = "linkedin" + IdentityProviderTypeOIDC IdentityProviderType = "oidc" + IdentityProviderTypeOkta IdentityProviderType = "okta" + IdentityProviderTypeOnelogin IdentityProviderType = "onelogin" + IdentityProviderTypePingone IdentityProviderType = "pingone" + IdentityProviderTypeYandex IdentityProviderType = "yandex" +) + +func (r IdentityProviderType) IsKnown() bool { + switch r { + case IdentityProviderTypeOnetimepin, IdentityProviderTypeAzureAD, IdentityProviderTypeSAML, IdentityProviderTypeCentrify, IdentityProviderTypeFacebook, IdentityProviderTypeGitHub, IdentityProviderTypeGoogleApps, IdentityProviderTypeGoogle, IdentityProviderTypeLinkedin, IdentityProviderTypeOIDC, IdentityProviderTypeOkta, IdentityProviderTypeOnelogin, IdentityProviderTypePingone, IdentityProviderTypeYandex: + return true + } + return false } -// 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 IdentityProviderListResponseAccessOneloginConfig struct { - // Custom claims - Claims []string `json:"claims"` - // Your OAuth Client ID - ClientID string `json:"client_id"` - // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` - // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - // Your OneLogin account url - OneloginAccount string `json:"onelogin_account"` - JSON identityProviderListResponseAccessOneloginConfigJSON `json:"-"` +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ScimConfig struct { + // A flag to enable or disable SCIM for the identity provider. + Enabled 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 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 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 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 bool `json:"user_deprovision"` + JSON scimConfigJSON `json:"-"` } -// identityProviderListResponseAccessOneloginConfigJSON contains the JSON metadata -// for the struct [IdentityProviderListResponseAccessOneloginConfig] -type identityProviderListResponseAccessOneloginConfigJSON struct { - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - OneloginAccount apijson.Field - raw string - ExtraFields map[string]apijson.Field +// scimConfigJSON contains the JSON metadata for the struct [ScimConfig] +type scimConfigJSON struct { + Enabled apijson.Field + GroupMemberDeprovision apijson.Field + SeatDeprovision apijson.Field + Secret apijson.Field + UserDeprovision apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *IdentityProviderListResponseAccessOneloginConfig) UnmarshalJSON(data []byte) (err error) { +func (r *ScimConfig) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r identityProviderListResponseAccessOneloginConfigJSON) RawJSON() string { +func (r scimConfigJSON) RawJSON() string { return r.raw } -type IdentityProviderListResponseAccessPingone 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 IdentityProviderListResponseAccessPingoneConfig `json:"config,required"` +// The configuration settings for enabling a System for Cross-Domain Identity +// Management (SCIM) with the identity provider. +type ScimConfigParam 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 ScimConfigParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IdentityProviderListResponse struct { + Config interface{} `json:"config"` + // UUID + ID string `json:"id"` // The name of the identity provider, shown to users on the login page. Name string `json:"name,required"` + // The configuration settings for enabling a System for Cross-Domain Identity + // Management (SCIM) with the identity provider. + ScimConfig ScimConfig `json:"scim_config"` // 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` - // The configuration settings for enabling a System for Cross-Domain Identity - // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessPingoneJSON `json:"-"` + Type IdentityProviderType `json:"type,required"` + JSON identityProviderListResponseJSON `json:"-"` + union IdentityProviderListResponseUnion } -// identityProviderListResponseAccessPingoneJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessPingone] -type identityProviderListResponseAccessPingoneJSON struct { +// identityProviderListResponseJSON contains the JSON metadata for the struct +// [IdentityProviderListResponse] +type identityProviderListResponseJSON struct { Config apijson.Field - Name apijson.Field - Type apijson.Field ID apijson.Field + Name apijson.Field ScimConfig apijson.Field + Type apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *IdentityProviderListResponseAccessPingone) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessPingoneJSON) RawJSON() string { +func (r identityProviderListResponseJSON) RawJSON() string { return r.raw } -func (r IdentityProviderListResponseAccessPingone) implementsZeroTrustIdentityProviderListResponse() { +func (r *IdentityProviderListResponse) UnmarshalJSON(data []byte) (err error) { + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -// 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 IdentityProviderListResponseAccessPingoneConfig struct { - // Custom claims - Claims []string `json:"claims"` - // Your OAuth Client ID - ClientID string `json:"client_id"` - // Your OAuth Client Secret - ClientSecret string `json:"client_secret"` - // The claim name for email in the id_token response. - EmailClaimName string `json:"email_claim_name"` - // Your PingOne environment identifier - PingEnvID string `json:"ping_env_id"` - JSON identityProviderListResponseAccessPingoneConfigJSON `json:"-"` +func (r IdentityProviderListResponse) AsUnion() IdentityProviderListResponseUnion { + return r.union } -// identityProviderListResponseAccessPingoneConfigJSON contains the JSON metadata -// for the struct [IdentityProviderListResponseAccessPingoneConfig] -type identityProviderListResponseAccessPingoneConfigJSON struct { - Claims apijson.Field - ClientID apijson.Field - ClientSecret apijson.Field - EmailClaimName apijson.Field - PingEnvID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessPingoneConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessPingoneConfigJSON) RawJSON() string { - return r.raw -} - -type IdentityProviderListResponseAccessSAML 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 IdentityProviderListResponseAccessSAMLConfig `json:"config,required"` - // The name of the identity provider, shown to users on the login page. - Name 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` - // The configuration settings for enabling a System for Cross-Domain Identity - // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessSAMLJSON `json:"-"` -} - -// identityProviderListResponseAccessSAMLJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessSAML] -type identityProviderListResponseAccessSAMLJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessSAML) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessSAMLJSON) RawJSON() string { - return r.raw -} - -func (r IdentityProviderListResponseAccessSAML) implementsZeroTrustIdentityProviderListResponse() {} - -// 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 IdentityProviderListResponseAccessSAMLConfig 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 []string `json:"attributes"` - // The attribute name for email in the SAML response. - EmailAttributeName string `json:"email_attribute_name"` - // Add a list of attribute names that will be returned in the response header from - // the Access callback. - HeaderAttributes []IdentityProviderListResponseAccessSAMLConfigHeaderAttribute `json:"header_attributes"` - // X509 certificate to verify the signature in the SAML authentication response - IDPPublicCERTs []string `json:"idp_public_certs"` - // IdP Entity ID or Issuer URL - IssuerURL 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 bool `json:"sign_request"` - // URL to send the SAML authentication requests to - SSOTargetURL string `json:"sso_target_url"` - JSON identityProviderListResponseAccessSAMLConfigJSON `json:"-"` -} - -// identityProviderListResponseAccessSAMLConfigJSON contains the JSON metadata for -// the struct [IdentityProviderListResponseAccessSAMLConfig] -type identityProviderListResponseAccessSAMLConfigJSON struct { - Attributes apijson.Field - EmailAttributeName apijson.Field - HeaderAttributes apijson.Field - IDPPublicCERTs apijson.Field - IssuerURL apijson.Field - SignRequest apijson.Field - SSOTargetURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessSAMLConfig) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessSAMLConfigJSON) RawJSON() string { - return r.raw -} - -type IdentityProviderListResponseAccessSAMLConfigHeaderAttribute struct { - // attribute name from the IDP - AttributeName string `json:"attribute_name"` - // header that will be added on the request to the origin - HeaderName string `json:"header_name"` - JSON identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON `json:"-"` -} - -// identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON contains the -// JSON metadata for the struct -// [IdentityProviderListResponseAccessSAMLConfigHeaderAttribute] -type identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON struct { - AttributeName apijson.Field - HeaderName apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessSAMLConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON) RawJSON() string { - return r.raw -} - -type IdentityProviderListResponseAccessYandex 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 GenericOAuthConfig `json:"config,required"` - // The name of the identity provider, shown to users on the login page. - Name 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 IdentityProviderType `json:"type,required"` - // UUID - ID string `json:"id"` - // The configuration settings for enabling a System for Cross-Domain Identity - // Management (SCIM) with the identity provider. - ScimConfig ScimConfig `json:"scim_config"` - JSON identityProviderListResponseAccessYandexJSON `json:"-"` -} - -// identityProviderListResponseAccessYandexJSON contains the JSON metadata for the -// struct [IdentityProviderListResponseAccessYandex] -type identityProviderListResponseAccessYandexJSON struct { - Config apijson.Field - Name apijson.Field - Type apijson.Field - ID apijson.Field - ScimConfig apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderListResponseAccessYandex) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderListResponseAccessYandexJSON) RawJSON() string { - return r.raw -} - -func (r IdentityProviderListResponseAccessYandex) implementsZeroTrustIdentityProviderListResponse() {} - -type IdentityProviderDeleteResponse struct { - // UUID - ID string `json:"id"` - JSON identityProviderDeleteResponseJSON `json:"-"` -} - -// identityProviderDeleteResponseJSON contains the JSON metadata for the struct -// [IdentityProviderDeleteResponse] -type identityProviderDeleteResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityProviderDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityProviderDeleteResponseJSON) RawJSON() string { - return r.raw -} - -// This interface is a union satisfied by one of the following: -// [IdentityProviderNewParamsAzureAD], [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 IdentityProviderNewParamsAzureAD 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[IdentityProviderNewParamsAzureADConfig] `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[IdentityProviderType] `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[ScimConfigParam] `json:"scim_config"` -} - -func (r IdentityProviderNewParamsAzureAD) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r IdentityProviderNewParamsAzureAD) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r IdentityProviderNewParamsAzureAD) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (IdentityProviderNewParamsAzureAD) 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 IdentityProviderNewParamsAzureADConfig 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[IdentityProviderNewParamsAzureADConfigPrompt] `json:"prompt"` - // Should Cloudflare try to load groups from your account - SupportGroups param.Field[bool] `json:"support_groups"` -} - -func (r IdentityProviderNewParamsAzureADConfig) 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 IdentityProviderNewParamsAzureADConfigPrompt string - -const ( - IdentityProviderNewParamsAzureADConfigPromptLogin IdentityProviderNewParamsAzureADConfigPrompt = "login" - IdentityProviderNewParamsAzureADConfigPromptSelectAccount IdentityProviderNewParamsAzureADConfigPrompt = "select_account" - IdentityProviderNewParamsAzureADConfigPromptNone IdentityProviderNewParamsAzureADConfigPrompt = "none" -) - -func (r IdentityProviderNewParamsAzureADConfigPrompt) IsKnown() bool { - switch r { - case IdentityProviderNewParamsAzureADConfigPromptLogin, IdentityProviderNewParamsAzureADConfigPromptSelectAccount, IdentityProviderNewParamsAzureADConfigPromptNone: - return true - } - return false -} - -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[IdentityProviderType] `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[ScimConfigParam] `json:"scim_config"` -} - -func (r IdentityProviderNewParamsAccessCentrify) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r IdentityProviderNewParamsAccessCentrify) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r IdentityProviderNewParamsAccessCentrify) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (IdentityProviderNewParamsAccessCentrify) 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 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 IdentityProviderNewParamsAccessCentrifyConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(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[GenericOAuthConfigParam] `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[IdentityProviderType] `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[ScimConfigParam] `json:"scim_config"` -} - -func (r IdentityProviderNewParamsAccessFacebook) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r IdentityProviderNewParamsAccessFacebook) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r IdentityProviderNewParamsAccessFacebook) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (IdentityProviderNewParamsAccessFacebook) ImplementsIdentityProviderNewParams() { - -} - -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[GenericOAuthConfigParam] `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[IdentityProviderType] `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[ScimConfigParam] `json:"scim_config"` -} - -func (r IdentityProviderNewParamsAccessGitHub) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r IdentityProviderNewParamsAccessGitHub) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r IdentityProviderNewParamsAccessGitHub) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (IdentityProviderNewParamsAccessGitHub) ImplementsIdentityProviderNewParams() { - -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[GenericOAuthConfigParam] `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[IdentityProviderType] `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[ScimConfigParam] `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() { - -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[IdentityProviderType] `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[ScimConfigParam] `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) -} - -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[GenericOAuthConfigParam] `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[IdentityProviderType] `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[ScimConfigParam] `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() { - -} - -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[IdentityProviderType] `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[ScimConfigParam] `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() { - -} - -type IdentityProviderNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IdentityProvider `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 -} - -// 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: -// [IdentityProviderUpdateParamsAzureAD], -// [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 IdentityProviderUpdateParamsAzureAD 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[IdentityProviderUpdateParamsAzureADConfig] `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[IdentityProviderType] `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[ScimConfigParam] `json:"scim_config"` -} - -func (r IdentityProviderUpdateParamsAzureAD) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r IdentityProviderUpdateParamsAzureAD) getAccountID() param.Field[string] { - return r.AccountID -} - -func (r IdentityProviderUpdateParamsAzureAD) getZoneID() param.Field[string] { - return r.ZoneID -} - -func (IdentityProviderUpdateParamsAzureAD) 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 IdentityProviderUpdateParamsAzureADConfig 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[IdentityProviderUpdateParamsAzureADConfigPrompt] `json:"prompt"` - // Should Cloudflare try to load groups from your account - SupportGroups param.Field[bool] `json:"support_groups"` -} - -func (r IdentityProviderUpdateParamsAzureADConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Union satisfied by [zero_trust.AzureAD], +// [zero_trust.IdentityProviderListResponseAccessCentrify], +// [zero_trust.IdentityProviderListResponseAccessFacebook], +// [zero_trust.IdentityProviderListResponseAccessGitHub], +// [zero_trust.IdentityProviderListResponseAccessGoogle], +// [zero_trust.IdentityProviderListResponseAccessGoogleApps], +// [zero_trust.IdentityProviderListResponseAccessLinkedin], +// [zero_trust.IdentityProviderListResponseAccessOIDC], +// [zero_trust.IdentityProviderListResponseAccessOkta], +// [zero_trust.IdentityProviderListResponseAccessOnelogin], +// [zero_trust.IdentityProviderListResponseAccessPingone], +// [zero_trust.IdentityProviderListResponseAccessSAML] or +// [zero_trust.IdentityProviderListResponseAccessYandex]. +type IdentityProviderListResponseUnion interface { + implementsZeroTrustIdentityProviderListResponse() } -// 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 IdentityProviderUpdateParamsAzureADConfigPrompt string - -const ( - IdentityProviderUpdateParamsAzureADConfigPromptLogin IdentityProviderUpdateParamsAzureADConfigPrompt = "login" - IdentityProviderUpdateParamsAzureADConfigPromptSelectAccount IdentityProviderUpdateParamsAzureADConfigPrompt = "select_account" - IdentityProviderUpdateParamsAzureADConfigPromptNone IdentityProviderUpdateParamsAzureADConfigPrompt = "none" -) - -func (r IdentityProviderUpdateParamsAzureADConfigPrompt) IsKnown() bool { - switch r { - case IdentityProviderUpdateParamsAzureADConfigPromptLogin, IdentityProviderUpdateParamsAzureADConfigPromptSelectAccount, IdentityProviderUpdateParamsAzureADConfigPromptNone: - return true - } - return false +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*IdentityProviderListResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(AzureAD{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessCentrify{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessFacebook{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessGitHub{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessGoogle{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessGoogleApps{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessLinkedin{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessOIDC{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessOkta{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessOnelogin{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessPingone{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessSAML{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(IdentityProviderListResponseAccessYandex{}), + }, + ) } -type IdentityProviderUpdateParamsAccessCentrify struct { +type IdentityProviderListResponseAccessCentrify 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"` + Config IdentityProviderListResponseAccessCentrifyConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessCentrifyJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessCentrify) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessCentrifyJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessCentrify] +type identityProviderListResponseAccessCentrifyJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessCentrify) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessCentrify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessCentrify) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessCentrifyJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessCentrify) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessCentrify) implementsZeroTrustIdentityProviderListResponse() { } // 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 { +type IdentityProviderListResponseAccessCentrifyConfig struct { // Your centrify account url - CentrifyAccount param.Field[string] `json:"centrify_account"` + CentrifyAccount string `json:"centrify_account"` // Your centrify app id - CentrifyAppID param.Field[string] `json:"centrify_app_id"` + CentrifyAppID string `json:"centrify_app_id"` // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` + JSON identityProviderListResponseAccessCentrifyConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessCentrifyConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessCentrifyConfigJSON contains the JSON metadata +// for the struct [IdentityProviderListResponseAccessCentrifyConfig] +type identityProviderListResponseAccessCentrifyConfigJSON struct { + CentrifyAccount apijson.Field + CentrifyAppID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessCentrifyConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -type IdentityProviderUpdateParamsAccessFacebook struct { +func (r identityProviderListResponseAccessCentrifyConfigJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderListResponseAccessFacebook 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[GenericOAuthConfigParam] `json:"config,required"` + Config GenericOAuthConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessFacebookJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessFacebook) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessFacebookJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessFacebook] +type identityProviderListResponseAccessFacebookJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessFacebook) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessFacebook) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessFacebook) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessFacebookJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessFacebook) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessFacebook) implementsZeroTrustIdentityProviderListResponse() { } -type IdentityProviderUpdateParamsAccessGitHub struct { +type IdentityProviderListResponseAccessGitHub 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[GenericOAuthConfigParam] `json:"config,required"` + Config GenericOAuthConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessGitHubJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessGitHub) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessGitHubJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessGitHub] +type identityProviderListResponseAccessGitHubJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessGitHub) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessGitHub) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessGitHub) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessGitHubJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessGitHub) ImplementsIdentityProviderUpdateParams() { - -} +func (r IdentityProviderListResponseAccessGitHub) implementsZeroTrustIdentityProviderListResponse() {} -type IdentityProviderUpdateParamsAccessGoogle struct { +type IdentityProviderListResponseAccessGoogle 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"` + Config IdentityProviderListResponseAccessGoogleConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessGoogleJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessGoogle) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessGoogleJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessGoogle] +type identityProviderListResponseAccessGoogleJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessGoogle) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessGoogle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessGoogle) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessGoogleJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessGoogle) ImplementsIdentityProviderUpdateParams() { - -} +func (r IdentityProviderListResponseAccessGoogle) implementsZeroTrustIdentityProviderListResponse() {} // 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 { +type IdentityProviderListResponseAccessGoogleConfig struct { // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` + JSON identityProviderListResponseAccessGoogleConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessGoogleConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessGoogleConfigJSON contains the JSON metadata +// for the struct [IdentityProviderListResponseAccessGoogleConfig] +type identityProviderListResponseAccessGoogleConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessGoogleConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -type IdentityProviderUpdateParamsAccessGoogleApps struct { +func (r identityProviderListResponseAccessGoogleConfigJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderListResponseAccessGoogleApps 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"` + Config IdentityProviderListResponseAccessGoogleAppsConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessGoogleAppsJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessGoogleApps) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessGoogleAppsJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessGoogleApps] +type identityProviderListResponseAccessGoogleAppsJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessGoogleApps) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessGoogleApps) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessGoogleApps) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessGoogleAppsJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessGoogleApps) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessGoogleApps) implementsZeroTrustIdentityProviderListResponse() { } // 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 { +type IdentityProviderListResponseAccessGoogleAppsConfig struct { // Your companies TLD - AppsDomain param.Field[string] `json:"apps_domain"` + AppsDomain string `json:"apps_domain"` // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` + JSON identityProviderListResponseAccessGoogleAppsConfigJSON `json:"-"` +} + +// identityProviderListResponseAccessGoogleAppsConfigJSON contains the JSON +// metadata for the struct [IdentityProviderListResponseAccessGoogleAppsConfig] +type identityProviderListResponseAccessGoogleAppsConfigJSON struct { + AppsDomain apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessGoogleAppsConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r *IdentityProviderListResponseAccessGoogleAppsConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessGoogleAppsConfigJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessLinkedin struct { +type IdentityProviderListResponseAccessLinkedin 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[GenericOAuthConfigParam] `json:"config,required"` + Config GenericOAuthConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessLinkedinJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessLinkedin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessLinkedinJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessLinkedin] +type identityProviderListResponseAccessLinkedinJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessLinkedin) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessLinkedin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessLinkedin) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessLinkedinJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessLinkedin) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessLinkedin) implementsZeroTrustIdentityProviderListResponse() { } -type IdentityProviderUpdateParamsAccessOIDC struct { +type IdentityProviderListResponseAccessOIDC 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"` + Config IdentityProviderListResponseAccessOIDCConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessOIDCJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOIDC) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOIDCJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessOIDC] +type identityProviderListResponseAccessOIDCJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessOIDC) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessOIDC) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessOIDC) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessOIDCJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessOIDC) ImplementsIdentityProviderUpdateParams() { - -} +func (r IdentityProviderListResponseAccessOIDC) implementsZeroTrustIdentityProviderListResponse() {} // 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 { +type IdentityProviderListResponseAccessOIDCConfig struct { // The authorization_endpoint URL of your IdP - AuthURL param.Field[string] `json:"auth_url"` + AuthURL 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"` + CERTsURL string `json:"certs_url"` // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` // OAuth scopes - Scopes param.Field[[]string] `json:"scopes"` + Scopes []string `json:"scopes"` // The token_endpoint URL of your IdP - TokenURL param.Field[string] `json:"token_url"` + TokenURL string `json:"token_url"` + JSON identityProviderListResponseAccessOIDCConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOIDCConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOIDCConfigJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessOIDCConfig] +type identityProviderListResponseAccessOIDCConfigJSON struct { + AuthURL apijson.Field + CERTsURL apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + Scopes apijson.Field + TokenURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessOIDCConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessOIDCConfigJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessOkta struct { +type IdentityProviderListResponseAccessOkta 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"` + Config IdentityProviderListResponseAccessOktaConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessOktaJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOkta) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOktaJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessOkta] +type identityProviderListResponseAccessOktaJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessOkta) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessOkta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessOkta) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessOktaJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessOkta) ImplementsIdentityProviderUpdateParams() { - -} +func (r IdentityProviderListResponseAccessOkta) implementsZeroTrustIdentityProviderListResponse() {} // 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 { +type IdentityProviderListResponseAccessOktaConfig struct { // Your okta authorization server id - AuthorizationServerID param.Field[string] `json:"authorization_server_id"` + AuthorizationServerID string `json:"authorization_server_id"` // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` // Your okta account url - OktaAccount param.Field[string] `json:"okta_account"` + OktaAccount string `json:"okta_account"` + JSON identityProviderListResponseAccessOktaConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOktaConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOktaConfigJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessOktaConfig] +type identityProviderListResponseAccessOktaConfigJSON struct { + AuthorizationServerID apijson.Field + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OktaAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type IdentityProviderUpdateParamsAccessOnelogin struct { +func (r *IdentityProviderListResponseAccessOktaConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessOktaConfigJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderListResponseAccessOnelogin 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"` + Config IdentityProviderListResponseAccessOneloginConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessOneloginJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOnelogin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOneloginJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessOnelogin] +type identityProviderListResponseAccessOneloginJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessOnelogin) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessOnelogin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessOnelogin) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessOneloginJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessOnelogin) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessOnelogin) implementsZeroTrustIdentityProviderListResponse() { } // 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 { +type IdentityProviderListResponseAccessOneloginConfig struct { // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` // Your OneLogin account url - OneloginAccount param.Field[string] `json:"onelogin_account"` + OneloginAccount string `json:"onelogin_account"` + JSON identityProviderListResponseAccessOneloginConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessOneloginConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessOneloginConfigJSON contains the JSON metadata +// for the struct [IdentityProviderListResponseAccessOneloginConfig] +type identityProviderListResponseAccessOneloginConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + OneloginAccount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessOneloginConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessOneloginConfigJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessPingone struct { +type IdentityProviderListResponseAccessPingone 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"` + Config IdentityProviderListResponseAccessPingoneConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessPingoneJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessPingone) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessPingoneJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessPingone] +type identityProviderListResponseAccessPingoneJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessPingone) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessPingone) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessPingone) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessPingoneJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessPingone) ImplementsIdentityProviderUpdateParams() { - +func (r IdentityProviderListResponseAccessPingone) implementsZeroTrustIdentityProviderListResponse() { } // 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 { +type IdentityProviderListResponseAccessPingoneConfig struct { // Custom claims - Claims param.Field[[]string] `json:"claims"` + Claims []string `json:"claims"` // Your OAuth Client ID - ClientID param.Field[string] `json:"client_id"` + ClientID string `json:"client_id"` // Your OAuth Client Secret - ClientSecret param.Field[string] `json:"client_secret"` + ClientSecret string `json:"client_secret"` // The claim name for email in the id_token response. - EmailClaimName param.Field[string] `json:"email_claim_name"` + EmailClaimName string `json:"email_claim_name"` // Your PingOne environment identifier - PingEnvID param.Field[string] `json:"ping_env_id"` + PingEnvID string `json:"ping_env_id"` + JSON identityProviderListResponseAccessPingoneConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessPingoneConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessPingoneConfigJSON contains the JSON metadata +// for the struct [IdentityProviderListResponseAccessPingoneConfig] +type identityProviderListResponseAccessPingoneConfigJSON struct { + Claims apijson.Field + ClientID apijson.Field + ClientSecret apijson.Field + EmailClaimName apijson.Field + PingEnvID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessPingoneConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessPingoneConfigJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessSAML struct { +type IdentityProviderListResponseAccessSAML 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"` + Config IdentityProviderListResponseAccessSAMLConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessSAMLJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessSAML) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessSAMLJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessSAML] +type identityProviderListResponseAccessSAMLJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessSAML) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessSAML) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessSAML) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessSAMLJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessSAML) ImplementsIdentityProviderUpdateParams() { - -} +func (r IdentityProviderListResponseAccessSAML) implementsZeroTrustIdentityProviderListResponse() {} // 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 { +type IdentityProviderListResponseAccessSAMLConfig 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"` + Attributes []string `json:"attributes"` // The attribute name for email in the SAML response. - EmailAttributeName param.Field[string] `json:"email_attribute_name"` + EmailAttributeName 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[[]IdentityProviderUpdateParamsAccessSAMLConfigHeaderAttribute] `json:"header_attributes"` + HeaderAttributes []IdentityProviderListResponseAccessSAMLConfigHeaderAttribute `json:"header_attributes"` // X509 certificate to verify the signature in the SAML authentication response - IDPPublicCERTs param.Field[[]string] `json:"idp_public_certs"` + IDPPublicCERTs []string `json:"idp_public_certs"` // IdP Entity ID or Issuer URL - IssuerURL param.Field[string] `json:"issuer_url"` + IssuerURL 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"` + SignRequest bool `json:"sign_request"` // URL to send the SAML authentication requests to - SSOTargetURL param.Field[string] `json:"sso_target_url"` + SSOTargetURL string `json:"sso_target_url"` + JSON identityProviderListResponseAccessSAMLConfigJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessSAMLConfig) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessSAMLConfigJSON contains the JSON metadata for +// the struct [IdentityProviderListResponseAccessSAMLConfig] +type identityProviderListResponseAccessSAMLConfigJSON struct { + Attributes apijson.Field + EmailAttributeName apijson.Field + HeaderAttributes apijson.Field + IDPPublicCERTs apijson.Field + IssuerURL apijson.Field + SignRequest apijson.Field + SSOTargetURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessSAMLConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessSAMLConfigJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessSAMLConfigHeaderAttribute struct { +type IdentityProviderListResponseAccessSAMLConfigHeaderAttribute struct { // attribute name from the IDP - AttributeName param.Field[string] `json:"attribute_name"` + AttributeName string `json:"attribute_name"` // header that will be added on the request to the origin - HeaderName param.Field[string] `json:"header_name"` + HeaderName string `json:"header_name"` + JSON identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessSAMLConfigHeaderAttribute) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON contains the +// JSON metadata for the struct +// [IdentityProviderListResponseAccessSAMLConfigHeaderAttribute] +type identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON struct { + AttributeName apijson.Field + HeaderName apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderListResponseAccessSAMLConfigHeaderAttribute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderListResponseAccessSAMLConfigHeaderAttributeJSON) RawJSON() string { + return r.raw } -type IdentityProviderUpdateParamsAccessYandex struct { +type IdentityProviderListResponseAccessYandex 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[GenericOAuthConfigParam] `json:"config,required"` + Config GenericOAuthConfig `json:"config,required"` // The name of the identity provider, shown to users on the login page. - Name param.Field[string] `json:"name,required"` + Name 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[IdentityProviderType] `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"` + Type IdentityProviderType `json:"type,required"` + // UUID + ID string `json:"id"` // The configuration settings for enabling a System for Cross-Domain Identity // Management (SCIM) with the identity provider. - ScimConfig param.Field[ScimConfigParam] `json:"scim_config"` + ScimConfig ScimConfig `json:"scim_config"` + JSON identityProviderListResponseAccessYandexJSON `json:"-"` } -func (r IdentityProviderUpdateParamsAccessYandex) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// identityProviderListResponseAccessYandexJSON contains the JSON metadata for the +// struct [IdentityProviderListResponseAccessYandex] +type identityProviderListResponseAccessYandexJSON struct { + Config apijson.Field + Name apijson.Field + Type apijson.Field + ID apijson.Field + ScimConfig apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r IdentityProviderUpdateParamsAccessYandex) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderListResponseAccessYandex) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r IdentityProviderUpdateParamsAccessYandex) getZoneID() param.Field[string] { - return r.ZoneID +func (r identityProviderListResponseAccessYandexJSON) RawJSON() string { + return r.raw } -func (IdentityProviderUpdateParamsAccessYandex) ImplementsIdentityProviderUpdateParams() { +func (r IdentityProviderListResponseAccessYandex) implementsZeroTrustIdentityProviderListResponse() {} +type IdentityProviderDeleteResponse struct { + // UUID + ID string `json:"id"` + JSON identityProviderDeleteResponseJSON `json:"-"` } -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[IdentityProviderType] `json:"type,required"` +// identityProviderDeleteResponseJSON contains the JSON metadata for the struct +// [IdentityProviderDeleteResponse] +type identityProviderDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IdentityProviderDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderDeleteResponseJSON) RawJSON() string { + return r.raw +} + +type IdentityProviderNewParams struct { + IdentityProvider IdentityProviderUnionParam `json:"identity_provider,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[ScimConfigParam] `json:"scim_config"` } -func (r IdentityProviderUpdateParamsAccessOnetimepin) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r IdentityProviderNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.IdentityProvider) +} + +type IdentityProviderNewResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result IdentityProvider `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 IdentityProviderUpdateParamsAccessOnetimepin) getAccountID() param.Field[string] { - return r.AccountID +func (r *IdentityProviderNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r identityProviderNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } -func (r IdentityProviderUpdateParamsAccessOnetimepin) getZoneID() param.Field[string] { - return r.ZoneID +// 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 } -func (IdentityProviderUpdateParamsAccessOnetimepin) ImplementsIdentityProviderUpdateParams() { +type IdentityProviderUpdateParams struct { + IdentityProvider IdentityProviderUnionParam `json:"identity_provider,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"` +} +func (r IdentityProviderUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.IdentityProvider) } type IdentityProviderUpdateResponseEnvelope struct { diff --git a/zero_trust/identityprovider_test.go b/zero_trust/identityprovider_test.go index a9a529b41eb..9cc3f88cbc1 100644 --- a/zero_trust/identityprovider_test.go +++ b/zero_trust/identityprovider_test.go @@ -28,28 +28,30 @@ func TestIdentityProviderNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.ZeroTrust.IdentityProviders.New(context.TODO(), zero_trust.IdentityProviderNewParamsAzureAD{ - Config: cloudflare.F(zero_trust.IdentityProviderNewParamsAzureADConfig{ - 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.IdentityProviderNewParamsAzureADConfigPromptLogin), - SupportGroups: cloudflare.F(true), - }), - Name: cloudflare.F("Widget Corps IDP"), - Type: cloudflare.F(zero_trust.IdentityProviderTypeOnetimepin), + _, err := client.ZeroTrust.IdentityProviders.New(context.TODO(), zero_trust.IdentityProviderNewParams{ + IdentityProvider: zero_trust.AzureADParam{ + Config: cloudflare.F(zero_trust.AzureADConfigParam{ + 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.AzureADConfigPromptLogin), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(zero_trust.ScimConfigParam{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(zero_trust.IdentityProviderTypeOnetimepin), + }, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ScimConfig: cloudflare.F(zero_trust.ScimConfigParam{ - Enabled: cloudflare.F(true), - GroupMemberDeprovision: cloudflare.F(true), - SeatDeprovision: cloudflare.F(true), - Secret: cloudflare.F("string"), - UserDeprovision: cloudflare.F(true), - }), }) if err != nil { var apierr *cloudflare.Error @@ -77,28 +79,30 @@ func TestIdentityProviderUpdateWithOptionalParams(t *testing.T) { _, err := client.ZeroTrust.IdentityProviders.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - zero_trust.IdentityProviderUpdateParamsAzureAD{ - Config: cloudflare.F(zero_trust.IdentityProviderUpdateParamsAzureADConfig{ - 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.IdentityProviderUpdateParamsAzureADConfigPromptLogin), - SupportGroups: cloudflare.F(true), - }), - Name: cloudflare.F("Widget Corps IDP"), - Type: cloudflare.F(zero_trust.IdentityProviderTypeOnetimepin), + zero_trust.IdentityProviderUpdateParams{ + IdentityProvider: zero_trust.AzureADParam{ + Config: cloudflare.F(zero_trust.AzureADConfigParam{ + 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.AzureADConfigPromptLogin), + SupportGroups: cloudflare.F(true), + }), + Name: cloudflare.F("Widget Corps IDP"), + ScimConfig: cloudflare.F(zero_trust.ScimConfigParam{ + Enabled: cloudflare.F(true), + GroupMemberDeprovision: cloudflare.F(true), + SeatDeprovision: cloudflare.F(true), + Secret: cloudflare.F("string"), + UserDeprovision: cloudflare.F(true), + }), + Type: cloudflare.F(zero_trust.IdentityProviderTypeOnetimepin), + }, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - ScimConfig: cloudflare.F(zero_trust.ScimConfigParam{ - Enabled: cloudflare.F(true), - GroupMemberDeprovision: cloudflare.F(true), - SeatDeprovision: cloudflare.F(true), - Secret: cloudflare.F("string"), - UserDeprovision: cloudflare.F(true), - }), }, ) if err != nil { diff --git a/zero_trust/networkvirtualnetwork.go b/zero_trust/networkvirtualnetwork.go index 2d5cd8b2b56..ff73de83199 100644 --- a/zero_trust/networkvirtualnetwork.go +++ b/zero_trust/networkvirtualnetwork.go @@ -300,8 +300,8 @@ func (r NetworkVirtualNetworkListParams) URLQuery() (v url.Values) { type NetworkVirtualNetworkDeleteParams struct { // Cloudflare account ID - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r NetworkVirtualNetworkDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/networkvirtualnetwork_test.go b/zero_trust/networkvirtualnetwork_test.go index a95deb18523..66f6131296e 100644 --- a/zero_trust/networkvirtualnetwork_test.go +++ b/zero_trust/networkvirtualnetwork_test.go @@ -93,7 +93,7 @@ func TestNetworkVirtualNetworkDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkVirtualNetworkDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/seat.go b/zero_trust/seat.go index e13b59a4907..c01df49bd63 100644 --- a/zero_trust/seat.go +++ b/zero_trust/seat.go @@ -78,7 +78,7 @@ func (r seatJSON) RawJSON() string { } type SeatEditParams struct { - Body param.Field[[]SeatEditParamsBody] `json:"body,required"` + Body []SeatEditParamsBody `json:"body,required"` } func (r SeatEditParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/seat_test.go b/zero_trust/seat_test.go index e05ab143ea2..b5ff38ff749 100644 --- a/zero_trust/seat_test.go +++ b/zero_trust/seat_test.go @@ -32,7 +32,7 @@ func TestSeatEdit(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", zero_trust.SeatEditParams{ - Body: cloudflare.F([]zero_trust.SeatEditParamsBody{{ + Body: []zero_trust.SeatEditParamsBody{{ AccessSeat: cloudflare.F(false), GatewaySeat: cloudflare.F(false), }, { @@ -41,7 +41,7 @@ func TestSeatEdit(t *testing.T) { }, { AccessSeat: cloudflare.F(false), GatewaySeat: cloudflare.F(false), - }}), + }}, }, ) if err != nil { diff --git a/zero_trust/tunnel.go b/zero_trust/tunnel.go index 12c5296b147..0434074ded8 100644 --- a/zero_trust/tunnel.go +++ b/zero_trust/tunnel.go @@ -308,8 +308,8 @@ func (r TunnelListParams) URLQuery() (v url.Values) { type TunnelDeleteParams struct { // Cloudflare account ID - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r TunnelDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/tunnel_test.go b/zero_trust/tunnel_test.go index 4accf4ae8ee..83ca927fc19 100644 --- a/zero_trust/tunnel_test.go +++ b/zero_trust/tunnel_test.go @@ -99,7 +99,7 @@ func TestTunnelDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.TunnelDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zero_trust/tunnelconnection.go b/zero_trust/tunnelconnection.go index 357d71ba49b..fde63ebb808 100644 --- a/zero_trust/tunnelconnection.go +++ b/zero_trust/tunnelconnection.go @@ -177,8 +177,8 @@ func (r TunnelConnectionDeleteResponseArray) ImplementsZeroTrustTunnelConnection type TunnelConnectionDeleteParams struct { // Cloudflare account ID - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[interface{}] `json:"body,required"` + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r TunnelConnectionDeleteParams) MarshalJSON() (data []byte, err error) { diff --git a/zero_trust/tunnelconnection_test.go b/zero_trust/tunnelconnection_test.go index 127942e2e83..bbb7625efa7 100644 --- a/zero_trust/tunnelconnection_test.go +++ b/zero_trust/tunnelconnection_test.go @@ -33,7 +33,7 @@ func TestTunnelConnectionDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.TunnelConnectionDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: cloudflare.F[any](map[string]interface{}{}), + Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/zones/aliases.go b/zones/aliases.go index 29f0b1c09a5..1dfb5d1bc51 100644 --- a/zones/aliases.go +++ b/zones/aliases.go @@ -17,21 +17,3 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type ResponseInfoParam = shared.ResponseInfoParam - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c - -// An object configuring the rule's logging behavior. -// -// This is an alias to an internal type. -type UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam = shared.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751cParam - -// This is an alias to an internal type. -type UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion = shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion - -// JSON encoded metadata about the uploaded parts and Worker configuration. -// -// This is an alias to an internal type. -type UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param = shared.UnnamedSchemaRefEe1e79edcb234d14c4dd266880f2fd24Param diff --git a/zones/dnssetting.go b/zones/dnssetting.go index 8f36e45e3b0..af5b117a30d 100644 --- a/zones/dnssetting.go +++ b/zones/dnssetting.go @@ -78,6 +78,15 @@ func (r dnsSettingJSON) RawJSON() string { return r.raw } +type DNSSettingParam struct { + // Settings determining the nameservers through which the zone should be available. + Nameservers param.Field[NameserverParam] `json:"nameservers"` +} + +func (r DNSSettingParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // Settings determining the nameservers through which the zone should be available. type Nameserver struct { // Nameserver type @@ -128,13 +137,12 @@ func (r NameserverParam) MarshalJSON() (data []byte, err error) { type DNSSettingEditParams struct { // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Settings determining the nameservers through which the zone should be available. - Nameservers param.Field[NameserverParam] `json:"nameservers"` + ZoneID param.Field[string] `path:"zone_id,required"` + DNSSetting DNSSettingParam `json:"dns_setting,required"` } func (r DNSSettingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r.DNSSetting) } type DNSSettingEditResponseEnvelope struct { diff --git a/zones/dnssetting_test.go b/zones/dnssetting_test.go index 6c1564332a1..424296234bc 100644 --- a/zones/dnssetting_test.go +++ b/zones/dnssetting_test.go @@ -30,9 +30,11 @@ func TestDNSSettingEditWithOptionalParams(t *testing.T) { ) _, err := client.Zones.DNSSettings.Edit(context.TODO(), zones.DNSSettingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Nameservers: cloudflare.F(zones.NameserverParam{ - Type: cloudflare.F(zones.NameserverTypeCloudflareStandard), - }), + DNSSetting: zones.DNSSettingParam{ + Nameservers: cloudflare.F(zones.NameserverParam{ + Type: cloudflare.F(zones.NameserverTypeCloudflareStandard), + }), + }, }) if err != nil { var apierr *cloudflare.Error diff --git a/zones/subscription.go b/zones/subscription.go index 479d3a2d5cc..d0a6ca15958 100644 --- a/zones/subscription.go +++ b/zones/subscription.go @@ -6,14 +6,15 @@ import ( "context" "fmt" "net/http" + "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/user" + "github.com/tidwall/gjson" ) // SubscriptionService contains methods and other services that help with @@ -35,7 +36,7 @@ func NewSubscriptionService(opts ...option.RequestOption) (r *SubscriptionServic } // Create a zone subscription, either plan or add-ons. -func (r *SubscriptionService) New(ctx context.Context, identifier string, body SubscriptionNewParams, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) New(ctx context.Context, identifier string, body SubscriptionNewParams, opts ...option.RequestOption) (res *SubscriptionNewResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionNewResponseEnvelope path := fmt.Sprintf("zones/%s/subscription", identifier) @@ -71,7 +72,7 @@ func (r *SubscriptionService) ListAutoPaging(ctx context.Context, accountIdentif } // Lists zone subscription details. -func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion, err error) { +func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *SubscriptionGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SubscriptionGetResponseEnvelope path := fmt.Sprintf("zones/%s/subscription", identifier) @@ -83,99 +84,52 @@ func (r *SubscriptionService) Get(ctx context.Context, identifier string, opts . return } -type SubscriptionNewParams struct { - App param.Field[SubscriptionNewParamsApp] `json:"app"` - // The list of add-ons subscribed to. - ComponentValues param.Field[[]SubscriptionNewParamsComponentValue] `json:"component_values"` - // How often the subscription is renewed automatically. - Frequency param.Field[SubscriptionNewParamsFrequency] `json:"frequency"` - // The rate plan applied to the subscription. - RatePlan param.Field[SubscriptionNewParamsRatePlan] `json:"rate_plan"` - // A simple zone object. May have null properties if not a zone subscription. - Zone param.Field[SubscriptionNewParamsZone] `json:"zone"` -} - -func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SubscriptionNewParamsApp struct { - // app install id. - InstallID param.Field[string] `json:"install_id"` -} - -func (r SubscriptionNewParamsApp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A component value for a subscription. -type SubscriptionNewParamsComponentValue struct { - // The default amount assigned. - Default param.Field[float64] `json:"default"` - // The name of the component value. - Name param.Field[string] `json:"name"` - // The unit price for the component value. - Price param.Field[float64] `json:"price"` - // The amount of the component value assigned. - Value param.Field[float64] `json:"value"` -} - -func (r SubscriptionNewParamsComponentValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// Union satisfied by [zones.SubscriptionNewResponseUnknown] or +// [shared.UnionString]. +type SubscriptionNewResponseUnion interface { + ImplementsZonesSubscriptionNewResponseUnion() } -// How often the subscription is renewed automatically. -type SubscriptionNewParamsFrequency string - -const ( - SubscriptionNewParamsFrequencyWeekly SubscriptionNewParamsFrequency = "weekly" - SubscriptionNewParamsFrequencyMonthly SubscriptionNewParamsFrequency = "monthly" - SubscriptionNewParamsFrequencyQuarterly SubscriptionNewParamsFrequency = "quarterly" - SubscriptionNewParamsFrequencyYearly SubscriptionNewParamsFrequency = "yearly" -) - -func (r SubscriptionNewParamsFrequency) IsKnown() bool { - switch r { - case SubscriptionNewParamsFrequencyWeekly, SubscriptionNewParamsFrequencyMonthly, SubscriptionNewParamsFrequencyQuarterly, SubscriptionNewParamsFrequencyYearly: - return true - } - return false +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) } -// The rate plan applied to the subscription. -type SubscriptionNewParamsRatePlan struct { - // The ID of the rate plan. - ID param.Field[string] `json:"id"` - // The currency applied to the rate plan subscription. - Currency param.Field[string] `json:"currency"` - // Whether this rate plan is managed externally from Cloudflare. - ExternallyManaged param.Field[bool] `json:"externally_managed"` - // Whether a rate plan is enterprise-based (or newly adopted term contract). - IsContract param.Field[bool] `json:"is_contract"` - // The full name of the rate plan. - PublicName param.Field[string] `json:"public_name"` - // The scope that this rate plan applies to. - Scope param.Field[string] `json:"scope"` - // The list of sets this rate plan applies to. - Sets param.Field[[]string] `json:"sets"` +// Union satisfied by [zones.SubscriptionGetResponseUnknown] or +// [shared.UnionString]. +type SubscriptionGetResponseUnion interface { + ImplementsZonesSubscriptionGetResponseUnion() } -func (r SubscriptionNewParamsRatePlan) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*SubscriptionGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) } -// A simple zone object. May have null properties if not a zone subscription. -type SubscriptionNewParamsZone struct { +type SubscriptionNewParams struct { + Subscription user.SubscriptionParam `json:"subscription,required"` } -func (r SubscriptionNewParamsZone) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Subscription) } type SubscriptionNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionNewResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionNewResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionNewResponseEnvelopeJSON `json:"-"` @@ -216,9 +170,9 @@ func (r SubscriptionNewResponseEnvelopeSuccess) IsKnown() bool { } type SubscriptionGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716aUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result SubscriptionGetResponseUnion `json:"result,required"` // Whether the API call was successful Success SubscriptionGetResponseEnvelopeSuccess `json:"success,required"` JSON subscriptionGetResponseEnvelopeJSON `json:"-"` diff --git a/zones/subscription_test.go b/zones/subscription_test.go index ea255897079..e1914b3d42b 100644 --- a/zones/subscription_test.go +++ b/zones/subscription_test.go @@ -11,6 +11,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/user" "github.com/cloudflare/cloudflare-go/v2/zones" ) @@ -32,36 +33,38 @@ func TestSubscriptionNewWithOptionalParams(t *testing.T) { context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2", zones.SubscriptionNewParams{ - App: cloudflare.F(zones.SubscriptionNewParamsApp{ - InstallID: cloudflare.F("string"), - }), - ComponentValues: cloudflare.F([]zones.SubscriptionNewParamsComponentValue{{ - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }, { - Default: cloudflare.F(5.000000), - Name: cloudflare.F("page_rules"), - Price: cloudflare.F(5.000000), - Value: cloudflare.F(20.000000), - }}), - Frequency: cloudflare.F(zones.SubscriptionNewParamsFrequencyMonthly), - RatePlan: cloudflare.F(zones.SubscriptionNewParamsRatePlan{ - Currency: cloudflare.F("USD"), - ExternallyManaged: cloudflare.F(false), - ID: cloudflare.F("free"), - IsContract: cloudflare.F(false), - PublicName: cloudflare.F("Business Plan"), - Scope: cloudflare.F("zone"), - Sets: cloudflare.F([]string{"string", "string", "string"}), - }), - Zone: cloudflare.F(zones.SubscriptionNewParamsZone{}), + Subscription: user.SubscriptionParam{ + App: cloudflare.F(user.SubscriptionAppParam{ + InstallID: cloudflare.F("string"), + }), + ComponentValues: cloudflare.F([]user.SubscriptionComponentValueParam{{ + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }, { + Default: cloudflare.F(5.000000), + Name: cloudflare.F("page_rules"), + Price: cloudflare.F(5.000000), + Value: cloudflare.F(20.000000), + }}), + Frequency: cloudflare.F(user.SubscriptionFrequencyMonthly), + RatePlan: cloudflare.F(user.SubscriptionRatePlanParam{ + Currency: cloudflare.F("USD"), + ExternallyManaged: cloudflare.F(false), + ID: cloudflare.F("free"), + IsContract: cloudflare.F(false), + PublicName: cloudflare.F("Business Plan"), + Scope: cloudflare.F("zone"), + Sets: cloudflare.F([]string{"string", "string", "string"}), + }), + Zone: cloudflare.F(user.SubscriptionZoneParam{}), + }, }, ) if err != nil {